It looks like solve is calling factorint at some point. sqrt(N) will already simplify intelligently (i.e., call factorint() with the limit argument so that it isn't too slow). It looks like somewhere in polyroots it is trying to compute all the divisors of the number. We should investigate why it is doing this. I can see why that might be necessary to compute the roots of a polynomial in general, but it shouldn't be done when computing the roots of a quadratic.
Aaron Meurer On Thu, May 28, 2015 at 1:37 PM, <[email protected]> wrote: > Hi, > > I used in some experiments the following simple code. > > import time > from sympy.solvers import solve > from sympy import Symbol > x=Symbol('x') > N=2**264+2**64+1 > solve(x**2 + N , x) > > The previous code is very slow (at least in my machine, in fact I didn't > wait to see the result). I want to ask if solve() command, before it prints > the result tries to compute some factors of N, in order to simplify the > result in the square root? > N is the following number > 29642774844752946028434172162224104410437116074403984394101159952769834897375233L > which is large (but not really large). > > Thank you. > > Costas > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/1dfc4ae4-2de2-45ba-a252-051e21fff72b%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6JUvxRX4pwQZyRaUO0E0Mt9ocJwko%2BWZQV7VYxAOYs76w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
