Check the version of SymPy that you are using. The development version gives
>>> var('x y')
(x, y)
>>> apart(1/(x+y)-Rational(1,2)*x**2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sympy\utilities\decorator.py", line 35, in threaded_func
return func(expr, *args, **kwargs)
File "sympy\polys\partfrac.py", line 123, in apart
return apart(fc, x=x, full=full, **_options)
File "sympy\utilities\decorator.py", line 35, in threaded_func
return func(expr, *args, **kwargs)
File "sympy\polys\partfrac.py", line 126, in apart
"multivariate partial fraction decomposition")
NotImplementedError: multivariate partial fraction decomposition
On Tuesday, March 10, 2015 at 1:07:30 PM UTC-5, Aaron Meurer wrote:
>
> It looks like a bug. If you do foo.expand() - foo.apart(xi_s).expand()
> you get a term which is definitely not equal to zero.
>
> Aaron Meurer
>
> On Tue, Mar 10, 2015 at 9:57 AM, Francesco Biscani <[email protected]
> <javascript:>> wrote:
> > Hello list,
> >
> > I feel a bit embarrassed as probably I am doing something blatantly
> wrong,
> > but I cannot understand what is going here. Consider this snippet (copy
> > pasted from an Ipython notebook):
> >
> > """
> > import sympy
> > sympy.init_printing()
> > from sympy import Symbol,sqrt,cos,sin,solve,Function,atan,apart,S
> >
> > # Some symbols
> > h,n,m,M,g,t,xi_s,eta_s = [Symbol(_) for _ in
> > ['h','n','m','M','g','t',r'\xi',r'\eta']]
> > pxi,peta = [Symbol(_) for _ in [r'p_\xi',r'p_\eta']]
> >
> > # A rational expression
> > foo =
> >
> 32*eta_s**8*g*m/(eta_s**2+xi_s**2)**3-64*eta_s**6*g*m/(eta_s**2+xi_s**2)**2-23*g/2*eta_s**2*m-7*g/2*xi_s**2*m+(320*eta_s**4*g*m**2+peta**2+pxi**2)/(8*m*(eta_s**2+xi_s**2))
>
>
> > """
> >
> > Now if I do "foo_apart(xi_s)", it seems like there are two parts of the
> > expression that disappear. (specifically,
> -23*g/2*eta_s**2*m-7*g/2*xi_s**2*m
> > is not there any more). Indeed, if I do:
> >
> > """
> > foo.apart(xi_s).expand() == foo.expand()
> > """
> >
> > This returns False.
> >
> > My brain is a bit fried at the moment :) So what am I overlooking here?
> >
> > Cheers,
> >
> > Francesco.
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups
> > "sympy" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> <javascript:>.
> > Visit this group at http://groups.google.com/group/sympy.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/sympy/CAHExjCsbts1UA_p%3DB6g-%2B6H7ny_MJomiaCjb5YgzSMAgDTs08g%40mail.gmail.com.
>
>
> > For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/e7daf358-3af7-4c36-b088-9ed11d6c67b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.