Status: Accepted
Owner: ----
Labels: Type-Defect Priority-Medium Series
New issue 3135 by someb...@bluewin.ch: Multiple series expansions
http://code.google.com/p/sympy/issues/detail?id=3135
Multiple series expansions in a row wrt different variables do not work.
Let me show a simple example:
In [10]: exp(x+y)
Out[10]: exp(x + y)
In [11]: x = Symbol("x")
In [12]: y = Symbol("y")
In [13]: f = exp(x+y)
In [14]: s1 = series(f, x=x)
In [15]: s1
Out[15]: exp(y) + x*exp(y) + x**2*exp(y)/2 + x**3*exp(y)/6 + x**4*exp(y)/24
+ x**5*exp(y)/120 + O(x**6)
In [16]: s2 = series(s1, x=y)
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/home/raoul/<ipython-input-16-0609ac8eae19> in <module>()
----> 1 s2 = series(s1, x=y)
/home/raoul/python/sympy/series/series.pyc in series(expr, x, x0, n, dir)
6 """
7 expr = sympify(expr)
----> 8 return expr.series(x, x0, n, dir)
/home/raoul/python/sympy/core/expr.pyc in series(self, x, x0, n, dir)
2201 if o:
2202 # make sure the requested order is returned
-> 2203 ngot = o.getn()
2204 if ngot > n:
2205 # leave o in its current form (e.g. with
x*log(x)) so
/home/raoul/python/sympy/core/expr.pyc in getn(self)
771 return abs(oi.exp)
772
--> 773 raise NotImplementedError('not sure of order of %s' % o)
774
775 def count_ops(self, visual=None):
NotImplementedError: not sure of order of O(y**6) + O(x**6)
Only after manual removal of the O I can proceed:
In [17]: t = s1.removeO()
In [18]: t
Out[18]: x**5*exp(y)/120 + x**4*exp(y)/24 + x**3*exp(y)/6 + x**2*exp(y)/2 +
x*exp(y) + exp(y)
In [19]: series(t, x=y)
Out[19]: 1 + y*(x**5/120 + x**4/24 + x**3/6 + x**2/2 + x + 1) +
y**2*(x**5/240 + x**4/48 + x**3/12 + x**2/4 + x/2 + 1/2) + y**3*(x**5/720 +
x**4/144 + x**3/36 + x**2/12 + x/6 + 1/6) + y**4*(x**5/2880 + x**4/576 +
x**3/144 + x**2/48 + x/24 + 1/24) + y**5*(x**5/14400 + x**4/2880 + x**3/720
+ x**2/240 + x/120 + 1/120) + x + x**2/2 + x**3/6 + x**4/24 + x**5/120 +
O(y**6)
In [20]: expand(_)
Out[20]: 1 + y + y**2/2 + y**3/6 + y**4/24 + y**5/120 + x + x*y + x*y**2/2
+ x*y**3/6 + x*y**4/24 + x*y**5/120 + x**2/2 + x**2*y/2 + x**2*y**2/4 +
x**2*y**3/12 + x**2*y**4/48 + x**2*y**5/240 + x**3/6 + x**3*y/6 +
x**3*y**2/12 + x**3*y**3/36 + x**3*y**4/144 + x**3*y**5/720 + x**4/24 +
x**4*y/24 + x**4*y**2/48 + x**4*y**3/144 + x**4*y**4/576 + x**4*y**5/2880 +
x**5/120 + x**5*y/120 + x**5*y**2/240 + x**5*y**3/720 + x**5*y**4/2880 +
x**5*y**5/14400 + O(y**6)
But the order is now wrong.
--
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.