[sympy] sympy + mpmath findroot

2011-05-26 Thread Matthew Emmett
Hi everyone, I am having trouble combining mpmath's findroot function with sympy. Here is a short example of what I am trying to accomplish: 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.s

Re: [sympy] sympy + mpmath findroot

2011-05-26 Thread Aaron S. Meurer
If I try this with mpmath 0.16 (the version we currently have in sympy in the latest git master), I get: In [22]: print 'subs: ', mpmath.findroot(lambda xi: p.subs(x, xi), 1.0) subs: --- ValueError

Re: [sympy] sympy + mpmath findroot

2011-05-26 Thread Matthew Emmett
Thanks for the quick reply Aaron. I will get the latest git version and run with it. BTW, I was running the sample on 0.6.7. Thanks again, Matt On Thu, May 26, 2011 at 08:28:51PM -0600, Aaron S. Meurer wrote: > If I try this with mpmath 0.16 (the version we currently have in sympy in the > lat

Re: [sympy] sympy + mpmath findroot

2011-05-26 Thread Aaron S. Meurer
Well, it still fails there with the subs. Like I said, it's a bug. Can you open an issue for it? Aaron Meurer On May 26, 2011, at 9:09 PM, Matthew Emmett wrote: > Thanks for the quick reply Aaron. I will get the latest git version > and run with it. BTW, I was running the sample on 0.6.7. >

Re: [sympy] sympy + mpmath findroot

2011-05-26 Thread Mateusz Paprocki
Hi, On 27 May 2011 06:31, Aaron S. Meurer wrote: > Well, it still fails there with the subs. Like I said, it's a bug. Can > you open an issue for it? > It's not necessarily a bug, because you expect subs() (sympy) and findroot() (mpmath) to work together, but you are skipping the glue (core/e

Re: [sympy] sympy + mpmath findroot

2011-05-27 Thread Tom Bachmann
Indeed if you do this: mpmath.findroot(lambda xi: p.subs(x, Expr._from_mpmath(xi, mpmath.mp.prec)), 1.0) [That is, you manually construct sympy objects which reflect the precision required by mpmath.] On 27.05.2011 05:57, Mateusz Paprocki wrote: Hi, On 27 May 2011 06:31, Aaron S. Meurer m

Re: [sympy] sympy + mpmath findroot

2011-05-27 Thread Tom Bachmann
I should have finished my sentence ... the way I show works. On 27.05.2011 09:28, Tom Bachmann wrote: Indeed if you do this: mpmath.findroot(lambda xi: p.subs(x, Expr._from_mpmath(xi, mpmath.mp.prec)), 1.0) [That is, you manually construct sympy objects which reflect the precision required by

Re: [sympy] sympy + mpmath findroot

2011-05-27 Thread Matthew Emmett
I opened an issue for this. As noted by Mateusz, Tom and Vinzent, there are ways around this. However, from an end users perspective, it would be nice if it worked as I had originally tried. Thanks again for the quick reply, Matt On Thu, May 26, 2011 at 10:31:02PM -0600, Aaron S. Meurer wrote: