Function Repository Resource:

IncompletePFD

Source Notebook

Give the incomplete partial fraction decomposition of a rational function

Contributed by: Daniel Lichtblau

ResourceFunction["IncompletePFD"][num,den,x]

returns the incomplete partial fraction decomposition of .

Details and Options

For a rational function of the form in the variable x, where den factors as d1e1dmem, the incomplete partial fraction decomposition is the unique way of rewriting as a sum , where den is factored into a product of powers of irreducible polynomials.
In the special case where all exponents are equal to 1, this is the same as the full partial fraction decomposition.
ResourceFunction["IncompletePFD"] takes a Modulus option that can affect the factorization.
ResourceFunction["IncompletePFD"] also supports an Extension option that gives algebraic numbers to be allowed in the factorization.

Examples

Basic Examples (1) 

Find the incomplete partial fraction decomposition for :

In[1]:=
ResourceFunction["IncompletePFD"][x, (x - 1)^2*(x - 2)^3, x]
Out[1]=

Options (2) 

Find the incomplete partial fraction decomposition for modulo 5:

In[2]:=
incMod = ResourceFunction["IncompletePFD"][x, (x - 1)^2*(x - 2)^3, x, Modulus -> 5]
Out[2]=

Check the result is equivalent to the rational function:

In[3]:=
Together[incMod - \!\(TraditionalForm\`
\*FractionBox[\(x\), \(
\*SuperscriptBox[\((x - 1)\), \(2\)] 
\*SuperscriptBox[\((x - 2)\), \(3\)]\)]\), Modulus -> 5]
Out[3]=

The rational function does not have a nontrivial decomposition over the rationals:

In[4]:=
ResourceFunction["IncompletePFD"][x, x^2 + 4, x]
Out[4]=

The denominator factors over the Gaussian integers, so providing that as an extension gives a decomposition over linear denominators:

In[5]:=
ResourceFunction["IncompletePFD"][x, x^2 + 4, x, Extension -> I]
Out[5]=

Properties and Relations (6) 

Apart is similar to IncompletePFD, but it does a full decomposition over the rationals. First define a numerator and denominator:

In[6]:=
randPoly[max_, deg_, x_] := x^deg + RandomInteger[{-max, max}, deg] . x^Range[0, deg - 1]
In[7]:=
SeedRandom[1234]
In[8]:=
den = randPoly[20, 4, x]*randPoly[20, 3, x]^2*randPoly[20, 2, x]*
  randPoly[20, 1, x]^3
Out[8]=
In[9]:=
num = randPoly[20, 5, x]^3*randPoly[20, 6, x]*randPoly[20, 7, x]*
  randPoly[20, 4, x]
Out[9]=

Compute the incomplete partial fraction decomposition:

In[10]:=
res = ResourceFunction["IncompletePFD"][num, den, x]
Out[10]=

Apart gives a mathematically equivalent result :

In[11]:=
Together[res - Apart[num/den]]
Out[11]=

For high degrees, IncompletePFD can be notably faster than Apart:

In[12]:=
SeedRandom[1234]
In[13]:=
den = randPoly[100, 8, x]^2*randPoly[100, 7, x]^3*
  randPoly[100, 6, x]^4*randPoly[100, 5, x]^4
Out[13]=
In[14]:=
num = 4*randPoly[100, 8, x]^3*randPoly[100, 7, x]*randPoly[100, 9, x]*
  randPoly[100, 8, x]
Out[14]=
In[15]:=
Timing[aaa = Apart[num/den, x];]
Out[15]=
In[16]:=
Timing[bbb = ResourceFunction["IncompletePFD"][num, den, x];]
Out[16]=

Check that the denominators are the expected factors to the correct powers:

In[17]:=
Map[Denominator, List @@ bbb]
Out[17]=

Check that the result is equivalent to the rational function num/den:

In[18]:=
Together[bbb - num/den]
Out[18]=

Possible Issues (1) 

IncompletePFD is intended for polynomials with exact coefficients and may give a result that is deficient due to numerical instability of the method when given input with approximate coefficients:

In[19]:=
SeedRandom[1234]
In[20]:=
den = randPoly[20, 4, x]*randPoly[20, 3, x]^2*randPoly[20, 2, x]*
  randPoly[20, 1, x]^3
Out[20]=
In[21]:=
num = randPoly[20, 5, x]^3*randPoly[20, 6, x]*randPoly[20, 7, x]*
  randPoly[20, 4, x]
Out[21]=
In[22]:=
ResourceFunction["IncompletePFD"][num, N@den, x]
Out[22]=

Version History

  • 1.0.0 – 16 August 2019

Related Resources

Author Notes

This function uses a divide-and-conquer approach. It could be more efficient and divide based on keeping total degrees as similar as possible to one another. The inexact coefficient case is, at best, a jury-rig. Improvements would include different functions to handle the extended GCDs and quotient/remainder uses.

License Information