Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 2437 by memm...@gmail.com: poly.subs doesn't work well with mpmath findroot
http://code.google.com/p/sympy/issues/detail?id=2437

Defining a symbolic polynomial and using this within mpmath's findroot function doesn't work as expected.


import sympy
import mpmath

mpmath.mp.dps = 45

x = sympy.var('x')
p = (5.0/2.0*x**3 - 3.0/2.0*x).as_poly()

print 'subs:  ', mpmath.findroot(lambda xi: p.subs(x, xi), 1.0)
print 'lambda:', mpmath.findroot(lambda x: 5.0*x**3/2.0 - 3.0*x/2.0, 1.0)
print 'exact: ', mpmath.sqrt(mpmath.mpf('3.0')/mpmath.mpf('5.0'))


The output is:

subs:   0.77459666924148342341315597798728447146706553
lambda: 0.774596669241483377035853079956479922166584341
exact:  0.774596669241483377035853079956479922166584341

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to