Chapter 5 	Integration

5.1  Antiderivatives (Indefinite Integral)

Students should read Section 4.8 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

Integrate[f,x] gives the indefinite integral (or antiderivative) of f with respect to x.  The command Integrate can evaluate all rational functions and a host of transcendental functions, including exponential, logarithmic, trigonometric, and inverse trigonometric functions.  One can also use the palette button ∫□d□ (BasicMathInput Palette) to evaluate integrals.

Example 5.1.  Evaluate  ∫((x^2)-2x+1)dx.

Solution:

Method 1: (Palette buttons)

∫((x^2)-2x+1)\[DifferentialD]x

NOTE: Mathematica does not explicitly include the constant of integration C in its answers for indefinite integrals; the user should always assume that this is implicitly part of the answer.

Method 2: (Integrate command)

Integrate[(x^2-2x+1),x]

Example 5.2.  Evaluate  ∫((x((x^2)+1))^2)dx.

Solution:

Method 1: (Palette buttons)

∫x((((x^2)+1))^2)\[DifferentialD]x

NOTE: Observe that if the substitution u=(x^2)+1 is used to transform this integral, then the answer becomes ∫((x((x^2)+1))^2)dx=(1/2)∫(u^2)du=(1/6)(((1+(x^2)))^3).  How does one reconcile this answer with the one obtained in the output above?

The following are examples of integrals that can be evaluated in a routine manner using the substitution method.  The reader should perform the integration by hand to check answers.

Example 5.3.   Evaluate ∫(x/(Sqrt[x+1]))dx.

Solution:

∫(x/(Sqrt[x+1]))\[DifferentialD]x

Example 5.4.  Evaluate ∫(x^2)sin((x^3))dx.

Solution:

∫(x^2) Sin[(x^3)]\[DifferentialD]x

Note: Mathematica can certainly integrate much more complicated functions, including those that may require using any of the integration techniques discussed in your calculus textbook. We will consider some of these in Section 5.4.

Exercises

In Exercises 1 through 6, evaluate the integrals. Simplify your answers.
1. ∫((x^2)+2)dx			2. ∫cos 3xdx				3. ∫(Sqrt[1-(x^2)])dx		
4. ∫(sin^( 2))xdx				5.∫((3(x^5)+6(x^4)-x+1)/(x^3))d x			6.  ∫(( 1)/(1+ sin2 x))d x

In Exercises 7 and 8, evaluate the integrals by first using Mathematica to decompose the integrand as a sum of partial fractions (using the Apart[expr] command to perform this decomposition).
7. ∫(((x^2)+2x-1)/(2(x^3)+3(x^2)-2x))dx			8.∫(1/(x(x+1)(2x+3)))dx

5.2  Riemann Sums and the Definite Integral

Students should read Sections 5.1 and 5.2 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

There are two basic integration commands in Mathematica to evaluate definite integrals. Integrate[f,{x,a,b}] calculates the definite integral (area under the curve) of f on the interval [a,b] using analytic methods. NIntegrate[f,{x,a,b}] calculates a numerical approximation of the definite integral of f on [a,b] using numerical methods.

Review of Riemann Sums: A partition of a closed interval [a,b] is a set P={(Subscript[x, 0]), (Subscript[x, 1]), (Subscript[x, 2]), .... , (Subscript[x, n])} of points of [a,b] such that

a=(Subscript[x, 0])<(Subscript[x, 1])<(Subscript[x, 2])<..... <(Subscript[x, n])=b.

Given a function f on a closed interval [a,b] and a partition P={(Subscript[x, 0]), (Subscript[x, 1]), .... , (Subscript[x, n])} of the interval [a,b],  recall that a Riemann sum of f over [a,b] relative to P is a sum of the form

(∑_(i=1)^n)f((SuperStar[(Subscript[x, i])]))Δ (Subscript[x, i]),

where 	Δ (Subscript[x, i])=(Subscript[x, i])-(Subscript[x, i-1]) and (SuperStar[(Subscript[x, i])])is an arbitrary point in the ith subinterval [(Subscript[x, i-1]),(Subscript[x, i])].  For simplicity, we shall assume that Δ (Subscript[x, i])=Δ x =((b-a)/n) for all i.  A Riemann sum is therefore an approximation to the (signed) area of the region between the graph of f and the x-axis along the interval [a,b].  The exact area is given by the definite integral of f over [a,b], which is defined to be the limit of its Riemann sums as n->∞ and is denoted by (∫_a^b)f(x)dx. In other words,

