Karim BELABAS on Tue, 8 Oct 2002 17:56:47 +0200 (MEST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: precision and contfrac() |
On Tue, 8 Oct 2002, Bill Allombert wrote: > On Tue, Oct 08, 2002 at 02:43:50PM +0200, Thomas Baruchel wrote: > > Brest, le mardi 8 octobre > > > > Hi, I wonder how I should set the precision \p in order to > > have n exact terms in the continued fraction expansion of > > sqrt(x) (x being exact). > > It is a difficult question. The precision exhausted depend on the size of the > partial quotients, which are very hard to control. > > > > > For instance, what precision is needed in order to be sure that I > > have 500 exact terms ? 2,000 ? 10,000 ? Just to clarify a point: all terms given are exact. If you do not get enough terms, restart the computation with higher precision [ it is easy to automate this: double precision until you're happy. It is tough to guestimate the required precision for general numbers. ] Also keep in mind the continued fraction is normalized so that the last partial quotient is never 1. So if the continued fraction you would obtain is [..., n, 1], it is given as [..., n+1]. Cheers, Karim. -- Karim Belabas Tel: (+33) (0)1 69 15 57 48 Dép. de Mathematiques, Bat. 425 Fax: (+33) (0)1 69 15 60 19 Université Paris-Sud Email: Karim.Belabas@math.u-psud.fr F-91405 Orsay (France) http://www.math.u-psud.fr/~belabas/ -- PARI/GP Home Page: http://www.parigp-home.de/