Re: [Edu-sig] Fibonacci Numbers and Phi (again)
Kirby, You are right, a little program does help to clarify the statement and the formulas involved. But then, keep it really simple (no classes, no generators), so that understanding of the code doesn't get in the way. For example: from math import sqrt rt5 = sqrt(5) phi = (1 + rt5)/2 def neat_formula(f0, f1, f2): return (f0 + f2 + rt5*f1)/2 power_of_phi = phi**(-6) f0, f1, f2 = 13, -8, 5 for k in range(20): print("{0:8.5f} {1:8.5f}".format(power_of_phi, neat_formula(f0, f1, f2))) f0, f1, f2 = f1, f2, f1+f2 power_of_phi *= phi There are many other occasions to bring in more advanced tools. Gary Litvin www.skylit.com At 11:08 AM 11/23/2013, kirby urner wrote:
On Fri, Nov 22, 2013 at 9:49 PM, Litvin <<mailto:litvin@skylit.com>litvin@skylit.com> wrote:
Kirby,
I am sorry to spoil all the fun, but this is a not a gem but a mathematical trick, and I think the way to deal with mathematical tricks is to explain them, not to verify with code.
Having an algebraic verification is more like the proof I did not provide. Thanks for the reasoning Gary.
I do think there's a two phase understanding for theorems where phase one is too oft neglected, which is understanding what the theorem is claiming or asserting, before attempting an analysis of "why?".
Euler's Theorem by way of example, the one with the totient, a generalization of Fermat's: it's too easy to just stare at the assertion and not think of examples, not know what it says.
This is where I think a Python program may come in handy, not as a proof of a theorem but as a illustration or demonstration of its consequences. See the theorem in action somehow.
Seeing something in Python that's runnable may close some critical circuits in the brain of the theorem's reader. "Now I better know what it means" may be the aha experience.
Most people who have read up on Fibonaccis know they can be extended in the negative direction. Then the idea of starting with any two numbers, not necessarily integers may be introduced.
The limit of F[N+1]/F[N] and its relationship to PHI (equal as N -> infinity) may then be discussed.
I've taken exactly this same approach with one of Ramanujan's for 1/pi (just flip it for pi). A little Python generator will do the trick. In this case the gem being verified has not to my knowledge been fully explained or reasoned about (the proof has yet to be supplied):
(this blogpost uses MathJax, a good resource for the JavaScript-enabled)
I'm still without an explanation for this pi digits generator from one of Michel Paul's students, but I share it around in hopes of finding one -- and then I hope its one I can follow.
Thanks again for clearing up any mysteries that may have attached to the PHI ** N formula (I originally called it a formula, not a gem... some gems are only semi-precious).
Kirby
Yes, I would consider that an improvement, though I might go back to a generator with: from math import sqrt rt5 = sqrt(5) phi = (1 + rt5)/2 def neat_formula(f0, f1, f2): while True: yield (f0 + f2 + rt5*f1)/2 f0, f1, f2 = f1, f2, f1+f2 power_of_phi = phi**(-6) results = neat_formula(13, -8, 5) # seed me for k in range(20): print("{0:8.5f} {1:8.5f}".format(power_of_phi, next(results))) power_of_phi *= phi Going back and forth between yours and mine is introducing a small delta, so if the game were to introduce generators as a genre, I could see doing a bunch of small deltas like this. Kirby On Sat, Nov 23, 2013 at 10:54 AM, Litvin <litvin@skylit.com> wrote:
Kirby,
You are right, a little program does help to clarify the statement and the formulas involved. But then, keep it really simple (no classes, no generators), so that understanding of the code doesn't get in the way. For example:
from math import sqrt
rt5 = sqrt(5) phi = (1 + rt5)/2
def neat_formula(f0, f1, f2): return (f0 + f2 + rt5*f1)/2
power_of_phi = phi**(-6) f0, f1, f2 = 13, -8, 5 for k in range(20): print("{0:8.5f} {1:8.5f}".format(power_of_phi, neat_formula(f0, f1, f2))) f0, f1, f2 = f1, f2, f1+f2 power_of_phi *= phi
There are many other occasions to bring in more advanced tools.
Gary Litvin www.skylit.com
participants (2)
-
kirby urner
-
Litvin