(∫_a^b)f(x)dx=(lim_(n->∞))(∑_(i=1)^n)f((SuperStar[(Subscript[x, i])]))Δ x.

This definite integral exists provided the limit exists.  For a continuous function f, it can be shown that (∫_a^b)f(x)dx exists.

5.2.1  Riemann Sums Using Left Endpoints

A Riemann sum of f relative to a partition P can be obtained by considering rectangles whose heights are based on the left endpoint of each subinterval of P.   This is achieved by setting (SuperStar[(Subscript[x, i])])=(Subscript[x, i])=a+i(b-a)/n for i=0, 1, .... n-1,  so that the corresponding height of each rectangle is given by f((Subscript[x, i])).  This leads to the following formula for a Riemann sum using left endpoints, which we denote by LRSUM. To use this function, we need to specify the values of a, b, and n as well as define f using Mathematica's format.

Clear[f]
LRSUM[a_,b_,n_]:=Sum[f[a+i*(b-a)/n]*(b-a)/n,{i,0,n-1}]

Example 5.4. Let f(x)=(x^2) on [0,1] and let P={0, 1/n, 2/n, 3/n, ....,( n-1)/n, 1} be a partition of [0,1]. 
a) Approximate (∫_0^1)f(x)dx by computing the Riemann sum relative to P using the left endpoint method.
b) Plot the graph of f and the rectangles corresponding to the Riemann sum in part (a). 
c) Find the limit of the Riemann sum obtained in part a) by letting n->∞.

Solution: a) We define f(x)=(x^2) in Mathematica and evaluate LRSUM using a=0, b=1, and various values for n. In the table below, the first column gives the value of n and the second column gives the corresponding Riemann sum.

f[x_]:=(x^2)
TableForm[Table[{n,N[LRSUM[0,1,n]]},{n,10,100,10}],
TableHeadings->{{},{"n","Riemann Sum"}}]

Thus, (∫_0^1)(x^2)dx≈0.30875 for n=20 (rectangles). We leave it to the reader to use large values of n to investigate more accurate approximations using left endpoints.

b) The following program gives a plot of the rectangles corresponding to the Riemann sum in part (a) using left endpoints.

LEPT[f_,{a_,b_,n_}]:=Module[
{dx, k, xstar, lrect, plot},
dx=N[(b-a)/n];
xstar=Table[a+i* dx, {i,0,n}]; 
lrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i]]] }, {xstar[[i+1]],f[xstar[[i]]] }, {xstar[[i+1]],0}}],{i,1,n}];
plot=Plot[f[x],{x,a,b},Filling ->Axis];
Show[plot,Graphics[{Green,lrect}]]]

To demonstrate this for our example, we evaluate LEPT by specifying f(x)=(x^2),  a=0, b=1 and n=20.

f1[x_]:=x^2
LEPT[f1,{0,1,20}]

Here is a graphics animation of the plot above as n (number of rectangles) increases from 1 to 50.

Important Note: If you are reading the printed version of this publication, then you will not be able to view any of the animations generated from the Animate command in this chapter.  If you are reading the electronic version of this publication formatted as a Mathematica Notebook, then evaluate each Animate command to view the corresponding animation.  Just click on the arrow button to start the animation.  To control the animation just click at various points on the sliding bar or else manually drag the bar.

Animate[LEPT[f1,{0,1,a}] ,{a,1,50,5 }]

NOTE: The underestimation given by LRSUM in this example can be explained from the above graph: The sum of the area of the rectangles is less than the area of the region under the graph of f since the rectangles are contained inside the same region.  This is due to the fact that f is increasing on [0,1].

c)  We evaluate LRSUM in the limit as n-> ∞.

Limit[LRSUM[0,1,n], n->Infinity]

Thus,  (∫_0^1)(x^2)dx=1/3=0.33....

5.2.2  Riemann Sums Using Right Endpoints

