 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
#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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
this works? up to what index?
"Tim Attwood" <tim### [at] comcast net> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Is there something special about this beside that it's the non-recursive
form of the fibonacci sequence?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v3 <voi### [at] dev null> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>>>> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v3 <voi### [at] dev null> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> 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.
Their appearence in Pascal's triangle might make them useful,
possibly... The rest looks mainly like theoretical uses.
I know the *ratio* of consecutive numbers approaches the golden mean -
but there are much easier ways to compute that.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v3 <voi### [at] dev null> wrote:
> I know the *ratio* of consecutive numbers approaches the golden mean -
> but there are much easier ways to compute that.
You don't need to compute that, it's (1+sqrt(5))/2 ;-)
Regards Roman
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Orchid XP v3" <voi### [at] dev null> schreef in bericht
news:44ff13a2@news.povray.org...
>
> I can't actually think of a *use* for Fibonacci numbers, come to think of
> it.
see:
news://news.povray.org/39B44A76.2ECBA98A%40online.no
Thomas
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Orchid XP v3 <voi### [at] dev null> wrote:
> I can't actually think of a *use* for Fibonacci numbers, come to think
> of it.
Someone posted this link recently, and I found it quite fascinating...
http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibnat.html#seeds
Ken W.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |