A variation of this, which would be useful in some elliptic curve calculations, would be a function RR(x).nearby_rational_whose_denominator_is_a_perfect_square().
For either problem, is there a better solution than going through the continued fraction convergents until one is found which has the required property? I hope so, since as I wrote that I could see that this would certainly fail on most inputs.... John On 31/01/2008, Georg <[EMAIL PROTECTED]> wrote: > > Hi, > there is a method > RR(x).nearby_rational(...) > which returns a rational number .... > it would be convenient for me to have a method which returns a > rational number which has also a rational square root, something like > RR(x).nearby_rational_perfect_square(...) > , I'm not asking for a workaround, at least not for the most obvious > one (taking the square root of x and using .nearby_rational with > adjusted tolerance...), > may this method could be useful for others, too .... > Thanks, Georg > > > > > -- John Cremona --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---