Wednesday, March 31, 2010

Demon Pentagon Part 4



As you can see in the above graph, the values for the max and min seem to converge towards zero throughout the trial. Probably the way to prove that the trial finishes is to show that the max and min values converge towards zero, always.

The graph only shows what happens for this one specific case.

Tuesday, March 30, 2010

Daemon in a Pentagon (part 3)

In the last post, I had found 2 simple cases for the demon pentagon to clearly finish. Now it seems that the problem is getting harder.

Case #3


If one vertex is surrounded by 2 negative vertices then it will become positive, but the 2 adjacent vertices will become more negative. (But remember that the sum doesn't get any worse)

ie try

{1,-3,-2,-3,10} If the Daemon picks the -2, . . .

(Hey I'm not going to argue with a Daemon, maybe they breathe fire, or they might have large teeth and hinged jaws that drool green digestive juices . . .)

then the result becomes

{1,-5,2,-5,10} which doesn't exactly finish right away, as the negative fives aren't surrounded by nice larger numbers. (at least the sum is still the same)

It seems that the quantity of negative numbers is getting smaller, I wonder if this is always the case?

It seems not as shown on my sample sheet (the scan from Daemon #1 post) There are originally 4 vertices with the negative numbers. (all -3) each step seems to decrease the number of negative values. This is true until step 4.

The Pentagon goes from having only one negative number (-12) to having 2 negative numbers again (-9,-9) so it is possible for the amount of negative values to increase. We want them to all go away.

In the sample solution, they do all go away. I get an intuitive feeling that they should all go away eventually. In the several examples it always seems to work. but how to prove it?

Progression of Negative Vertices

Step#, # of negative vertices

0,4 START
1,3
2,3
3,2
4,1
5,2
6,2
7,1
8,2
9,2
10,1
11,2
12,1
13,2
14,1
15,2
16,2
17,1
18,1
19,1
20,0 Done

So there does seem to be a progression, with the number of negative vertices decreasing quickly from 4 to 1, and then jumping from one to two and back again until settling on one and then stopping at zero.

If the demon picked other vertices than I did in each step, then the number of steps may be different. (or not? the same?)

Also the fact that this is a pentagon may be another factor. if it was an even sided figure, I'd bet that it would be less likely to finish. I wonder what would happen for a triangle or a square?

It seems to work the same for triangles and squares. So reducing the number of sides doesn't seem to help much.

The triangle and the square do seem to progress faster. I am not entirely sure that if you had an even number of sides that you couldn't get a condition where the numbers flip back and forth.

One example that I tried with a square, with 2 negative sides and 2 positive sides would never seem to finish. Proving that the square would never finish doesn't seem any easier than proving that the pentagon will finish, however, so this isn't exactly a simpler problem.

demon in a pentagon part 2

In the above and last post you can see a picture. If you click on the picture it will resize to something more legible. This is a sample run through of one instance of the Daemon Pentagon.

you will notice at step 0, the values for the 5 vertices are: {-3,-3,-3,-3,15}.

This satisfies the condtions of the problem, that all the vertices are integers, and although some may be negative, their net sum is positive.

In this case it is positive value of 3. One of the first things I noticed, from doing the diagram, is that the sum of the vertices is a constant value that never seems to change. The demon manipulation never changes the sum total of all the vertices. While this may or may not help us to solve our problem, it might be useful. This is what the circled (#3) in the heart of the pentagon represents.

You will also notice that our problem terminates (in this case) after 21 steps when all vertices are 0, except for one vertex that has a value 3. (sum still 3)

I have tried other examples, where the final vertices don't contain any zeros, so the number zero isn't a condition for completion. But in our case, I'd guess that we'd have to consider zero to be a positive number. Ie. the Daemon finishes when all of the numbers in the pentagon are non-negative ie {x1,x2,x3,x4,x5|>=0)

The included example may be too complicated, so I am going to try a simpler example
------------------------------------------------------------------------------------

Simple Case #1,


All vertices are positive, and then the sum of the vertices is positive. We are done, The daemon can't do anything. Could this be a base case?
------------------------------------------------------------------------------------
Simple Case #2

if you consider the simple problem of {1,2,5,-3,5}

note: ** the end of the list is connected to the beginning, imagine the pentagon or write it out on paper **

then the only number that clearly needs changing is the -3. This number is trapped between two fives, so the solution is easy.

{1,2,5,-3,5} goes to {1,2,2,3,2} and we are done.

( Notice the sums in both cases are 10, satisfying our "sum property." )
-------------------------------------------------------------------------------------
in fact, I am going to try to formalize the sum property.

x1+x2+x3+x4+x5 > 0, where x1..x5 are all integers
x1+x2+x3+x4+x5 = c, where c > 0.

the daemon step to remove the negative number basically does this:

(IE assume x3 is negative.)

x1,x2+x3,abs(x3),x4+x3,x5 ## abs(x3) is the absolute value of x3

this is the same as

x1, x2-x3, -x3 +x3+x3, x4-x3, x5.

the 2*x3 added to the negative x3, cancel each x3 subtracted from the adjacent vertices to x3.

so we know that the "sum property" always holds, as the daemon only changes one vertex at a time, and only affects 3 vertices, with no net effect to the sum total of all vertices.

I don't know if this feature of the problem is useful, but now at least we know that the problem can never have the situation where all of the vertices become negative. (The sum is always positive, and it is always the same unchanging positive value c.)

(for each instance of the problem) If all vertices were to become negative then the demon would never finish, as he could spend forever changing the negative numbers to positive and back again.

Daemon in a Pentagon


There is a problem in the first chapter of the course notes called Daemon in a Pentagon. It has nothing to do with some mythical creature living in a Washington military complex, rather it is like one of those puzzles in the paper, that grabs hold of you and won't let go.

I will quote the original text: (Ch1, p10.)

There is a pentagon, and at each vertex there is an integer number. The numbers can be negative, but their sum is positive. A daemon living inside the pentagon manipulates the numbers with the following atomic action. If it spots a negative number at one the vertices, it adds that number to its two neighbours and negates the number at the original vertex. Prove that no matter what numbers we start with, eventually the daemon cannot change any of the numbers.

I am going to try to solve this problem, following the G.Polya, how to solve it guide.

http://www.math.edu/~alfeld/math/polya.html

First you have to understand the problem . . .

Hey, if I understood the problem, I could solve it right away? but it is true that if you don't know the problem, if you aren't familiar with the problem, you will probably dither away your time, rather than solve the problem.

I tried doing several "daemon pentagons" on paper to see what would happen. The worst possible example is included here:

Sunday, January 31, 2010

Using Logic fonts in MS Word


If you want to use logic fonts in ms word you can, its just not very fun :-(
here's how. you need to use the Lucida Sans Unicode font. It has the Upside down A and the Backwards E and other symbols that logic is so fond of.

http://sshieh.web.wesleyan.edu/wescourses/2006s/phil290/01/logic_fonts.htm

If you want to do it the hard way, you can use LaTex

http://www.latex-project.org/
Instructor's links (for reference)
http://en.wikibooks.org/wiki/LaTeX
http://www.latex-project.org/guides/

It'll probably take some time but it may be worth it.
--------------------------------------------------------------------------
to make a pdf from a *.tex file in Linux (on cdf)

nedit file.tex
pdflatex file
--------------------------------------------------------------------------

Using CDF From Home

Quick Info on using CDF from Home or your Laptop

If you've learned how to do this from other courses this may seem redundant, but it was a bit of a roadblock for me. There seems to be not enough information on how to do this, or it isn't all in one place.

the NX client program makes it like you're at CDF, but at home. This is extremely useful, if you're like me and work on things at odd hours. In order for you to be able to use cdf at home you need to log into CDF at one of the labs at school.

1) Get you cdf user name from here:
http://www.cdf.toronto.edu/cgi-bin/webfinger/

2) login and change password at CDF terminal computer at one the CDF labs, use student card to open the door. (If you have already done this once, then you can skip this step.)

3) Download and install Client program to logon to CDF (Creates a virtual desktop) on your home computer/laptop

the configuration steps for NX are here, (including download links)
https://www.cdf.toronto.edu/nx/nx.php

Initial Setup

I did have a problem with the initial setup, however. I received this error message

> NX> 203 NXSSH running with pid: 4068
>
> NX> 285 Enabling check on switch command
>
> NX> 285 Enabling skip of SSH config files
>
> NX> 285 Setting the preferred NX options
>
> ssh: connect to host nxserv.cdf.toronto.edu port 22: Connection timed
> out

in step 3c, I typed nxserv.cdf.toronto.edu, instead of the required nxsrv.cdf.toronto.edu
once I changed this it worked fine. The online instructions in step 3c say that it should be nxsrv1.cdf.toronto.edu, which I found out later to be incorrect. (The Q/A board listed below had a post to similar effect.) Unfortunately when I edited the line to remove the 1, I added an extra 'e.' Anyway fresh eyes from one of the CDF admin, that replied by email, caught my mistake and saved many hours of frustration.
Sometimes you just can't see your own mistakes, and not for lack of trying.

----------------------------
Other Useful CDF Links
----------------------------
Student CDF web login
https://www.cdf.toronto.edu/main.php

Student's Guide to CDF
http://www.cdf.toronto.edu/welcome/cdf.html#help

Q/A Board
https://csc.cdf.toronto.edu/bb/YaBB.pl?board=contact_cdf
or more generally,
https://csc.cdf.toronto.edu/bb/YaBB.pl

Email Address for unresolved help (cdf admin)
admin@cdf.toronto.edu