[gambit-list] Golden Section and Gambit Scheme

Steve Graham jsgrahamus at yahoo.com
Thu Oct 27 20:13:00 EDT 2011


That is simply amazing.  Thanks, Marc.  Steve


________________________________
From: Marc Feeley <feeley at iro.umontreal.ca>
To: Steve Graham <jsgrahamus at yahoo.com>
Cc: Gambit List <Gambit-list at iro.umontreal.ca>
Sent: Thursday, October 27, 2011 6:09 PM
Subject: Re: [gambit-list] Golden Section and Gambit Scheme


On 2011-10-27, at 10:48 AM, Steve Graham wrote:

> Thanks for the memory nudge, Marc.  I think the author mentioned such, too.  Steve
> 
> From: Marc Feeley <feeley at iro.umontreal.ca>
> To: Steve Graham <jsgrahamus at yahoo.com>
> Cc: Gambit List <Gambit-list at iro.umontreal.ca>
> Sent: Thursday, October 27, 2011 11:16 AM
> Subject: Re: [gambit-list] Golden Section and Gambit Scheme
> 
> 
> On 2011-10-27, at 9:46 AM, Steve Graham wrote:
> 
> > So here are the solutions and code:
> > 
> > Gambit v4.6.1
> > >  (/ (+ -1 (expt 5 .5)) 2)
> > .6180339887498949
> > >  (/ (- -1 (expt 5 .5)) 2)
> > -1.618033988749895
> > >  
> > The main solution for A is .6180339887498949, and because B = 1, then C = 1.6180339887498949
> > 
> > Many thanks to Scott Olsen author of The Golden Secret, Marc Feeley (main author of Gambit Scheme), Keith Flower (for porting of Gambit to the Android OS), Google (for helping me to remember/find the solution to a quadratic equation and providing picture-capable Gmail), Microsoft (for making Word handle equations) and my math teachers for a stroll down memory lane and a most interesting adventure for today.
> > 
> > Steve
> > 
> 
> No problem!
> 
> By the way, one of the nice properties of the fibonacci sequence is its relation to the golden ratio (the limit n->oo of fib(n)/fib(n-1) is the golden ratio, or its inverse, I can never remember).  Here is a demonstration which you can try on your iPhone:
> 
> > (define (fib n)
>     (let loop ((i n) (a 1) (b 1))
>       (if (= i 0) a (loop (- i 1) b (+ a b)))))
> > (fib 20)
> 10946
> > (exact->inexact (/ (fib 1000) (fib 999)))
> 1.618033988749895
> > (exact->inexact (/ (fib 999) (fib 1000)))
> .6180339887498949
> > (fib 1000)
> 70330367711422815821835254877183549770181269836358732742604905087154537118196933579742249494562611733487750449241765991088186363265450223647106012053374121273867339111198139373125598767690091902245245323403501
> 
> Marc

The neat thing is that with Scheme you are not limited to the precision of floating point numbers.  For example, here is how to compute the 400 first decimals of the golden ratio:

> (round (* (expt 10 400) (/ (fib 1000) (fib 999))))
16180339887498948482045868343656381177203091798057628621354486227052604628189024497072072041893911374847540880753868917521266338622235369317931800607667263544333890865959395829056383226613199282902678806752087668925017116962070322210432162695486262963136144381497587012203408058879544547492461856953648644492410443207713449470495658467885098743394422125448770664780915884607499887124007652170575179788

Marc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20111027/3ad5dec9/attachment.htm>


More information about the Gambit-list mailing list