3 Dec
2006
3 Dec
'06
2:37 p.m.
Caro Francesco, On Sun, 3 Dec 2006, Francesco Biscani wrote:
Example:
x^2*y+x^2*y^2+x^3*z
If the truncation threshold is set to order 4 this polynomial gets truncated to
x^2*y
If the polynomial is not too large and stored in the variable f, I would do it using f = f.subs(lst(x==epsilon*x, y==epsilon*y, z==epsilon*z)); f = series_to_poly(f.series(epsilon, 4)).expand(); f = f.subs(epsilon==1); If the polynomial is too large, you could use this same method term-by-term or (probably the fastest) use a tree-traversal algorithm and map functions. Saluti, Chris