On 09/07/13 16:30, Mateusz Paprocki wrote:
> What version of SymPy do you use? I can't exactly reproduce your
> results, thought Poly.evalf() is wrong. Here are results for the master
> branch (as of e06036a2daae4c2f6fc36e443a7516c6d7247df5):

This was on 0.7.2.

> In this https://github.com/sympy/sympy/pull/2126 pull request
> dPn2.evalf() was "fixed" and now gives (almost) the same result as
> dPn2.evalf():
> 
> In [1]: import sympy.mpmath as mp
> 
> In [2]: dPn1 = legendre_poly(4, x).diff()
> 
> In [3]: dPn2 = Poly(legendre_poly(4, x)).diff()
> 
> In [4]: dPn1.evalf(30, {x: mp.sqrt(2)})
> Out[4]: 38.8908729652601232676574205324
> 
> In [5]: dPn2.evalf(30, {x: mp.sqrt(2)})
> Out[5]: 38.8908729652601232676574205926
> 
> In [6]: dPn1.subs(x, sqrt(2)).evalf(30)
> Out[6]: 38.8908729652601138420464399158
> 
> In [7]: dPn2.subs(x, sqrt(2)).evalf(30)
> Out[7]: 38.8908729652601138420464399158

I believe that the reasons the top two results are different is because
mp.sqrt(2) is only being evaluated to 16 DPS.  I am not currently in a
position to try the current master branch but I'd be interested to see
if setting:

mp.dps = 30

changes the results in the above snippet.  Ideally they'll all come out
to 38.8908729652601138420464399158.

It is great to see that the issue appears to has been worked on, though!
 Great work.

Polemically yours, Freddie.


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to