I captured an ancient Fibonacci Monster

  • Context: Undergrad 
  • Thread starter Thread starter DeyuanGuo
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around a Python code that generates visual patterns based on Fibonacci sequences, referred to as "Fibonacci Monsters" and "Fibonacci Deer." Participants explore mathematical interpretations, the nature of the generated shapes, and the underlying principles of the algorithms used.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant shares Python code that generates shapes based on Fibonacci sequences and requests a mathematical interpretation.
  • Some participants mention pareidolia, suggesting that the shapes may not have inherent mathematical meaning but rather resemble recognizable forms.
  • Another participant introduces singular value decomposition (SVD) as a related concept, discussing its application in digital image processing and approximation techniques.
  • A participant proposes a mathematical framework involving sums of sine and cosine functions of Fibonacci numbers, questioning why the resulting shapes form closed curves.
  • Another participant elaborates on the conditions under which the drawing becomes a closed curve, discussing periodic sequences and their implications for the shapes generated.
  • Concerns are raised about the potential influence of integer overflow on the generated shapes, with suggestions to modify the code to prevent this issue.

Areas of Agreement / Disagreement

Participants express a variety of interpretations regarding the mathematical significance of the generated shapes, with some asserting that they lack meaning while others explore their properties. The discussion remains unresolved regarding the exact reasons for the closed curves and the impact of different initial conditions on the outcomes.

Contextual Notes

Some participants note that the Fibonacci sequences used may exhibit periodic behavior modulo 360, but the implications of this periodicity and its effects on the generated shapes are not fully explored. Additionally, there are mentions of potential non-periodic behavior before reaching periodicity.

DeyuanGuo
Messages
7
Reaction score
0
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.

Fibonacci_Monster.gif


Code:
from turtle import *
j, k = 1, 1
while True:
    i = j + k
    j, k = i, j
    forward(20)
    right(i % 360)

Another creature, named Fibonacci Deer, was found together.
Just by changing the first two number to 1, 5:

Fibonacci_Deer.gif


Code:
from turtle import *
j, k = 1, 5
while True:
    i = j + k
    j, k = i, j
    forward(20)
    right(i % 360)

Can anybody give me a mathematic interpretation? Thanks!
--Deyuan
 
Last edited:
Mathematics news on Phys.org
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

[tex]A_k=σ_1u_1v^T_1+...+σ_ku_kv^T_k[/tex]

[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].
 
phion said:

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..
 
DeyuanGuo said:
haha, I don't think Pareidolia is a mathmatic interpretation, it's just one of the abilities of mathematician..

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?
 
Number Nine said:
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?

Thanks, I see. Though I called them monster or deer, they are just a kind of imagination.
Perhaps the explanation is like this:

Why:
Ʃ(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...
 
DeyuanGuo said:
I don't know why it becomes a closed curve
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
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:
  • #10
P.S.:
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,
    http://www.thefirstfew.com/2010/04/spirograph-retro-toy/
    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. :)
 
  • #11
Dodo said:
And by the way, DeyuanGuo... a very funny subject it is, congratulations. :)

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?
 
  • #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.
 
  • #13
willem2 said:
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.

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:
  • #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))
 
  • #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.
 
  • #16
NemoReally said:
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))

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:
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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 16 ·
Replies
16
Views
3K
Replies
47
Views
5K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K