5  Applications of the Integral   (page 135)

5.1  Area

Example 5.1.1  (page 135)

Clear[f, g];  f[x_] = x(4 - x)/2 + Sin[5*Pi*x/4]

g[x_] = Sin[7*Pi*x/4]/2

Plot[ {f[x], g[x]}, {x,-4, 8}, PlotRange->{-3,3}]

Plot[{f[x],g[x]},{x,0,4},Filling->{1->{2}}]

f[x] - g[x]

Integrate[ f[x] - g[x], {x,0,4}]

N[ Integrate[ f[x] - g[x], {x,0,4}] ]

Example 5.1.2   (page 136)

ContourPlot[{x y==4,2 x==y (5-y)},{x,-5,5},{y,-2,6}]

lam[y_] = y(5-y)/2 - 4/y

solns = y /. NSolve[ lam[y] == 0, y]

Sort[ solns ]

solns[[2]] ≤ y ≤ solns[[1]]

Integrate[ lam[y], {y, solns[[2]], solns[[1]]} ]

and this should work independently of the version of MATHEMATICA.

Of course, as a common sense procedure, a person could simply use  sols  with cut and paste to obtain

Integrate[ lam[y], {y, 1.515138047128071`, 4.6261980685272945`}]

Exercise 10    (on page 137)

For this we use the corrected version of the last formula on page 128 where

CORRECTEDsimpsonData[ yList_, h_] := 
Module[{wt, n=Length[yList]-1}, wt[i_] = 3. +(-1)^i;
		If[ EvenQ[n], (h/3.)*(yList[[1]] + Sum[ wt[i]*yList[[i]], {i,2,n}]+yList[[n+1]]),
			"length of data list must be odd"]]

ylist = {0, 127, 286, 345, 351, 344, 301, 256, 230, 258, 373, 307,272, 243, 230, 225, 177, 0}

Length[ylist]

If the length of the list were an odd integer, we would compute 
                   CORRECTEDsimpsonData[ ylist, 50 ] 
and obtain an answer in square feet of area.  However, since the length of the list is even, 
our procedure is less satisfactory.  We could set

new1 = Append[ ylist, 0 ]

and compute

CORRECTEDsimpsonData[new1, 50]      squarefeet

Or, we could set

new2 = Prepend[ ylist, 0]

and compute

CORRECTEDsimpsonData[new2, 50]   squarefeet

5.2  Volume

Example 5.2.1   (page 138)

Clear[f]

f[x_] := 2*Sin[ 9*Pi(2x+5)/200 ]^2 + 1

Plot[{f[x],-f[x]},{x,0,10},Filling->{1->{2}}, AspectRatio->Automatic]

a = Pi*f[x]^2

