POV-Ray : Newsgroups : povray.advanced-users : Fibonacci Server Time
31 Oct 2024 10:21:17 EDT (-0400)
  Fibonacci (Message 1 to 10 of 14)  
Goto Latest 10 Messages Next 4 Messages >>>
From: Tim Attwood
Subject: Fibonacci
Date: 4 Sep 2006 01:26:24
Message: <44fbb900$1@news.povray.org>
#macro Fibonacci(A)
   #local M = (pow(1.618033989,A)-pow(0.618033989,A))/2.236067977;
   #local R = int(M) + select( (mod(M,1) >= 0.01),1,0,1);
   (R)
#end


Post a reply to this message

From: JWV
Subject: Re: Fibonacci
Date: 4 Sep 2006 16:39:25
Message: <44fc8efd@news.povray.org>
this works? up to what index?


"Tim Attwood" <tim### [at] comcastnet> wrote in message
news:44fbb900$1@news.povray.org...
> #macro Fibonacci(A)
>    #local M = (pow(1.618033989,A)-pow(0.618033989,A))/2.236067977;
>    #local R = int(M) + select( (mod(M,1) >= 0.01),1,0,1);
>    (R)
> #end
>
>


Post a reply to this message

From: Orchid XP v3
Subject: Re: Fibonacci
Date: 4 Sep 2006 16:57:41
Message: <44fc9345$1@news.povray.org>
> this works? up to what index?

Up to *any* index, assuming there's no floating point rounding errors.

A quick trip to Wikipedia will probably demonstrate why - if not, 
Wolfram's MathWorld will have the derrivation.


Post a reply to this message

From: Tim Attwood
Subject: Re: Fibonacci
Date: 4 Sep 2006 22:20:33
Message: <44fcdef1$1@news.povray.org>
>> this works? up to what index?
Up to 34 or so in windows.
BTW I must have looked at too many of those
WTF coding examples...
#local R = int(M+0.56);


Post a reply to this message

From: Orchid XP v3
Subject: Re: Fibonacci
Date: 5 Sep 2006 14:06:59
Message: <44fdbcc3$1@news.povray.org>
>>> this works? up to what index?
> Up to 34 or so in windows.

And in O(1) time instead of O(n)...

> BTW I must have looked at too many of those
> WTF coding examples...
> #local R = int(M+0.56); 

;-)


Post a reply to this message

From: Roman Reiner
Subject: Re: Fibonacci
Date: 5 Sep 2006 18:30:01
Message: <web.44fdfa2441db231d3ad774e20@news.povray.org>
Is there something special about this beside that it's the non-recursive
form of the fibonacci sequence?


Post a reply to this message

From: Warp
Subject: Re: Fibonacci
Date: 5 Sep 2006 20:15:40
Message: <44fe132c@news.povray.org>
Orchid XP v3 <voi### [at] devnull> wrote:
> >>> this works? up to what index?
> > Up to 34 or so in windows.

> And in O(1) time instead of O(n)...

  Up to index 34 you could just make a table which you index with the
number and that would also be O(1), and probably with a faster factor.

-- 
                                                          - Warp


Post a reply to this message

From: Tim Attwood
Subject: Re: Fibonacci
Date: 6 Sep 2006 03:52:21
Message: <44fe7e35$1@news.povray.org>
> Is there something special about this beside that it's the non-recursive
> form of the fibonacci sequence?

No not really.


Post a reply to this message

From: Orchid XP v3
Subject: Re: Fibonacci
Date: 6 Sep 2006 14:29:54
Message: <44ff13a2@news.povray.org>
>>>>> this works? up to what index?
>>> Up to 34 or so in windows.
> 
>> And in O(1) time instead of O(n)...
> 
>   Up to index 34 you could just make a table which you index with the
> number and that would also be O(1), and probably with a faster factor.

That's also true...


I can't actually think of a *use* for Fibonacci numbers, come to think 
of it.


Post a reply to this message

From: Warp
Subject: Re: Fibonacci
Date: 6 Sep 2006 15:56:54
Message: <44ff2806@news.povray.org>
Orchid XP v3 <voi### [at] devnull> wrote:
> I can't actually think of a *use* for Fibonacci numbers, come to think 
> of it.

http://en.wikipedia.org/wiki/Fibonacci_number#Applications

  One thing where I know it is also used is in predicting currency
market fluctuations.

-- 
                                                          - Warp


Post a reply to this message

Goto Latest 10 Messages Next 4 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.