We can similarly define a Riemann sum of f relative to a partition P by considering rectangles whose heights are based on the right endpoint of each subinterval of P.   This is achieved by setting (SuperStar[(Subscript[x, i])])=(Subscript[x, i])=a+i(b-a)/n for i=1,2,.... n,  so that the corresponding height of each rectangle is given by f((Subscript[x, i])).  Note that i ranges from 1 to n in this case (as opposed to 0 to n-1 for the left endpoint method).  This leads to the following formula for the Riemann sum using right endpoints, which we denote by RRSUM:

Clear[f]
RRSUM[a_,b_,n_]:=Sum[f[a+i*(b-a)/n]*(b-a)/n,{i,1,n}]

Example 5.5. Let f(x)=(x^2) on [0,1] and let P={0, 1/n, 2/n, 3/n, ....,( n-1)/n, 1} be a partition of [0,1]. 
a) Approximate (∫_0^1)f(x)dx by computing the Riemann sum relative to P using the right endpoint method.
b) Plot the graph of f and the rectangles corresponding to the Riemann sum in part (a). 
c) Find the limit of the Riemann sum obtainded in part a) by letting n->∞.

Solution:  a) We evaluate

f[x_]:=(x^2)
TableForm[Table[{n,N[RRSUM[0,1,n]]},{n,10,100,10}],
TableHeadings->{{},{"n","Riemann Sum"}}]

b) Similarly, we can write a program that gives a plot of the rectangles corresponding to the Riemann sum in part (a) using right endpoints.

REPT[f_,{a_,b_,n_}]:=Module[
{dx, i, xstar, rrect, plot},
dx=N[(b-a)/n];
xstar=Table[a+i* dx, {i,0,n}];
rrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i+1]]]}, {xstar[[i+1]],f[xstar[[i+1]]]}, {xstar[[i+1]],0}}],{i,1,n}];
plot=Plot[f[x],{x,a,b},Filling ->Axis];
Show[plot,Graphics[{Blue,rrect}]]]

For our example, we have:

f2[x_]:=x^2
REPT[f2,{0,1,20}]

Important Note: If you are reading the printed version of this publication, then you will not be able to view any of the animations generated from the Animate command in this chapter.  If you are reading the electronic version of this publication formatted as a Mathematica Notebook, then evaluate each Animate command to view the corresponding animation.  Just click on the arrow button to start the animation.  To control the animation just click at various points on the sliding bar or else manually drag the bar.

Animate[REPT[f2,{0,1,a}] ,{a,1,50,5 }]

NOTE: The overestimation of the RRSUM can be explained analogously as with the underestimation obtained from LRSUM.

c) We evaluate RRSUM in the limit as n->∞:

Limit[RRSUM[0,1,n],n->Infinity]

NOTE: Here is a comparison between the two plots of the left-endpoint and right-endpoint rectangles:

LREPT[f_,{a_,b_,n_}]:=Module[
{dx, i, xstar,lrect, rrect, plot},
dx=N[(b-a)/n];
xstar=Table[a+i* dx, {i,0,n}]; 
lrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i]]] }, {xstar[[i+1]],f[xstar[[i]]] }, {xstar[[i+1]],0}}],{i,1,n}];
rrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i+1]]]}, {xstar[[i+1]],f[xstar[[i+1]]]}, {xstar[[i+1]],0}}],{i,1,n}];
plot=Plot[f[x],{x,a,b},Filling ->Axis];
Show[plot,Graphics[{Blue,rrect}],Graphics[{Green,lrect}] ]
]

f[x_]:=(x^2)
LREPT[f,{0,1,20}]

f3[x_]:=(x^2) 
Animate[LREPT[f3,{0,1,a}] ,{a,1,100,5 }]

5.2.3  Riemann Sums Using Midpoints

The Riemann sum using the midpoints of each subinterval is given by the following formula. (We leave it to the student to verify that the midpoint of ith subinterval is given by  a+(i+(1/2))(((b - a)/n)) for i=1,...,n.)

Clear[f]
MRSUM[a_,b_,n_]:=Sum[f[a+(i+1/2)*(b-a)/n]*(b-a)/n,{i,1,n}]

Example 5.6. Let f(x)=(x^2) on [0,1] and let P={0, 1/n, 2/n, 3/n, ....,( n-1)/n, 1} be a partition of [0,1]. 
a) Approximate (∫_0^1)f(x)dx by computing the Riemann sum relative to P using the midpoint method.
b) Plot the graph of f and the rectangles corresponding to the Riemann sum in part (a). 
c) Find the limit of the Riemann sum obtainded in part a) by letting n->∞.

