Chapter 8
Integral Calculus and Its Uses
8.6 Using a Computer Algebra System to Integrate
8.6.2 Integrating Rational Functions
In Section 6.3 we solved the logistic growth equation by finding an antiderivative of \(\displaystyle\frac{1}{P(M-P)}\) (where \(P\) is the variable and \(M\) is a constant), that is, we evaluated the indefinite integral \(\displaystyle\int \frac{1}{P(M-P)}\,dP\). Our strategy for finding this antiderivative (in different notation) was to write
and find \(A\) and \(B\) by algebra. We then found that each term on the right is the derivative of a logarithmic function. This is an example of integrating a rational function, that is, a quotient of polynomial functions. In this case, the quotient is \(\displaystyle\frac{f(P)}{g(P)}\), where \(f(P)=1\) and \(g(P)=P(M-P)\).
If you worked on Project 1 in Chapter 6, you solved the Velocity-Squared Model for a falling body with air resistance by a similar process, finding an antiderivative of \(\frac{1}{g-cv^2}\), which is another quotient of polynomials \(p(v)\) and \(q(v)\), where \(p(v)=1\) and \(q(v)=g-cv^2\).
Let's see what our computer algebra systems can do with these problems.
Example 1
When asked to evaluate
almost every computer algebra system (CAS) responds with an answer equivalent to
One thing to notice about this answer is that the CAS has used the same strategy you would use in this case — the two terms in the answer come from integrating \(\frac{1}{P}\) and \(\frac{1}{M-P}\), each with some constant factor that the CAS has computed for you.
But there are several things wrong with this answer, and you need to be aware of them. Your CAS needs your help in order to obtain meaningful answers.
First, observe that there is no "\(+C\) " at the end of the answer. A CAS will calculate one antiderivative, not the whole infinite family. It's your responsibility to remember the "\(+C\) ". You can't ignore this, because you can't solve an initial value problem without it. Sage is not an exception to this rule, but we have structured our Sage Indefinite Integral tools to include the "\(+C\) ", as you can see by pressing this button.
Note 1 – An exception
Second, the CAS doesn't seem to know that the indefinite integral of \(1/P\) is \(\ln\,|P|\), not \(\ln\,P\). In the context of the logistic population model, that doesn't matter for a positive population \(P\) — but it matters a lot for the other term. There is no such thing as \(\ln(-M+P)\) when \(P\) is a population smaller than the maximum supportable population \(M\). On the other hand, if you supply the absolute value bars, the problem goes away, because \(|-M+P\,|=M-P\).
Third, the algebraic form of the answer may not be suitable for whatever comes next, such as solving an equation for \(P\) as a function of time \(t\). Sage has algebraic operations such as "simplify", "factor", "expand", but those words have different meanings in different contexts, and we're not going to make Sage do all the algebra for you. It's fairly easy to see that the answer (after dealing with absolute values) can also be written as
So, in the context of the logistic growth model, a correct conclusion is
In Activity 1 and subsequent activities, you will find a button for a Sage tool, as well as an additional button that links to Wolfram|Alpha, an online computational engine that includes some of the CAS capabilities of Mathematica. You have to be online to use either Sage or Wolfram|Alpha, but you don't have to have Mathematica or Sage installed or know anything about those particular systems.
-
Use both the Sage tool and Wolfram|Alpha to evaluate the indefinite integral
- The answers in part a. are very different from each other, and the Sage check leaves something to be desired. First, do the algebraic simplification on the Sage check to confirm that the Sage answer really is an antiderivative of the given function.
- Edit the Sage function entry to evaluate the integral in the factored form
- Now, depending on whether you worked on Project 1 in Chapter 5, you may or may not remember the inverse hyperbolic tangent function \(\tanh^{-1}x\), also designated \(\text{arctanh}\,x\) or \(\text{atanh}\,x\), which appears in the Wolfram|Alpha answer to part a. Reconcile your answers from parts a. and b. You may use the formula (from the fourth part of Project 1 in Chapter 5)