What does the second argument in apart() do?

31 views
Skip to first unread message

Hugh

unread,
Jun 15, 2015, 1:14:40 PM6/15/15
to sy...@googlegroups.com
Hello,


There is this block of code in the tutorial:

>>> l = []
>>> frac = apart(frac, a0)
>>> frac
                a₂⋅a₃⋅a + a + a
a + ───────────────────────────────────────
     a₁⋅a₂⋅a₃⋅a + a₁⋅a + a₁⋅a + a₃⋅a + 1
>>> l.append(a0)
>>> frac = 1/(frac - a0)
>>> frac
a₁⋅a₂⋅a₃⋅a + a₁⋅a + a₁⋅a + a₃⋅a + 1
───────────────────────────────────────
           a₂⋅a₃⋅a + a + a


I've read the documentation on apart() and factor() but I still don't understand the purpose of putting a0 as the second argument to the call to apart(). Also, leaving out a0 produces a NotImplementedError: multivariate partial fraction decomposition error. and replacing a0 with other symbols like a1, a2, etc works fine. But I still don't understand what's going on. Please help.

Sartaj Singh

unread,
Jun 15, 2015, 1:25:57 PM6/15/15
to sy...@googlegroups.com
Here, frac is multivariate, i.e it depends on more than one variable. So, you need to explicitly tell the apart function for which variable should it perform the decomposition.

Eg. No need to give x as the second argument

In [21]: apart(1/((x+1)*(x+2)))
Out[21]:
   
1       1  
- ───── + ─────
  x
+ 2   x + 1

x is required here (multivariate)

In [22]: apart(y/((x+1)*(x+2)), x)
Out[22]:
    y       y  
- ───── + ─────
  x
+ 2   x + 1

Hugh

unread,
Jun 26, 2015, 9:18:55 AM6/26/15
to sy...@googlegroups.com
Thanks Sartaj for the clarification.
Reply all
Reply to author
Forward
0 new messages