OK, so how do I reconcile

   9!:11 (15)

   fibfirst i.5
44721359549.9957 72360679774.999 11708203932.4997 18944271909.9999 
30652475842.5001

with
   the above formula produces the first few digits of the
   kth fibonacci number.

Bill's comment about the "phi formula" working for k up to 76 applies
to computing the Fibonacci numbers to full precision, all the digits.
f(77) is larger than the largest integer that can be represented 
exactly with 64 bit IEEE floating point numbers.  Since fibfirst
uses 64 bit IEEE floating point numbers, it does no good to
use 80 digits of phi, because only the first 18 or so digits 
are relevant.



----- Original Message ----- 
From: "p j" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, February 21, 2006 5:59 AM
Subject: [Jprogramming] re: Numeric precision bug?

Bill,
thanks I guess... using phi seems to get the "right"
answers for first few digits of k up to 100000 not 76,
but I can see how that would explain it breaking for
high k.  Using phi of 80 digits or so (first row from 
page below), made my formula accurate enough to get
right numbers for k>300000
 
http://www.worldwideschool.org/library/books/sci/math/MiscellaneousMathematicalConstants/chap46.html

Roger,

It was easy to miss but the results produce useful
notation after you set the global print precision to

9!:11 (15)

>>
I can not relate your statement

   the above formula produces the first few digits of
the
   kth fibonacci number.

with the following result:

   fibfirst i.4 5
4.47214e10 7.23607e10 1.17082e10 1.89443e10 3.06525e10

----


fibfirst=: 3 : 0
p=. 1.61803398874991595753 NB. -: >: ( %: 5)
a =. ((y.) * (10^. p)) - 10^.2.2360679774997898  
a =. 10 + a - (<. a) 
10^a
)

the above formula produces the first few digits of the
kth fibonacci number.

the following list are offsets from 300000 that
produce fibonacci numbers with digits 1-9 pandigital. 
(302079, 303585 etc...)
2079 3585 4120 4651 5079 9027 12850 16912 22309 22658
22723 24531 32770 33578 33851 34494 35588 36987 38128
41512 43091 43387 51186 57068 57512 59737 59766 70611
71824 83432 95911 97945

according to this site,
http://www.mcs.surrey.ac.uk/Personal/R.Knott/Fibonacci/fibFormula.html#LOG

Most of these numbers are actually not pandigital.
My formula is higher by 1-4 on the first 9 digits.  Is
this because I have chosen different precision for
phi?
If so, this would be weird because my phi number (p)
is smaller than the rounding choices at that web site
(so I would expect my numbers would be smaller).

Is there some internal rounding in J that could create
the discrepency?






__________________________________________________________ 
Find your next car at http://autos.yahoo.ca
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to