Author Topic: The Fibonacci Spiral is Bullsh*t  (Read 4864 times)

0 Members and 1 Guest are viewing this topic.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
The Fibonacci Spiral is Bullsh*t
« on: November 06, 2020, 02:13:12 pm »
This came up on discord this morning... so let me begin by saying I've always *hated* this image of the so-called Fibonacci spiral.

220px-FibonacciSpiral.svg.png

The boxes are fine, as the Fibonacci sequence lends itself to a nice box tiling like that... but that spiral always looked off to me. It's made of quarter arcs that abruptly change radius at every vertical and horizontal line. In other words, that's not math, that's art... So in this post, I reinforce this fact.

In this first chunk of code, we have the boxes-with-artsy-spiral image. You can see I had to do some silly business to make the spiral, because it's not really a mathy object:

Code: QB64: [Select]
  1.  
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3.  
  4. pi = 4 * ATN(1)
  5.  
  6. TYPE Vector
  7.     x AS DOUBLE
  8.     y AS DOUBLE
  9.  
  10. DIM SHARED CompassCart AS Vector
  11. DIM SHARED CompassTheta AS Vector
  12. CompassCart.x = 1
  13. CompassCart.y = -1
  14. CompassTheta.x = pi
  15. CompassTheta.y = 3 * pi / 2
  16.  
  17. DIM Step1 AS INTEGER
  18. DIM Step2 AS INTEGER
  19. DIM StepTemp AS INTEGER
  20. Step1 = 0
  21. Step2 = 1
  22.  
  23. DIM LastPoint AS Vector
  24.  
  25. LastPoint.x = 0
  26. LastPoint.y = 0
  27.  
  28. FOR j = 1 TO 12
  29.  
  30.     CALL StepCompass
  31.     StepTemp = Step2
  32.     Step2 = Step2 + Step1
  33.     Step1 = StepTemp
  34.  
  35.     x1 = LastPoint.x
  36.     y1 = LastPoint.y
  37.     x2 = x1 + SQR(2) * Step2 * CompassCart.x
  38.     y2 = y1 + SQR(2) * Step2 * CompassCart.y
  39.     CALL clineb(x1, y1, x2, y2, _RGBA(255, 255, 255, 255))
  40.  
  41.     IF (CompassCart.x = 1) AND (CompassCart.y = 1) THEN
  42.         CALL ccircle(x1, y2, SQR(2) * Step2, _RGBA(255, 255, 255, 255), CompassTheta.x, CompassTheta.y)
  43.     END IF
  44.     IF (CompassCart.x = -1) AND (CompassCart.y = 1) THEN
  45.         CALL ccircle(x2, y1, SQR(2) * Step2, _RGBA(255, 255, 255, 255), CompassTheta.x, CompassTheta.y)
  46.     END IF
  47.     IF (CompassCart.x = -1) AND (CompassCart.y = -1) THEN
  48.         CALL ccircle(x1, y2, SQR(2) * Step2, _RGBA(255, 255, 255, 255), CompassTheta.x, CompassTheta.y)
  49.     END IF
  50.     IF (CompassCart.x = 1) AND (CompassCart.y = -1) THEN
  51.         CALL ccircle(x2, y1, SQR(2) * Step2, _RGBA(255, 255, 255, 255), CompassTheta.x, CompassTheta.y)
  52.     END IF
  53.  
  54.     LastPoint.x = x2
  55.     LastPoint.y = y2
  56.  
  57. SUB StepCompass
  58.     DIM xx AS INTEGER
  59.     DIM yy AS INTEGER
  60.     xx = CompassCart.x
  61.     yy = CompassCart.y
  62.     IF (xx = 1) AND (yy = 1) THEN
  63.         CompassCart.x = -1
  64.         CompassCart.y = 1
  65.         CompassTheta.x = 0
  66.         CompassTheta.y = pi / 2
  67.     END IF
  68.     IF (xx = -1) AND (yy = 1) THEN
  69.         CompassCart.x = -1
  70.         CompassCart.y = -1
  71.         CompassTheta.x = pi / 2
  72.         CompassTheta.y = pi
  73.     END IF
  74.     IF (xx = -1) AND (yy = -1) THEN
  75.         CompassCart.x = 1
  76.         CompassCart.y = -1
  77.         CompassTheta.x = pi
  78.         CompassTheta.y = 3 * pi / 2
  79.     END IF
  80.     IF (xx = 1) AND (yy = -1) THEN
  81.         CompassCart.x = 1
  82.         CompassCart.y = 1
  83.         CompassTheta.x = 3 * pi / 2
  84.         CompassTheta.y = 2 * pi
  85.     END IF
  86.  
  87. SUB cpset (x1 AS DOUBLE, y1 AS DOUBLE, col AS _UNSIGNED LONG)
  88.     PSET (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2), col
  89.  
  90. SUB clineb (x1 AS DOUBLE, y1 AS DOUBLE, x2 AS DOUBLE, y2 AS DOUBLE, col AS _UNSIGNED LONG)
  91.     LINE (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2)-(_WIDTH / 2 + x2, -y2 + _HEIGHT / 2), col, B
  92.  
  93. SUB ccircle (x1 AS DOUBLE, y1 AS DOUBLE, rad AS DOUBLE, col AS _UNSIGNED LONG, ang1 AS DOUBLE, ang2 AS DOUBLE)
  94.     CIRCLE (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2), rad, col, ang1, ang2