Solution:  a) We evaluate

f[x_]:=(x^2)
TableForm[Table[{n,N[MRSUM[0,1,n]]},{n,10,100,10}],
TableHeadings->{{},{"n","Riemann Sum"}}]

Options[TableForm]

b) Again, we can write a program that gives a plot of the rectangles corresponding to the Riemann sum in part (a) using midpoints.

MIDPT[f_,{a_,b_,n_}]:=Module[
{dx, i, xstar,mrect, plot},
dx=N[(b-a)/n];
xstar=Table[a+i* dx, {i,0,n}]; 
mrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[(xstar[[i]]+xstar[[i+1]])/2]}, {xstar[[i+1]],f[(xstar[[i]]+xstar[[i+1]])/2]}, {xstar[[i+1]],0}}],{i,1,n}];
plot=Plot[f[x],{x,a,b},Filling ->Axis];
Show[plot,Graphics[{Red,mrect}]]
]

f[x_]:=(x^2)
MIDPT[f,{0,1,10}]

Important Note: If you are reading the printed version of this publication, then you will not be able to view any of the animations generated from the Animate command in this chapter.  If you are reading the electronic version of this publication formatted as a Mathematica Notebook, then evaluate each Animate command to view the corresponding animation.  Just click on the arrow button to start the animation.  To control the animation just click at various points on the sliding bar or else manually drag the bar.

f4[x_]:=(x^2) 
Animate[MIDPT[f4,{0,1,a}] ,{a,1,100,5 }]

c) The limit of the Riemann sum using the midpoints is given by

Limit[MRSUM[0,1,n],n->Infinity]

NOTE: Here is a visual comparison of all three Riemann sums in terms of rectangles:

ALL[f_,{a_,b_,n_}]:=Module[
{dx, i, xstar,lrect, rrect,mrect, plot},
dx=N[(b-a)/n];
xstar=Table[a+i* dx, {i,0,n}]; 
lrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i]]] }, {xstar[[i+1]],f[xstar[[i]]] }, {xstar[[i+1]],0}}],{i,1,n}];
rrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[xstar[[i+1]]]}, {xstar[[i+1]],f[xstar[[i+1]]]}, {xstar[[i+1]],0}}],{i,1,n}];
mrect=Table[Line[{{xstar[[i]],0},{xstar[[i]],f[(xstar[[i]]+xstar[[i+1]])/2]}, {xstar[[i+1]],f[(xstar[[i]]+xstar[[i+1]])/2]}, {xstar[[i+1]],0}}],{i,1,n}];
plot=Plot[f[x],{x,a,b},Filling ->Axis];
Show[plot,Graphics[{Blue,rrect}],Graphics[{Green,lrect}],Graphics[ {Red,mrect}]]
]

f5[x_]:=(x^2)
ALL[f5,{0,1,10}]

Here is how all three Riemann sums behave when we increase the number of rectangles.

f5[x_]:=(x^2)
Animate[ALL[f5,{0,1,a}] ,{a,1,100,5 }]

NOTE: All three limits from the left-endpoint, right-endpoint, and midpoint methods are equal. This is not surprising since each is equal to (∫_0^1)(x^2)dx (remember that the existence of a definite integral requires that all Riemann sums converge to the same limit).  However, the midpoint method tends to converge faster to the limit than the other two methods (discussed in your calculus text).

Example 5.7.  Let f(x) =(x^3)+(x^2)+1 on [0,1] and let P={0, 1/n, 2/n, ...., n/n=1} be a partition of  [0,1].
a) Find the Riemann sum of f relative to P using the left endpoints of the partition.
b) Find the Riemann sum of f relative to P using the right endpoints of the partition.
c) Show that the difference between the two sums goes to 0 at n-> ∞.  
d) Find the limit of the Riemann sums in parts (a) and (b). Is this consistent with part (c)?
e) What do you conclude from part (d)?

Solution: a) The Riemann sum using left endpoints is given by

Clear[f]
LRSUM[a_,b_,n_]:=Sum[f[a+i*(b-a)/n]*N[(b-a)/n],{i,0,n-1}]

