## Section 7.5 Integration using Computer Algebra

Recall that the fundamental theorem of calculus states that if \(F(x)\) is a function with its derivative equal to \(f(x)\) on the region \(a \leq x \leq b\text{,}\) then \(\int_a^b f(x)\,dx=F(b)-F(a)\text{.}\) We say \(\int_a^b f(x)\,dx\) is the definite integral of \(f(x)\) from \(a\) to \(b\text{.}\) If \(f(x)\) is a derivative of \(F(x)\text{,}\) then \(F(x)\) is an anti-derivative of \(f(x)\text{,}\) and any anti-derivative of \(f(x)\) has the form \(F(x) + c\text{,}\) for some constant \(c\text{.}\) We use the symbol \(\int f(x)\,dx\text{,}\) without limits of integration, for the indefinite integral.

In Section 7.1 we looked at approximating definite integrals with a Riemann sum that added up the area of a bunch of rectangles. In Section 7.2 we saw that the fundamental theorem of calculus lets us use an antiderivative or indefinite integral to evaluate a definite integral. In Section 7.3–7.4 we saw how to compute indefinite integrals by hand for a limited number of functions. In this section we will look at how to use computer software at a web site to find antiderivatives.

We start with Wolfram|Alpha, available at `http://www.wolframalpha.com`

. We can give Wolfram|Alpha the question we want solved in plain English. In our case we would like to find the antiderivative of \(x^n\) with respect to \(x\text{.}\)

The Alpha provides an answer.

Note that the response tells us the question the Wolfram|Alpha is answering. That helps us check that we have been properly understood. We may find it useful to give a formula without the extra words.

The interface is fairly robust. It understands the convention that the variable for math problems is typically \(x\text{,}\) so it will generally guess that \(x\) is our variable if we don't specify the variable with respect to which we are integrating.

It is worth noting that Wolfram|Alpha is connected with Mathematica, so it will understand questions in Mathematica syntax. On the right side to the screen there is a link for related links. In particular, there will be a link for the related command in Mathematica.

Following that link gives more information on the syntax of the Mathematica command. We generally don't need to know the syntax, but it is useful if we want to use specific options.

We should note that Wolfram|Alpha will easily find antiderivatives that we would find very hard to do or beyond the scope of this class.

The output also has a link for showing steps on complicated problems.

The show steps link only works on the paid version of Alpha. However we can find other tools by searching for integral calculator. Such a search reveals Symbolab, `https://www.symbolab.com/solver/definite-integral-calculator`

, which we also used in `[cross-reference to target(s) "chap-4-SymbolicDIfferentiation" missing or not unique]`

.

In `[cross-reference to target(s) "chap-4-SymbolicDIfferentiation" missing or not unique]`

, we found a derivative calculator. Similarly we can find an integral calculator (`http://www.integral-calculator.com/`

) that will show steps. For problems of at the level of difficulty we have been doing, Wolfram|Alpha also produces plots of the integral.

### Subsection 7.5.1 Definite integrals

One of the reasons we wanted to find antiderivatives was to be able to use them to evaluate definite integrals. We can ask Wolfram|Alpha for the definite integral directly. In that case, Wolfram|Alpha will give the numeric answer and will also produce the relevant graph. (Symbolab will also do definite integrals.)

This is particularly useful when finding the antiderivative is beyond the scope of this course. Consider for example if we want to find the area under a portion of a curve that has the shape of a normal curve.

Another example when we can easily set up integrals we cannot solve by hand occurs when we are trying to find the current value of a revenue stream. A value, \(V\text{,}\) that we get \(t\) years in the future, has a present value of \(V \exp(-r t)\) where \(r\) is an investment return rate. Thus the current value of a revenue stream, \(V(t)\text{,}\) from time \(a\) to time \(b\text{,}\) is \(\int_a^b V(t)*e^{(-r*t)} dt\text{.}\) However we only have a rule for finding the antiderivative when \(V(t)\) is either a constant or exponential function. With a CAS program it is straightforward to compute such integrals for a broad range of value stream functions.

If you are going to use Wolfram|Alpha in doing work, you should realize that the terms of use of the site require you to appropriately cite Wolfram|Alpha. (This is standard academic procedure.) Your citation should include that date that you got your answer from the site. The results above were obtained on Feb 29, 2012.

In business situations, we are rarely asked to simply find an integral. Instead, finding an integral is generally part of a larger problem. Thus we often use CAS for part of a problem.

### Subsection 7.5.2 Initial value problems

We often want to choose a particular antiderivative of a function. We typically do this when we have the value of the antiderivative for some value. We simply plug that value into the general antiderivative and solve for \(C\text{.}\)