ss1.png

Now, contrast this to a TRUE logarithmic spiral. The Fibonacci boxes are clearly wrong:

Code: QB64: [Select]
  1.  
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3.  
  4. phi = .5 * (1 + SQR(5))
  5. pi = 4 * ATN(1)
  6.  
  7. DIM theta AS DOUBLE
  8.  
  9. x0 = 0
  10. y0 = 0
  11. xp = x0
  12. yp = y0
  13. xd = 1
  14. yd = 1
  15.  
  16. FOR theta = (0) TO (3 * 2 * pi) STEP (.00001)
  17.     r = phi ^ (theta * 2 / pi)
  18.     x = cartx(r, theta)
  19.     y = carty(r, theta)
  20.     CALL cpset(x, y, _RGBA(255, 255, 255, 255))
  21.  
  22.     IF (xd = 1) THEN
  23.         IF (x > xp) THEN
  24.             xp = x
  25.         ELSE
  26.             CALL clineb(xp, yp, x0, y0, _RGBA(255, 0, 255, 255))
  27.             x0 = xp
  28.             y0 = yp
  29.             xp = x
  30.             xd = -1
  31.         END IF
  32.     ELSE
  33.         IF (x < xp) THEN
  34.             xp = x
  35.         ELSE
  36.             CALL clineb(xp, yp, x0, y0, _RGBA(255, 0, 255, 255))
  37.             x0 = xp
  38.             y0 = yp
  39.             xp = x
  40.             xd = 1
  41.         END IF
  42.     END IF
  43.  
  44.     IF (yd = 1) THEN
  45.         IF (y > yp) THEN
  46.             yp = y
  47.         ELSE
  48.             CALL clineb(xp, yp, x0, y0, _RGBA(255, 0, 255, 255))
  49.             x0 = xp
  50.             y0 = yp
  51.             yp = y
  52.             yd = -1
  53.         END IF
  54.     ELSE
  55.         IF (y < yp) THEN
  56.             yp = y
  57.         ELSE
  58.             CALL clineb(xp, yp, x0, y0, _RGBA(255, 0, 255, 255))
  59.             x0 = xp
  60.             y0 = yp
  61.             yp = y
  62.             yd = 1
  63.         END IF
  64.     END IF
  65.  
  66.  
  67. FUNCTION cartx# (rr AS DOUBLE, tt AS DOUBLE)
  68.     cartx# = rr * COS(tt)
  69.  
  70. FUNCTION carty# (rr AS DOUBLE, tt AS DOUBLE)
  71.     carty# = rr * SIN(tt)
  72.  
  73. SUB cpset (x1 AS DOUBLE, y1 AS DOUBLE, col AS _UNSIGNED LONG)
  74.     PSET (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2), col
  75.  
  76. SUB clineb (x1 AS DOUBLE, y1 AS DOUBLE, x2 AS DOUBLE, y2 AS DOUBLE, col AS _UNSIGNED LONG)
  77.     LINE (_WIDTH / 2 + x1, -y1 + _HEIGHT / 2)-(_WIDTH / 2 + x2, -y2 + _HEIGHT / 2), col, B