f[x_]:=(x^3)+(x^2)+1
LRSUM[0,1,n]

b) The Riemann sum using right endpoints is given by

Clear[f]
RRSUM[a_,b_,n_]:=Sum[f[a+i*(b-a)/n]*N[(b-a)/n],{i,1,n}]

f[x_]:=(x^3)+(x^2)+1
RRSUM[0,1,n]

c) We now evaluate and simplify the difference between the two Riemann sums:

Simplify[RRSUM[0,1,n]-LRSUM[0,1,n]]

As n ->∞, observe that this difference goes to zero.

d) Next, we use the limit command to evaluate the limit of the two Riemann sums:

Limit[LRSUM[0,1,n],n->Infinity]

Limit[RRSUM[0,1,n],n->Infinity]

In light of (c), we should not be surprised that the two limits are the same. After all, their difference was seen to converge to zero!

e) By definition of a definite integral, we conclude from (d) that (∫_0^1)((x^3)+(x^2)+1)dx=19/12. We confirm this by evaluating

(∫_0^1)((x^3)+(x^2)+1)\[DifferentialD]x

Exercises

1.  Let f(x)=(x/((x^2)+1))for 0≤x≤1 and let P={0/n, 1/n, 2/n, ... , n/n=1} be a partition of [0,1].

a)  Find the Riemann sum of f using the left endpoints of P and plot the rectangles that approximate the integral of f over [0,1]. Also, use the Animate command to see if the total area of the rectangles converges to the area of the region under the graph of f and above the x-axis.

b)  Repeat (a) using right endpoints of P.

c)  Repeat (a) using midpoints of P.

2.  Let f(x)=x sin x on [0, π].  Use a uniform partition P and repeat Exercise 1 (immediately above) for this function.

5.3  The Fundamental Theorem of Calculus

Students should read Sections 5.3 and 5.4 of Rogawski's Calculus [1] for a detailed discussion of the material presented in this section.

The crowning achievement in calculus is the Fundamental Theorem of Calculus (FTC), which reveals that integration and antidifferentiation are equivalent.  This can be expressed in two parts:

FTC - Part I: Given a continuous function f(x) on [a,b], we have

(∫_a^b)f(x)dx=F(b)-F(a).

Here, F(x) is any antiderivative of f(x).

FTC - Part II: If F(x)=(∫_a^x)f(t)dt, then F'(x)=f(x).

NOTE: Physically the Fundamental Theorem of Calculus tells us that the area under a velocity curve of an object is the same as the change in position of the object.

Mathematica naturally uses FTC to evaluate definite integrals whenever it is able to find an antiderivative.  Of course, there are examples where it is not able to do this, as the latter examples following demonstrate.

Example 5.8.  Evaluate (∫_1^5)(x/(Sqrt[2x-1]))dx.

Solution:

(∫_1^5)(x/(Sqrt[2x-1]))\[DifferentialD]x

Example 5.9.  Evaluate (∫_(Sqrt[3])^2)((Sqrt[(x^2)-3])/x)dx.

Solution:

Integrate[Sqrt[x^2-3]/x,{x,Sqrt[3],2}]

N[%]

Example 5.10.  Approximate (∫_0^1)tan (x^2)dx.

Solution:  Here is an example of an integral that Mathematica cannot evaluate exactly but returns the integral unevaluated because the precise answer is not expressible in terms of elementary functions.

Integrate[Tan[x^2],{x,0,1}]

However, a numerical approximation is still possible through the command N.

N[%]

Or we could use the command NIntegrate to perform both steps at once:

NIntegrate[Tan[x^2],{x,0,1}]

Example 5.11.  Use the fact that if m≤f(x)≤M for all x∈[a,b], then m(b-a)≤(∫_a^b)f(x)dx≤M(b-a) to approximate  (∫_0^2)(Sqrt[(x^3)+1])dx.

Solution: We note that the function f(x)=(Sqrt[(x^3)+1]) is increasing on [0,2].  This can be checked by finding f'(x) and observing that f'(x)>0 for all x (or by simply drawing the graph of f).  Thus, 1=f(0)≤f(x)≤f(2)=3 and so

1(2-0)≤(∫_0^2)(Sqrt[1+(x^3)])dx≤3(2-0)

or

2≤(∫_0^2)(Sqrt[1+(x^3)])dx≤6

