Function Repository Resource:

IntegratePFD

Source Notebook

Integrate a rational function using partial fraction decomposition

Contributed by: Sam Blake

ResourceFunction["IntegratePFD"][rat,x]

gives the indefinite integral using a partial fraction decomposition of the rational function rat prior to calling Integrate.

Details and Options

ResourceFunction["IntegratePFD"] factors the denominator of the integrand over the radicals present in the integrand and the real part of the splitting field of the denominator.
Varying the Extension option can produce alternative forms of the integral.
Symbolic integrators in computer algebra systems implement algorithms which do not require a complete factorization of the integrands denominator. In most cases this is beneficial. However, in some edge cases it is preferable to perform a partial fraction decomposition prior to calling these algorithms.

Examples

Basic Examples (1) 

Perform a partial fraction decomposition:

In[1]:=
ResourceFunction["IntegratePFD"][x^2/(x^4 + x^2 + 1), x]
Out[1]=

Scope (3) 

In this example we compute the partial fraction expansion prior to computing the integral with Integrate:

In[2]:=
ResourceFunction["IntegratePFD"][(-1 + x^2)/(1 - 2 x^2 + 2 x^4), x]
Out[2]=

IntegratePFD gives different results than Integrate:

In[3]:=
Integrate[(-4 + 4 Sqrt[3] - x^2 - Sqrt[3] x^2)/(
 144 - 80 Sqrt[3] + 24 x^2 + 9 x^4 + 5 Sqrt[3] x^4), x]
Out[3]=
In[4]:=
ResourceFunction[
 "IntegratePFD"][(-4 + 4 Sqrt[3] - x^2 - Sqrt[3] x^2)/(
 144 - 80 Sqrt[3] + 24 x^2 + 9 x^4 + 5 Sqrt[3] x^4), x]
Out[4]=

Another example:

In[5]:=
Integrate[((3 - 2 Sqrt[2] + x^2)^2 (-3 + 2 Sqrt[2] + x^2))/(
 577 - 408 Sqrt[2] + 328 x^2 - 232 Sqrt[2] x^2 + 78 x^4 - 56 Sqrt[2] x^4 + 8 x^6 - 8 Sqrt[2] x^6 + x^8), x]
Out[5]=
In[6]:=
ResourceFunction[
 "IntegratePFD"][((3 - 2 Sqrt[2] + x^2)^2 (-3 + 2 Sqrt[2] + x^2))/(
 577 - 408 Sqrt[2] + 328 x^2 - 232 Sqrt[2] x^2 + 78 x^4 - 56 Sqrt[2] x^4 + 8 x^6 - 8 Sqrt[2] x^6 + x^8), x]
Out[6]=

Options (2) 

Extension (2) 

By default this integral produced an ArcTan, as expected:

In[7]:=
ResourceFunction["IntegratePFD"][1/(x^2 + 1), x]
Out[7]=

With the following extension we factor x2+1 into (x-I)(x+I) prior to computing the partial fraction decomposition:

In[8]:=
ResourceFunction["IntegratePFD"][1/(x^2 + 1), x, Extension -> I]
Out[8]=

Applications (1) 

Compute the integral over different algebraic number fields until you find a solution which matched your homework problem:

In[9]:=
ResourceFunction["IntegratePFD"][x^3/(x^8 + 1), x, Extension -> Sqrt[-2]]
Out[9]=
In[10]:=
ResourceFunction["IntegratePFD"][x^3/(x^8 + 1), x, Extension -> Sqrt[2]]
Out[10]=
In[11]:=
ResourceFunction["IntegratePFD"][x^3/(x^8 + 1), x, Extension -> Sqrt[2 + Sqrt[2]]]
Out[11]=
In[12]:=
ResourceFunction["IntegratePFD"][x^3/(x^8 + 1), x, Extension -> Sqrt[2 - Sqrt[2]]]
Out[12]=

Properties and Relations (2) 

Integrate and IntegratePFD will both return valid antiderivatives, however the results will often look vastly different:

In[13]:=
ResourceFunction["IntegratePFD"][(2 x + x^2)/(2 + 4 x + 2 x^2 + x^4),
  x]
Out[13]=
In[14]:=
Integrate[(2 x + x^2)/(2 + 4 x + 2 x^2 + x^4), x]
Out[14]=

The two results are equivalent:

In[15]:=
D[% - %%, x] // FullSimplify
Out[15]=

Possible Issues (1) 

Sometimes Integrate will give a more concise answer than IntegratePFD:

In[16]:=
Integrate[x^2/(x^6 + 1), x]
Out[16]=
In[17]:=
ResourceFunction["IntegratePFD"][x^2/(x^6 + 1), x]
Out[17]=

Neat Examples (1) 

IntegratePFD may be used to generate many alternative forms of an integral by factoring the denominator over different algebraic number fields:

In[18]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> Sqrt[2]]
Out[18]=
In[19]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> Sqrt[-2]]
Out[19]=
In[20]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> I]
Out[20]=
In[21]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> Sqrt[2 - Sqrt[2]]]
Out[21]=
In[22]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> Sqrt[2 + Sqrt[2]]]
Out[22]=
In[23]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> Sqrt[-2 + Sqrt[2]]]
Out[23]=
In[24]:=
ResourceFunction["IntegratePFD"][x/(x^8 + 1), x, Extension -> {Sqrt[2 - Sqrt[2]], Sqrt[2 + Sqrt[2]]}]
Out[24]=

Publisher

Sam Blake

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.0 – 17 November 2023

License Information