Here, in the preceding input, the sylmbol    a   is an abbreviation for     Pi*f[x]^2
(When our author sets    a[x] = Pi*f[x]^2,   it is the entire symbol a[x] that 
 is an abbrebiation for   Pi*f[x]^2.  This does not define  a[2] or a[3].  
 For them to be defined, he would have set    a[x_] = Pi*f[x]^2   and then 
 had   a[2] = Pi*f[2]^2   or  a[3] = Pi*f[3]^2  etc.

Integrate[ a, {x,0,10}]

N[ Integrate[ a, {x,0,10}] ]

Example 5.2.2   (page 139)

Clear[f, g];  f[x_] = 2*Sin[2x]

g[x_] = x^2

Plot[ {f[x], g[x]}, {x,0,Pi/2}]

x1 = x /. FindRoot[ f[x] - g[x], {x, 1.2} ]

The following Plot is from the second edition.

Plot[ { f[x], f[-x], g[x] },  {x, -x1,x1}, PlotRange->{0,2}]

It has been improved to the following.

pic = Show[ Plot[{f[Abs[x]],g[x]},{x,-x1,x1}, PlotRange->{0,2.3}, Filling->{1->{2}}], Graphics[ Circle[{0, f[x1]}, {x1,x1/5},{Pi,2Pi}]], Graphics[Circle[{0,f[Pi/4]},{Pi/4,Pi/20}]]]

Integrate[ 2*Pi*x*(f[x] - g[x]), {x,0,x1}]

For Exercise 9 on page 140, the axis of rotation should be stated.

Exercise 9  with rotation about  x-axis     (the cross-section method)

yForCircle[x_] = - Sqrt[R^2-x^2]

yForLine[x_] = h - R

A cross section perpendicular to the x-axis at x = x has area

A[x_] = Pi*yForCircle[x]^2  - Pi*yForLine[x]^2//Simplify

x1 = 0

x2 = Sqrt[ R^2 - (h - R)^2]//Simplify

Volume = Integrate[ A[x], {x,x1,x2}]//FullSimplify

As  a check, we have

Volume /. h -> R //PowerExpand

which is one-half the volume of a sphere of redius R (as it should be).

Exercise 9 on page 140 with rotation about y-axis  (cross-sectional method)

The cross-sectional area of a section perpendicular to the y-axis at y = y, 
for -R ≤ y ≤ h - R,   is equal to

A1[y_] = Pi*(Sqrt[ R^2 - y^2])^2

and the corresponding volume is equal to

Volume1 = Integrate[ A1[y], {y,-R,h-R}] //Factor

Exercise 9  with rotation about the y-axis   (shell method)
This is instructive because it illustrates why Mathematica does not automatically replace  ((((a^b)))^c) with (a^bc) and etc.

?PowerExpand

?Assuming

Volume2 = Assuming[R>0&& 0≤h≤R,Integrate[ 2*Pi*x( yForLine[x] - yForCircle[x] ), {x,x1,x2}] ]

Due to 0 ≤  h ≤ R,  the use of PowerExpand here would give the following error.

PowerExpand[((h - R)^2)^(3/2)]

whereas  we really have  ((h - R)^2)^(3/2) = ((R - h)^2)^(3/2) = (R - h)^3

Simplify[ Volume2 - Volume1]

Thus, the cross-sectional method and the shell method yield the same volume when the indicated region is rotated about the y-axis.

Exercise 9 on page 140 when rotation is made about the line  y = h - R

A cross-section perpendicular to the line  y = h - R  at x = x  is circular with radius equal to

r[x_] = yForLine[x] - yForCircle[x]

For h = R, the volume is given by

Integrate[ Pi*(Sqrt[R^2 - x^2])^2, {x, 0,R}]

For 0 ≤ h < R,  the volume by the cross-sectional method is equal to

expr4 = Assuming[  R>0&&0 ≤h <R, Integrate[ Pi*r[x]^2, {x, x1,x2}]]

Limit[expr4,h->0]

Limit[expr4,h->R]

5.3  Arc Length and Surface Area  (page 141)

Example 5.3.1  (on page 141)

Plot[ Sin[x], {x,0,Pi}, AspectRatio->Automatic, PlotRange->All]

Integrate[ Sqrt[1+Cos[x]^2],{x,0,Pi}]

N[ 2*Sqrt[2]*EllipticE[1/2] ]

?EllipticE

and the trustworthy evaluation

NIntegrate [ Sqrt[ 1 + Cos[x]^2 ], {x, 0, Pi} ]

Example 5.3.2  (on page 142)

Plot[ x^3, {x, 0, 1}, AspectRatio->Automatic, PlotRange->All]

Integrate[ Sqrt[ 1 + 9x^4], {x,0,1}]

N[ Integrate[ Sqrt[ 1 + 9x^4], {x,0,1}] ]

NIntegrate[  Sqrt[ 1 + 9x^4], {x,0,1} ]

SurfaceArea  (on page 142)

Example 5.3.3

Integrate[ 2*Pi*Sin[x]*Sqrt[1 + Cos[x]^2], {x,0,Pi}]

N[ Integrate[ 2*Pi*Sin[x]*Sqrt[1 + Cos[x]^2], {x,0,Pi}] ]

Example 5.3.4  (on page 143)

Integrate[ 2*Pi*x*Sqrt[1+Cos[x]^2], {x,0,Pi}]

NIntegrate[ 2*Pi*x*Sqrt[1+Cos[x]^2], {x,0,Pi}]

Exercise 6 on page 143

xlist = Table[ x, {x, 0., 5., .5}]

funlist = {1.2, 3.1, 3.9, 4.5, 5.3, 4.7, 4.3, 3.3, 2.5, 1.3, .7 }

primelist = { 3.5, 2.3, 1.6, 1.3, -0.2, -1.1, -1.5, -2.1, -1.9, -1.2, -0.2 }

{Length[ xlist], Length[funlist], Length[primelist] }

Part (a).  The arc length.

arclist = Sqrt[ 1 + primelist^2]

Jus for the fun of it, we note that

Table[  Sqrt[  1 + primelist[[i]]^2 ], {i,1,11}] -arclist

From page 128, we have

CORRECTEDsimpsonData[ yList_, h_] := 
Module[{wt, n=Length[yList]-1}, wt[i_] = 3. +(-1)^i;
		If[ EvenQ[n], (h/3.)*(yList[[1]] + Sum[ wt[i]*yList[[i]], {i,2,n}]+yList[[n+1]]),
			"length of data list must be odd"]]

CORRECTEDsimpsonData[ arclist, .5] theArcLength

Part (b).  The area of the surface generated by revolving about the x-axis.

xAxisSurfaceAreaList = 2*Pi*funlist*Sqrt[1 + primelist^2]

As a check, we note that

Table[ 2*Pi*funlist[[i]]*Sqrt[ 1 + primelist[[i]]^2], {i,1,11}] - xAxisSurfaceAreaList

CORRECTEDsimpsonData[ xAxisSurfaceAreaList, .5 ]surfaceAreaAboutXaxis

Part (c). The area of the surface generated by revolving about the y-axis.

yAxisSurfaceList = 2*Pi*xlist*Sqrt[1 +primelist^2]

As a check, we note that

Table[ 2*Pi*xlist[[i]]*Sqrt[1 + primelist[[i]]^2], {i,1,11}] - yAxisSurfaceList

CORRECTEDsimpsonData[ yAxisSurfaceList, .5]    surfaceAboutYaxis

Exercise 7 on page 143

Just as for the Module defined at the top of page 115, we assume that the formula that exxentially specifies the function is to be entered as a function of the independent variable x. 
Here, delayed set  (i.e.,  :=  ) is needed --- just as it is whenever the expressions are not defined until further input is provided.

arcLength[f_, {x_,a_,b_}] := Module[ {g}, g[t_] = f /. x->t; NIntegrate[ Sqrt[1 + g'[t]^2], {t,a,b}] ]

arcLength[ Sin[x], {x,0,Pi}]

arcLength[x^3,{x,0,1}]

Exercise 8 on page 143.

surfAreaX[f_, {x_,a_,b_}] := Module[ {g},   g[t_] = f /. x->t; NIntegrate[ 2*Pi*g[t]*Sqrt[ 1 + g'[t]^2 ], {t,a,b}] ]

surfAreaX[ Sin[x], {x, 0,Pi}]

surfAreaY[f_, {x_,a_,b_}] := Module[ {g},   g[t_] = f /. x->t; NIntegrate[ 2*Pi*t*Sqrt[ 1 + g'[t]^2 ], {t,a,b}]]

surfAreaY[ Sin[x], {x, 0, Pi}]

5.4  Moments and Centers of Mass

Example 5.4.1

f[x_] = 4E^(x-2)

g[x_] = x^2

region=Plot[{f[x],g[x]},{x,0,2},Filling->{1->{2}}]

FindRoot[f[x]==g[x],{x,2}]

area = Integrate[ f[x] - g[x], {x,0,2}]

xMoment = (1/2)*Integrate[ f[x]^2 - g[x]^2, {x,0,2}]

yMoment = Integrate[ x(f[x] - g[x]), {x,0,2}]

ctrOfMass =  { yMoment/area,  xMoment/area } //Simplify

N[ctrOfMass]

Show[ region, Graphics[ {PointSize[.02], Point[ctrOfMass]}]]

Example 5.4.2

f[x_] = Sin[x]

g[x_] = 9Sin[x]^4/10

region=Plot[{f[x],g[x]},{x,0,π},Filling->{1->{2}}]

area = Integrate[ f[x] - g[x], {x,0,Pi}]

xMoment = (1/2)*Integrate[ f[x]^2 - g[x]^2, {x,0,Pi}]

ctrOfMass = { Pi/2,  xMoment/area } //Simplify

N[ ctrOfMass]

Show[ region, Graphics[{PointSize[.02], Point[ctrOfMass]}]]

Exercise 12 on page 1477.

The supposition is that   f(x)  ≥  g(x),  for   a ≤  x  ≤  b.

centroid[f_,g_,{x_,a_,b_}] := Module[ {f1, g1, area, xMoment, yMoment},
		f1[t_] := f /.x->t;  g1[t_] := g /. x->t;
		area = NIntegrate[ f1[t] - g1[t], {t,a,b} ]; 
		yMoment =NIntegrate[ t(f1[t] - g1[t]), {t,a,b} ];
		xMoment = (1/2)*NIntegrate[ f1[t]^2 - g1[t]^2, {t,a,b}];
		{yMoment/area, xMoment/area } ]

centroid[ 4E^(x-2), x^2, {x,0,2}]

centroid[ Sin[x], 9Sin[x]^4/10, {x,0,Pi}]

centroid[ 1,0,{x,0,1}]

Emphasis on Exam over Chapter 5 will be the doing of a complete problem such  as Number 1 or 3 or 5 or 7 on page 137  (with both Input and corresponding Output statements carefully printed on a page) .