Tuesday, March 30, 2010

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.

No comments:

Post a Comment