|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
#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] 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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] 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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> 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] 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
|
|
| |
| |
|
|
|
|
| |