Re: Partial fraction expansion
- To: mathgroup at smc.vnet.net
- Subject: [mg30288] Re: [mg30271] Partial fraction expansion
- From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
- Date: Sun, 5 Aug 2001 16:18:33 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I assume that your question concerns Mathematica, doesn' t it?
Actually, this issue of "partial fractions" is a bit confusing because
different people mean different things by "partial fractions". The
ambiguity concerns the coefficient field. Basically, Mathematica's Apart
function will expand rational functions into partial fractions using
only rational coefficients. So in the case f= 1/(1+x^4) you can get the
following three results:
In[1]:=
Apart[1/(1 + x^4)]
Out[1]=
1/(1 + x^4)
In[2]:=
Apart[1/Factor[1 + x^4, GaussianIntegers -> True]]
Out[2]=
-(I/(2*(-I + x^2))) + I/(2*(I + x^2))
In[3]:=
Apart[1/Factor[1 + x^4, Extension -> Sqrt[2]]]
Out[3]=
-(1/(2*(-1 + Sqrt[2]*x - x^2)*(1 + x^2))) + 1/(2*(1 + x^2)*(1 +
Sqrt[2]*x + x^2))
The first is the "partial fractions" expansion over the rationals, the
second over the complex numbers and the third over the reals. The
following function will perform partial fraction expansions over the
complex numbers, which is what I assume you wanted:
In[4]:=
partialFractionsC[f_, x_] := Module[{h = Simplify[f], n, d}, n =
Numerator[h]; d = Denominator[h];
Apart[n/Factor[d, Extension -> (x /. Solve[d == 0, x])]]]
The easiest way to write a function which will expand rational
expressions over the reals is to make use of the built in ability to do
this in Integrate:
partialFractionsR[f_, x_] := D[Integrate[Simplify[f], x], x]
Now let's look at a couple of cases:
In[6]:=
f = (1 - x)/(1 + x^3);
In[7]:=
Apart[f]
Out[7]=
2/(3*(1 + x)) + (1 - 2*x)/(3*(1 - x + x^2))
In[8]:=
partialFractionsC[f, x]
Out[8]=
-(2/((-2 + (-1)^(1/3))*(1 + (-1)^(1/3))*(1 + x))) +
(1 - (-1)^(1/3))/((1 + (-1)^(1/3))*(-1 + 2*(-1)^(1/3))*(-(-1)^(1/3) +
x)) +
(-1)^(1/3)/((-2 + (-1)^(1/3))*(-1 + 2*(-1)^(1/3))*(-1 + (-1)^(1/3) +
x))
In[9]:=
partialFractionsR[f, x]
Out[9]=
2/(3*(1 + x)) - (-1 + 2*x)/(3*(1 - x + x^2))
In this case there is no difference between Apart and partialFractionsR
but in the next one there is:
In[10]:=
g = (1 - x)/(1 + x^4);
In[11]:=
Apart[g, x]
Out[11]=
(1 - x)/(1 + x^4)
In[12]:=
partialFractionsC[g, x]
Out[12]=
-(I/(2*(1 + (-1)^(1/4))*((-1)^(1/4) + (-1)^(3/4))*(-(-1)^(1/4) + x))) -
((1/4 - I/4)*(-1)^(1/4))/((-1 + (-1)^(1/4))*((-1)^(1/4) + x)) -
((1/4 - I/4)*(-1)^(3/4)*(1 + I + (-1)^(1/4)))/((1 + (-1)^(1/4))*(-
(-1)^(3/4) + x)) -
((1/4 - I/4)*(-1)^(3/4)*(1 + I - (-1)^(1/4)))/((-1 + (-1)^(1/4))*
((-1)^(3/4) + x))
In[13]:=
partialFractionsR[g, x]
Out[13]=
-((Sqrt[2] - 2*x)/(4*Sqrt[2]*(-1 + Sqrt[2]*x - x^2))) +
(Sqrt[2] + 2*x)/(4*Sqrt[2]*(1 + Sqrt[2]*x + x^2)) +
(-2 + Sqrt[2])/(2*Sqrt[2]*(1 + (1/2)*(-Sqrt[2] + 2*x)^2)) +
(2 + Sqrt[2])/(2*Sqrt[2]*(1 + (1/2)*(Sqrt[2] + 2*x)^2))
Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/
On Sunday, August 5, 2001, at 09:02 AM, Lee Lin Yap wrote:
> Hi,
>
> I'm currently doing a software programming for my final year project. I
> need
> to solve a partial fraction expansion in my program. I have a numerator
> and
> I got the roots for it. But I can't solve the problem to get the answer
> that
> I need.
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at
> http://explorer.msn.com/intl.asp
>
>
>