Hi, I hope that I am not misleading you. Hopefully the developers will correct me if I'm wrong.
evalf uses the mpmath library for doing multiprecision math. It can not overflow under normal conditions. On the other hand lambdify will exchange by default all sympy functions with numpy equivalents. Those can overflow. Try adding "mpmath" as a third argument to lambdify. That way it will use mpmath instead of numpy. It will be slower than numpy, but it will not overflow. Check the docstring for details. Stefan On 9 January 2012 10:46, Olivier Grisel <[email protected]> wrote: > Hi all, > > I use sympy.solve to find the roots of a degree 3 polynomial and then > would like to convert the solution as a numpy expression. However lambdify > does cannot compute a numerically stable evaluation (whereas evalf has no > issue). > > Here is a gist giving the details and a small reproduction script along > with the observed output. > > https://gist.github.com/1582089 > > Any hint? > > -- > Olivier > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sympy/-/Kg9vhQMHIZQJ. > 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/sympy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sympy" group. 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/sympy?hl=en.
