using CalculusWithJulia
using SymPy
40 Partial Fractions
Integration is facilitated when an antiderivative for
However, despite differentiation being an algorithmic procedure, integration is not. There are “tricks” to try, such as substitution and integration by parts. These work in some cases. However, there are classes of functions for which algorithms exist. For example, the SymPy
integrate
function mostly implements an algorithm that decides if an elementary function has an antiderivative. The elementary functions include exponentials, their inverses (logarithms), trigonometric functions, their inverses, and powers, including
There are classes of functions where an (elementary) antiderivative can always be found. Polynomials provide a case. More surprisingly, so do their ratios, rational functions.
40.1 Partial fraction decomposition
Let
The function
The method is attributed to John Bernoulli, one of the prolific Bernoulli brothers who put a stamp on several areas of math. This Bernoulli was a mentor to Euler.
This basically says that each factor
where each
The value of this decomposition is that the terms
Many calculus texts will give some examples for finding a partial fraction decomposition. We push that work off to SymPy
, as for all but the easiest cases - a few are in the problems - it can be a bit tedious.
In SymPy
, the apart
function will find the partial fraction decomposition when a factorization is available. For example, here we see
@syms a::real b::real c::real A::real B::real x::real
(a, b, c, A, B, x)
apart((x-2)*(x-3) / (x*(x-1)^2*(x^2 + 2)^3))
40.1.1 Sketch of proof
A standard proof uses two facts of number systems: the division algorithm and a representation of the greatest common divisor in terms of sums, extended to polynomials. Our sketch shows how these are used.
Take one of the factors of the denominators, and consider this representation of the rational function
Since
Then dividing by
So we get by multiplying the
This may look more complicated, but what it does is peel off one term (The first) and leave something which is smaller, in this case by a factor of
What remains is to establish that we can take
In Proposition 3.8 of Bradley and Cook we can see how. Recall the division algorithm, for example, says there are
So the term
40.2 Integrating the terms in a partial fraction decomposition
We discuss, by example, how each type of possible term in a partial fraction decomposition has an antiderivative. Hence, rational functions will always have an antiderivative that can be computed.
40.2.1 Linear factors
For
= a/(x-c) p
This has a logarithmic antiderivative:
integrate(p, x)
For
@syms j::positive
integrate(a/(x-c)^j, x)
40.2.2 Quadratic factors
When
The integral of the following general form is presented below:
With SymPy
, we consider a few cases of the following form, which results from a shift of x
This can be done by finding a
The integrals of the type
For example,
integrate(A*x/((a*x)^2 + 1)^4, x)
The integrals of the type
integrate(B/((a*x)^2 + 1)^4, x)
and
integrate(B/((a*x)^2 - 1)^4, x)
In Bronstein this characterization can be found - “This method, which dates back to Newton, Leibniz and Bernoulli, should not be used in practice, yet it remains the method found in most calculus texts and is often taught. Its major drawback is the factorization of the denominator of the integrand over the real or complex numbers.” We can also find the following formulas which formalize the above exploratory calculations (
The first returns a rational function; the second yields a logarithm term; the third yields a logarithm and an arctangent term; while the last, which has explicit constants available, provides a reduction that can be recursively applied;
That is integrating
(Bronstein also sketches the modern method which is to use a Hermite reduction to express j
” are all a
s”found following a method due to Trager and Lazard, and Rioboo, which is mentioned in the SymPy documentation as the method used.)
Examples
Find an antiderivative for
We have a partial fraction decomposition is:
= (x * (x^2 + 1)^2)
q apart(1/q)
We see three terms. The first and second will be done by
integrate(1/q, x)
Find an antiderivative of
We again just let SymPy
do the work. A partial fraction decomposition is given by:
= (x^2 - 2x - 3)
q apart(1/q)
We see what should yield two logarithmic terms:
integrate(1/q, x)
SymPy
will find
Example
The answers found can become quite involved. Corless, Moir, Maza, and Xie use this example which at first glance seems tame enough:
= (x^2 - 1) / (x^4 + 5x^2 + 7) ex
But the integral is something best suited for a computer algebra system:
integrate(ex, x)
40.3 Questions
Question
The partial fraction decomposition of
What is SymPy
or just put the sum over a common denominator and solve for
What is
Question
The following gives the partial fraction decomposition for a rational expression:
Find
Find
Question
The following specifies the general partial fraction decomposition for a rational expression:
Find
Find
Find
Question
Compute the following exactly:
Is
Question
In the assumptions for the partial fraction decomposition is the fact that
Here
If
If
If
Question
The partial fraction decomposition, as presented, factors the denominator polynomial into linear and quadratic factors over the real numbers. Alternatively, factoring over the complex numbers is possible, resulting in terms like:
How to see that these give rise to real answers on integration is the point of this question.
Breaking the terms up over
Integrating
This involves no complex numbers, as:
The term
Applying this with