1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I captured an ancient Fibonacci Monster

  1. Jan 31, 2013 #1
    Hello guys. I'm a newcomer here, and I'm from Beijing, China.
    This rare creature, named Fibonacci Monster, was born from the Big Bang.
    I happened to capture it by running the following Python code. I like it.


    Code (Text):
    from turtle import *
    j, k = 1, 1
    while True:
        i = j + k
        j, k = i, j
        right(i % 360)
    Another creature, named Fibonacci Deer, was found together.
    Just by changing the first two number to 1, 5:


    Code (Text):
    from turtle import *
    j, k = 1, 5
    while True:
        i = j + k
        j, k = i, j
        right(i % 360)
    Can anybody give me a mathematic interpretation? Thanks!
    Last edited: Jan 31, 2013
  2. jcsd
  3. Feb 1, 2013 #2


    User Avatar
    Homework Helper

  4. Feb 1, 2013 #3
    haha, I don't think Pareidolia is a mathmatic interpretation, it's just one of the abilities of mathematician..
  5. Feb 1, 2013 #4


    User Avatar
    Gold Member

    This reminds me of singular value decomposition. It's a pretty common phenomena related to efficiency in the transmission of digital image pixels (satellite, fax, internet, etc.) and our ability to interpret them where blurry images become sharper and vice versa. By keeping all the "boring" parts out of the transmission close approximations can be found by reducing singular values and corresponding vector values, which, in turn, represents substantial savings in comprehensible data transmission! For example,

    [tex]A = σ_1u^T_1+...+ σ_r u_r v^T_r[/tex]

    Let [itex]k≤r[/itex] and define


    [itex]A_k[/itex] is an approximation to [itex]A[/itex] that corresponds to keeping only the fist [itex]_k[/itex] singular values and the corresponding singular vectors in an [itex]nXn[/itex] pixelated image within some arbitrary [itex]\mathbb{R}^n[/itex].
  6. Feb 1, 2013 #5


    User Avatar
    Gold Member

  7. Feb 1, 2013 #6
    Well, thank you! That seems interesting, and I think I need more time to learn about the SVD.

    In my opinion, I can describe this procedure like this:
    Start from the origin of Cartesian coordinate system:
    x(0) = 0
    y(0) = 0
    Then go to next point by forward L length and θ angle:
    x(n) = x(n-1) + L*cosθ
    y(n) = y(n-1) - L*sinθ
    here θ = F(n) / 180 * PI
    F(n) is the Nth number of Fibonacci sequence.

    I don't know why it becomes an closed curve and why it looks like this..
  8. Feb 1, 2013 #7
    What he's saying is that the figures don't mean anything. It's a mess of polygons that vaguely resemble something with legs; what kind of mathematical explanation do you expect there to be?
  9. Feb 1, 2013 #8
    Thanks, I see. Though I called them monster or deer, they are just a kind of imagination.
    Perhaps the explanation is like this:

    Ʃ(sin(F(i)/180*PI)) = 0
    Ʃ(cos(F(i)/180*PI)) = 0
    i = 0 to 119
    F(i) is the ith number in Fibonacci sequence.

    I'm not able to prove these equations, I just happened to find these facts...
  10. Feb 1, 2013 #9
    Now that is the interesting part of the question no one has tackled so far.

    It amounts to saying that[tex]\sum_{i=1}^M \langle r, (s_i \mbox{ mod } 360) \rangle = {\bf 0}[/tex]for some integer M, where <r,a> is notation for a two dimensional vector in polar coordinates (a vector with magnitude "r", the 20 in the Python programs, and direction "a" degrees), and [itex]s_i[/itex] is some integer sequence, Fibonacci or otherwise.

    Notice that a (non-zero) constant sequence will satisfy the statement above, drawing regular polygons: for example, the constant sequence {90,90,90,90,...} will draw a square, and the sequence {1,1,1,1,...} will draw the 360-sided regular polygon.

    Similarly, consider a periodic sequence with period P; that is, a sequence where the numbers repeat every P numbers. Take, for example, the sequence {11,22,33,11,22,33,...} where the numbers 11,22,33 repeat indefinitely. Let the vector <R,A> (again in polar form: a vector with magnitude R and direction A, with A in degrees for our purposes) be the sum of the P vectors with angles taken from the period: the sum of <20,11>, <20,22>, <20,33> in this example. In the long run, the drawing with the periodic sequence will go to the same place as the drawing of the constant sequence {A,A,A,A,...}, using a vector magnitude of r=R (instead of 20) in the statement above. Thus, a closed curve (as long as the angle sum A is non-zero modulo 360).

    In summary, the figure will be closed if the Fibonacci sequence (or the other one) modulo 360 is periodic (as long as the period adds up to a non-zero number). The fact that these Fibonacci-like recurrence sequences are periodic modulo some number is not hard to prove; see the first few lines near the beginning of
    http://www.math.temple.edu/~renault/fibonacci/fib.html [Broken]
    specifically, paragraph A.2. The part of the sum of the period being non-zero was just luck; for example, starting with 0,180 (instead of 1,1 or 1,5) would have not produced a closed curve.
    Last edited by a moderator: May 6, 2017
  11. Feb 1, 2013 #10
    There are a few loose ends in my argument above.
    • The sequence will eventually be periodic modulo 360... but it could have had a non-periodic startup before becoming periodic. For example, the sequence {1,2,3,4,5,4,5,4,5,4,5,...} begins with 1,2,3 and THEN enters the endless period 4,5. This means that the drawing could have had some curve wandering about, and THEN draw a closed curve from that point on. The fact that it draws a closed curve from the beginning is still unexplained. (But I have to go to work now!)
    • Each periodic repetition draws some curve, which may look like a "petal" of a flower; when repeated, the succession of "petals" will end up drawing a closed curve, the whole "flower". (This is a summary of what I tried to say in my previous post.) The resulting curve should have looked like one of these old "spirograph" drawings,
      In other words, the result could have easily been one monster... then another monster at an angle, then another, and another... giving a succession of monsters eating each other's tail, until completing a closed "polygon" where each side is a monster, instead of just a straight line. But we got exactly just one monster, not a succession of monsters following each other. This is still unexplained.

    And by the way, DeyuanGuo... a very funny subject it is, congratulations. :)
  12. Feb 1, 2013 #11
    Thank you very much for your professional explanation.
    I found these patterns are interesting. For example, if it starts from (j=1, k=7), then it will not be a closed curve.
    I think there are a lot of things I can learn from you. Could you please contact with me through my email: guodeyuan at gmail dot com?
  13. Feb 1, 2013 #12
    I think the monsters are influenced by integer overflow, Try to see what happens if you use i = (j+k) % 360 to keep i and j small.
  14. Feb 1, 2013 #13
    Thanks, but I'm sure that the integers i, j, k do not overflow.
    The Python language supports the long integer type, and it can only overflow after the computer memory exhausted.
    Last edited: Feb 1, 2013
  15. Feb 1, 2013 #14
    Interesting. I implemented it in Mathcad (using modulo arithmetic) and it seems as though initializing to (j k) results in a different patterns all of period of 120 except for the following (easily predicted) values, which move linearly ...

    j - k ......
    1 - 2 7 12 17
    2 - 4 9 14 19
    3 - 6 11 16 21
    4 - 8 13 18 23
    5 - 10 15 20 25

    (that is, start with j then choose a value from the various k values in that row, eg(j k) = (2 9) or (2 14))
  16. Feb 1, 2013 #15
    Another thing to look at is dividing the circle into n parts (rather than just 360 (degrees)) ... not all such n result in spatially cyclic sequences.
  17. Feb 2, 2013 #16
    Thanks for your reply. With the i = j + k and modulo 360 rule, all the 360*360 possibilities of initializing (j, k), from (0, 0) to (359, 359), has only 360 different patterns(I guess), and 4/5 of them are closed curves, while 1/5 of them are non-closed curves.

    These non-closed curves, or the linearly-moving pairs as you say, appear evenly and periodically in the 2-D plane:

    Code (Text):
    j\k 0 1 2 3 4 5 6 7 8 9 10 ...
    0   N         N         N
    1       N         N
    2           N         N
    3     N         N
    4         N         N
    5   N         N
    6       N         N
    I think investigating the different rules, such as i = j + 2k or modulo 180, etc., is a compicated but interesting work.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook