On Sep 15, 3:44 am, Robert Bradshaw <[email protected]> wrote: > On Tue, Sep 14, 2010 at 10:44 AM, Håkan Granath > > <[email protected]> wrote: > > On Sep 14, 12:16 am, Robert Bradshaw <[email protected]> > > wrote: > > >> Alastair correctly deduced the issue that it can't tell if the number > >> is less than or greater than 2, what should it do here? > > > I do not know what it should do, but what I would have expected > > in this case is that continued_fraction would first compute the > > 53 bit approximation of the input, and then return the continued > > fraction of that approximation. > > If this is what you want, the way to get that is to give it something > that has 53 bits of precision.
I completely agree :-) In fact, that is what I tried to do but got unexpected results. Some background information: I compute some quantity a, which is a product of the result of some high precision (say 1000 bits) numerical computation and an exact algebraic factor. The number a is expected to be rational, so to identify it I do something like b = a.n(1000) v = continued_fraction(b) However this did not always work, because in some cases b was not a floating point number as expected but a symbolic expression (a bug in my opinion, see below). This, I found, can make the continued fraction computation fail in 2 ways: 1. Sometimes, since b is symbolic it is computed with the default 53 bit precision which is inadequate for my purposes. 2. Sometimes v would be the empty list. Of course I can work around this by doing something like b = a.n(1000).n(1000) but, although it works for my code, it is somewhat of a cludge. Hence I reported the two issues: the topic of this thread and the issue I found with the n() function: http://groups.google.com/group/sage-support/browse_thread/thread/b36c90f1490eac19 I hope this makes sense. Best regards, Håkan Granath -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