ss2.png

How to reconcile this? I know what I'm doing to do. Dismiss the artwork for what it is, there is NOTHING fundamental about the Fibonacci spiral.

</rant>
« Last Edit: November 06, 2020, 02:35:55 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

FellippeHeitor

  • Guest
Re: The Fibonacci Spiral is Bullsh*t
« Reply #1 on: November 07, 2020, 10:53:35 am »
As per my remark on Discord... it's the crooked version that always comes to mind - can we blame those Vox-style videos on youtube talking about classic art?

Thanks for sharing the real thing.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #2 on: November 07, 2020, 11:05:11 am »
When you say the real thing, you must be referring to the Golden Spiral?
https://en.wikipedia.org/wiki/Golden_spiral

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #3 on: November 07, 2020, 02:53:23 pm »
Quote
When you say the real thing, you must be referring to the Golden Spiral?

No, the so-called "real thing" is a true logarithmic spiral, but then the Fibonacci squares don't tile the plane.

The "pure artwork" is *starting* with Fibonacci tiles (which is ok), and then drawing the spiral through the corners. That "spiral" is 100% not natural.
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #4 on: November 07, 2020, 04:01:04 pm »
No, the so-called "real thing" is a true logarithmic spiral, but then the Fibonacci squares don't tile the plane.

The "pure artwork" is *starting* with Fibonacci tiles (which is ok), and then drawing the spiral through the corners. That "spiral" is 100% not natural.

No, the Golden Spiral IS logarithmic.

It is probably what you drew as this is Golden part:
Code: QB64: [Select]
  1. phi = .5 * (1 + SQR(5))
  2.  

phi - 1= 1/phi
« Last Edit: November 07, 2020, 05:01:56 pm by bplus »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #5 on: November 07, 2020, 07:24:12 pm »
Nope, you aren't paying enough attention to what I'm saying. The so-called golden spiral, aka Fibonacci spiral, is NOT a logarithmic curve.

I want to explain this to you properly. Do you know what curvature is? Yes or no.
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #6 on: November 07, 2020, 09:48:13 pm »
From link I referenced earlier:
 
Golden Spiral.PNG

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #7 on: November 07, 2020, 09:49:08 pm »
Your degree of smart-assness only makes things worse. I'll take your answer as a NO.

Anyway, in light of curvature, you can see these are way different beasts:
Untitled.png
* Untitled.png (Filesize: 8.29 KB, Dimensions: 797x464, Views: 202)
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #8 on: November 07, 2020, 09:49:54 pm »
Exactly what Wiki is saying! Did you even read the first sentence?

Fibonacci is an approx.
« Last Edit: November 07, 2020, 09:51:24 pm by bplus »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #9 on: November 07, 2020, 09:51:14 pm »
All done with this. Consider yourself led to water but I won't teach calculus for free so publicly.

EDIT: I see you edited:

Quote
Fibonacci is an approx.

Okay, you've caught up to the title of the post... :-)
« Last Edit: November 07, 2020, 09:53:11 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #10 on: November 07, 2020, 10:00:13 pm »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #11 on: November 07, 2020, 10:02:22 pm »
Ah see why you're begging boggled. It's the damn English. "Golden" versus "Fibonacci" needs a clear distiction.

That's why you need to look at the math, not the poetry. Read up on curvature and tell me if the so-called "fibonacci" spiral has a chance of showing up in nature or ordinary calculus.
« Last Edit: November 07, 2020, 10:04:24 pm by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #12 on: November 07, 2020, 10:02:35 pm »
All done with this. Consider yourself led to water but I won't teach calculus for free so publicly.

EDIT: I see you edited:

Okay, you've caught up to the title of the post... :-)

I was there in reply #2

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #13 on: November 07, 2020, 10:12:22 pm »
Ah see why you're begging boggled. It's the damn English. "Golden" versus "Fibonacci" needs a clear distiction.