#### Example 7.5.1. Finding the antiderivative, then the constant.

The rate of change profit with respect to quantity is given by \(P'(q)=-q^2+5q+50\) and the break-even point occurs when \(q=5\text{.}\) Find the formula for profit as a function of \(q\text{.}\) Find the maximum profit.

We can do this by putting together things we have already done. First we use Wolfram|Alpha to find an antiderivative.

Thus we know \(P(q)=\frac{1q^3}{3}+\frac{5q^2}{2}+50q+C\) for some constant \(C\text{.}\) We also know \(P(5)=0\text{.}\) We now plug the function, without the \(C\text{,}\) into Excel and evaluate at \(q=5\text{.}\)

We make \(C\) the negative of our answer and modify our function accordingly. We now use solver to maximize the function.

Thus the maximum profit is $145.83, and it occurs when \(q=10\text{.}\)

#### Example 7.5.2. The previous example in one step.

The rate of change profit with respect to quantity is given by \(P' (q)=-q^2+5q+50\) and the break-even point occurs when \(q=5\text{.}\) Find the formula for profit as a function of \(q\text{.}\) Find the maximum profit.

We can also do this with Wolfram|Alpha setting up the boundary value problem. We give the alpha bot the derivative we want integrated and the fixed value of the original function. (Notice that the answer does not include a \(+C\text{,}\) since we have computed a particular constant.)

We then ask Alpha to maximize the function.

This gives the same answer of $145.83.

This first example could easily have been done by hand. We can repeat the process with an example that could not be easily been by hand.

#### Example 7.5.3. A more complicated initial value problem.

The rate of change of profit with respect to quantity is given by \(P' (q)=q^2 \exp(-q/10)-q/10\) and a break-even point occurs when \(q = 5\text{.}\) Find the formula for profit as a function of \(q\text{.}\) Find the maximum profit.

In structure, this example is very similar to the first example. However, where in the first example, the function would have been easy to do by hand, in this case, the problem is very hard to do by hand. We use Wolfram/Alpha to find the antiderivative.

We then use Excel to find \(C\text{,}\) noting that if we use \(P(q)\) without the \(C\text{,}\) then \(C\) is the value of \(-P(5) = 1972.474\text{.}\)

We plug in 5 and note \(P(5) = 0 = C-1972.474\text{,}\) thus \(C = 1972.474\text{.}\) We use solver to maximize and find the maximum profit of $1675.17 occurs at \(q=64.72775\text{.}\)

### Subsection 7.5.3 Riemann Sums

We can also use Alpha to do Riemann sums. We need to give a starting and ending point and the number of intervals.

#### Example 7.5.4. Riemann sums with Wolfram|Alpha.

Find the current value of a revenue stream \(V(t)=2000+5t\) for 10 years with an investment rate of \(r=1.03\text{,}\) assuming payments are made daily.

We approximate the current value with the integral

What we really want is the Riemann sum with one interval per day. Over 10 years we have 3652 days.

If we assume payments start at the beginning of the first day we would use the left endpoint method.

### Exercises 7.5.4 Exercises: Integration using Computer Algebra Problems

#### Exercise Group.

Find the antiderivative of the given function.

##### 1.

##### 2.

##### 3.

##### 4.

##### 5.

##### 6.

##### 7.

##### 8.

##### 9.

##### 10.

#### Exercise Group.

Evaluate the definite integral.

##### 11.

##### 12.

##### 13.

##### 14.

##### 15.

##### 16.

#### Exercise Group.

Do the initial value problem.

##### 17.

##### 18.

##### 19.

##### 20.

#### 21.

I have an investment that produces income at a rate of \(P(t)=5000+100t\text{.}\) I assume the present value of an asset decreases continuously at a rate of 2% per year for the length of time I have to wait for the asset. What is the present value of the first 7 years of return from my investment?

#### 22.

My oil well is producing revenue at a rate of \(P(t)=5000(0.09^t)\text{.}\) I assume the present value of an asset decreases continuously at a rate of 3% per year for the length of time I have to wait for the asset. What is the present value of the first 10 years of return from my investment?

#### 23.

The rate of marginal profit is \(MP(q)=100-12\ln(q)\) and a break-even point occurs at \(q=100\text{.}\) Find the quantity that produces the most profit and the amount of profit generated at that point.

We have maximal profit when \(MP(q)=0\text{,}\) or when \(q=e^8=2981\text{.}\) Using WolframAlpha to solve the initial value problem we get

#### 24.

Our marginal cost function is \(MC(q)=10q \ln(q)\) and the startup costs are $23,000. Produce a cost function.