We can confirm this by evaluating

Integrate[(Sqrt[(x^3)+1]),{x,0,2}]

Since the function Hypergeometric2F1 is not known to us, we use

NIntegrate[(Sqrt[(x^3)+1]),{x,0,2}]

Example 5.12.  Let f(x)=cos((x^2)) on [0,2] and define g(x)=(∫_0^x)f(t)dt=(∫_0^x)cos((t^2))dt. 
a) Plot the graph of f.
b) Find the value(s) of x for which g(x) starts to decrease.
c) Estimate g(x) for x=0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1,4, 1.6, 1.8, 2.
d) Draw the graphs of g(x) and g'(x).
e) How do the graphs of f(x) and g'(x) compare?

Solution: a) We plot the graph of f.

Clear[f]
f[x_]=Cos[(x^2)]
g[x_]=(∫_0^x)f[t]\[DifferentialD]t

NOTE: The function FresnelC is called the Fresnel Cosine function and plays an important role in physics and engineering.  The Fresnel Sine function is defined in the obvious manner.

Plot[f[x],{x,0,2}]

b) We note that the graph of f is above the x-axis (positive area) for x between 0 and (Sqrt[π/2]) and below the x-axis for x between (Sqrt[π/2]) and 2.  Thus, the graph of g starts to decrease after (Sqrt[π/2]).  The following table of the Riemann sums of f on [0,x] (for x varying from 0 to 2) shows this point.

f[x_]:=(x^2)
TableForm[Table[{n,N[MRSUM[0,1,n]]},{n,10,100,10}]]

LRSUM[a_,b_,n_]:=Sum[f[a+i*(b-a)/n]*N[(b-a)/n],{i,0,n-1}]

TableForm[Table[{x,LRSUM[ 0, x,100]}, {x, 0, 2, 0.1}],TableHeadings->{{},{"x","Riemann Sum"}}]

NOTE: Since g is the integral, it should start to decrease at x=(Sqrt[π/2])≈1.25.  We can confirm this by examining the values of g in the neighborhood of this point:

Table[{x,LRSUM[ 0, x,100]}, {x, 1.2, 1.3, 0.01}]//TableForm

From the table above, we see that the function g does indeed start to decrease at approximately x=1.25:

c) Here is the table of values for g(x):

TableForm[Table[{x, g[x]},{x,0.2,2,0.2}]]

d) The graphs of the function f(x) and g'(x) are given below:

Plot[{g[x],g'[x]},{x,0,2}, PlotStyle->{Red,Blue}]

e) The graphs of the function f(x) and g'(x) are given below:

Plot[{f[x],g'[x]},{x,0,2}, PlotStyle->{Red,Blue}]

This means that the two graphs are the same.  In fact, from the Fundamental Theorem of Calculus, we know that g'(x)=f(x).

Exercises

In Exercies 1 troough 11, evalaute the given integrals. 
1. (∫_0^1)((x^2)+2)dx		2. (∫_0^π)cos 3xdx			3. (∫_0^1)(Sqrt[1-(x^2)])dx		4. (∫_(-π)^π)(sin^( 2))xdx

5. ((∫_0)^3)((x^3)-4(x^2)+x)d x	6. ((∫_1)^4)((( 1)/(Sqrt[x]))+2(Sqrt[x]))d x	7. ((∫_0)^(π/4)) sec x  d x		8. (∫_0^((Sqrt[2])/4))(2/(Sqrt[1-4(x^2)])) d x
9. ((∫_0)^3)(1/(x+1))d x			10. ((∫_1)^4)((( 1)/x)+2(x^2))d x		11. ((∫_0)^π) (e^x)sin x  d x

12. Let S(x)=(∫_0^x)sin((1/2)π (t^2))dt (S(x) is called the Fresnel sine)

a)  Plot the graph of S and approximate the value of S as x->∞.  Confirm your approximation by evaluating the limit as x-> ∞.

b)  Find S'(x) and use it to find the interval(s) on whcih S(x) increase and decrease.  Hint: Apply the Fundamental Theorem of Calculus.

c)  On what intervals is S concave up? Concave down?

d)  Find the value of x for which S(x)=0.7.

13. Find an explicit formula for a continuous function f such that