That's why you need to look at the math, not the poetry. Read up on curvature and tell me if the so-called "fibonacci" spiral has a chance of showing up in nature or ordinary calculus.

If you read the wiki you will see the equation from which your can see the e

Quote
Mathematics

A Fibonacci spiral approximates the golden spiral using quarter-circle arcs inscribed in squares derived from the Fibonacci sequence.
A golden spiral with initial radius 1 is the locus of points of polar coordinates {\displaystyle (r,\theta )}(r,\theta ) satisfying

{\displaystyle r=\varphi ^{\theta {\frac {2}{\pi }}}\,}{\displaystyle r=\varphi ^{\theta {\frac {2}{\pi }}}\,}
The polar equation for a golden spiral is the same as for other logarithmic spirals, but with a special value of the growth factor b:[8]

{\displaystyle r=ae^{b\theta }\,}r = ae^{b\theta}\,  <<<<<<<<<<<<<<<<< see the e!!!!!
or

{\displaystyle \theta ={\frac {1}{b}}\ln(r/a),}\theta = \frac{1}{b} \ln(r/a),
with e being the base of natural logarithms, a being the initial radius of the spiral, and b such that when θ is a right angle (a quarter turn in either direction):

{\displaystyle e^{b\theta _{\mathrm {right} }}\,=\varphi }e^{b\theta_\mathrm{right}}\, = \varphi
Therefore, b is given by

{\displaystyle b={\ln {\varphi } \over \theta _{\mathrm {right} }}.}b = {\ln{\varphi} \over \theta_\mathrm{right}}.

The Lucas spiral approximates the golden spiral when its terms are large but not when they are small. 10 terms, from 2 to 76, are included.
The numerical value of b depends on whether the right angle is measured as 90 degrees or as {\displaystyle \textstyle {\frac {\pi }{2}}}\textstyle\frac{\pi}{2} radians; and since the angle can be in either direction, it is easiest to write the formula for the absolute value of {\displaystyle b}b (that is, b can also be the negative of this value):

{\displaystyle |b|={\ln {\varphi } \over 90}\doteq 0.0053468\,}|b|={\ln {\varphi } \over 90}\doteq 0.0053468\, for θ in degrees;
{\displaystyle |b|={\ln {\varphi } \over \pi /2}\doteq 0.3063489\,}|b|={\ln {\varphi } \over \pi /2}\doteq 0.3063489\, for θ in radians. OEIS: A212225
An alternate formula for a logarithmic and golden spiral is:[9]

{\displaystyle r=ac^{\theta }\,}r = ac^{\theta}\,
where the constant c is given by:

{\displaystyle c=e^{b}\,}c = e^b\,
which for the golden spiral gives c values of:

{\displaystyle c=\varphi ^{\frac {1}{90}}\doteq 1.0053611}c = \varphi ^ \frac{1}{90} \doteq 1.0053611
if θ is measured in degrees, and

{\displaystyle c=\varphi ^{\frac {2}{\pi }}\doteq 1.358456.}c = \varphi ^ \frac{2}{\pi} \doteq 1.358456. OEIS: A212224
if θ is measured in radians.

With respect to logarithmic spirals the golden spiral has the distinguishing property that for four collinear spiral points A, B, C, D belonging to arguments θ, θ + π, θ + 2π, θ + 3π the point C is the projective harmonic conjugate of B with respect to A, D, i.e. the cross ratio (A,D;B,C) has the singular value −1. The golden spiral is the only logarithmic spiral with (A,D;B,C) = (A,D;C,B).

[\qoute]

 
Golden Spiral Math.PNG
« Last Edit: November 07, 2020, 10:16:20 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: The Fibonacci Spiral is Bullsh*t
« Reply #14 on: November 07, 2020, 10:26:21 pm »
When you say the real thing, you must be referring to the Golden Spiral?
https://en.wikipedia.org/wiki/Golden_spiral

From reply #2 Have you caught up with me yet?

The Golden Spiral which YOU drew with phi = .5 * (1 + SQR(5)) IS a special case logarithmic spiral.