> The most recent branch is p12. The pull request:
>
> https://github.com/sympy/sympy/pull/120
>
> The branch:
>
> https://github.com/smichr/sympy/tree/p12
>
> Vinzent
Thank you.
I realized just now that sympy and rmpoly seem to go together well;
in rmpoly one must specify the factory of the ring or free algebra;
it seems one can use sympify as factory, at least the following
example gives
a correct answer
>>> from rmpoly import *
>>> from sympy import *
>>> rp, x = mrgens('x',8,sympify)
>>> h=10;p=(x*sqrt(2) + x**2*sqrt(3)).cos('x',h).pow_trunc(-1,'x',h);p
+(2*2**(1/2)*(-17*3**(1/2)/144 + 47*2*3**(1/2)/240) + 3309*6**(1/2)/
280)*x^9 +(2227/126)*x^8 +(68*6**(1/2)/15)*x^7 +(368/45)*x^6
+(5*6**(1/2)/3)*x^5 +(7/3)*x^4 +(6**(1/2))*x^3 +(1)*x^2 +(1)
although it does not simplify the coefficient of x**9 to
779/63*sqrt(6)
The speed is not so bad
>>> from time import time
>>> h=100
>>> t0=time();p=(x*sqrt(2)).cos('x',h).pow_trunc(-1,'x',h);'%.2f'%(time()-t0)
'1.29'
Does sympy use gmpy mpq to implement rationals? if it does but not by
default,
the above timing would improved choosing the mpq backend.
In fact, if sympy uses Fraction by default as backend for rationals, I
must correct
the comparison between rmpoly and sympy:
it is 47x slower, not 3 orders of magnitude as claimed before.
If so, I apologize for the mistake; I am not much familiar with sympy.
>>> from rmpoly import *
>>> from fractions import Fraction
>>> rp,x = rgens('x',10,Fraction)
>>> h=100
>>> from time import time
>>> t0=time();p = x.cos('x',h).pow_trunc(-1,'x',h); '%.2f'%(time()-t0)
'1.04'
>>> from sympy import *
>>> from time import time
>>> x = Symbol('x')
>>> t0=time();p = series(1/cos(x),x,0,100); '%.2f'%(time()-t0)
'48.97'
Mario
--
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.