(∫_0^x)f(t)dt=x (e^x)+(∫_0^x)((f(t))/(2(t^2)+1))dt.

(Hint: First take the derivative of both sides and then solve for f(x).)

5.4  Integrals Involving Trigonometric, Exponential, and Logarithmic Functions

In your calculus text, you will learn how to evaluate integrals using different techniques.  In Mathematica, we do not need to specify the technique.  It chooses the technique appropriate for the problem. However, there are some integrals that cannot be evaluated in terms of elementary functions. In such cases, Mathematica will return the integal unevaluated or gives us a name for the integral.

Below, we will consider some examples of integrals that involve trigonometric functions, exponential, and logarithmic functions.  If done by hand, some of these integrals require integration by parts, partial fraction decompositions, or trigonometric substitutions.

Example 5.13.  Evaluate ∫((x^2)/((((x^3)+1))^2))dx.

Solution: If done by hand, this integral involves using the substitution method.

Integrate[x^2/(x^3+1)^2,x]

Example 5.14.   Evaluate ∫(((x^5)+(x^2)+x+2)/((x^2)-1))dx.

Solution:  This integral involves long division and partial fraction decomposition.

∫(((x^5)+(x^2)+x+2 )/((x^2)-1))\[DifferentialD]x

Example 5.15.   Evaluate ∫(((x^4)+(x^3)+x+1)/((((x^2)+1))^2))dx.

Solution:  This integral involves long division, partial fraction decomposition, and inverse trigonometric functions.

∫(((x^4)+(x^3)+x+1 )/((((x^2)+1))^2))\[DifferentialD]x

NOTE: All functions that appear as output are written in Mathematica's notation. To convert the output to a more familiar form the command TraditionalForm can be used.  Here is the "traditional" form of the output below (note that log x means the same as ln x in this case).

∫(((x^4)+(x^3)+x+1 )/((((x^2)+1))^2))\[DifferentialD]x//TraditionalForm

Example 5.16.  Evaluate ∫(x^2)sin xdx.

Solution:  This integral involves integration by parts (twice).

∫(x^2) Sin[x]\[DifferentialD]x

Example 5.17.  Evaluate ∫((-1)/(Sqrt[1-(x^2)]))dx.

Solution:  This integral involves trigonometric substitution.

Integrate[-1/Sqrt[1-x^2],x]

NOTE: Your calculus textbook may give arccos x for the answer, as opposed to -arcsin x as above. Can you explain how the integration constant resolves the difference in these two answers?

Here are some examples of integrals that are important in applications but do not have an elementary antiderivative.

∫ Sin[(x^2)]\[DifferentialD]x

∫ (E^(-(x^2)))\[DifferentialD]x

Integrate[Sin[x]/x,x]

We can use NIntegrate to evaluate these integrals over any finite interval. For example:

NIntegrate[(E^(-(x^2))),{x,0,10}]

NIntegrate[Log[x]/x,{x,2,100}]

Example 5.18.  Let (Subscript[f, n])(x)=(∫_1^x)(t^n)dt . Investigate the limit graphically by plotting (Subscript[f, n])(x) for n = 0, –0 .3, –0 .6, and –0 .9 together with g(x)=ln x on a single plot.

Clear[f,g]
g[x_]:=Log[x]
f[x_,n_]:=(∫_1^x)(t^n)\[DifferentialD]t

Plot[{f[x,n]/.n->  {0,-0.3,-.6,-.9},g[x]},{x,0,10},PlotStyle->{Red,Blue}]

Exercises

In Exercises 1 though 5, evaluate the given integral.
1. ∫x(Sqrt[2-x])dx		2. ∫(x^3)(Sqrt[1+(x^2)])dx		3. ∫(tan^2)x (sec^4)xdx		
4. ∫(((x^2)-2x-1)/((x^3)+x))dx		5. ∫((x-1)/(Sqrt[(x^2)+x-1]))dx

In Exercises 6 through 11, use various values of a, b, and n to evaluate the  given integral. Then make a conjecture for a general formula and prove your conjecture. 
6. ∫(1/((x+a)(x+b)))dx	7. ∫cos (a x) sin(b x) dx		8. ∫(x^n)ln xdx
	
9. ∫(x^n)(e^x)dx		10. ∫(x^n)sin(x)dx			11. ∫(e^(a x))cos(b x)dx