Using Riemann Sums to Estimate Areas, Volumes, and Lengths of Arc

Clear[areas];
areas:=Block[{},h=((b-a)/n);ΔA[i_]=f[a+i h] h;Print["The ΔA[i] function is ",ΔA[i]];rateList=Table[{a+i h,((ΔA[i])/h)},{i,0,n-1}];Print["The \!\(\*FractionBox[\(ΔA[i]\), \(Δx\)]\) function is ",((ΔA[i])/h)];p0=ListPlot[rateList,PlotStyle->{RGBColor[0,0,1],PointSize[0.015`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(i\)]\)","\!\(\*FractionBox[SubscriptBox[\(ΔA\), \(i\)], \(Δx\)]\)"}];areaSum[k_]:=(∑_(i=0)^(k-1))N[ΔA[i]];arealist=Table[{a+k h,areaSum[k]},{k,0,n}];p1=ListPlot[arealist,PlotRange->All,PlotStyle->{RGBColor[1,0,0],PointSize[0.0175`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*SubscriptBox[\(A\), \(total\)]\)(k)"}];(Subscript[A, approx])[x_]=Fit[arealist,fitlist,x];Print["The function Aapprox[x] is ",(Subscript[A, approx])[x]];p2=Plot[(Subscript[A, approx])[x],{x,a,a+n h},PlotRange->All,PlotStyle->{RGBColor[0,0,1]},AxesLabel->{"x","\!\(\*SubscriptBox[\(A\), \(approx\)]\)[x]"},DisplayFunction->Identity];Show[{p2,p1},AxesLabel->{"x","\!\(\*SubscriptBox[\(A\), \(approx\)]\)[x] & \!\(\*SubscriptBox[\(A\), \(total\)]\)(k)"},DisplayFunction->$DisplayFunction];msecant=Table[{a+k h,(1/h)(areaSum[k+1]-areaSum[k])},{k,0,n-1}];p4=ListPlot[msecant,PlotStyle->{RGBColor[1,0,0],PointSize[0.02`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*SubscriptBox[\(m\), \(secant\)]\)"},DisplayFunction->Identity];Show[{p4,p0},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*FractionBox[SubscriptBox[\(ΔA\), \(i\)], \(Δx\)]\) & \!\(\*SubscriptBox[\(m\), \(secant\)]\)"},DisplayFunction->$DisplayFunction]];
Clear[volumes];
volumes:=Block[{},h=((b-a)/n);ΔV[i_]=π ((f[a+i h])^2) h;Print["The ΔV[i] function is ",ΔV[i]];rateList=Table[{a+i h,((ΔV[i])/h)},{i,0,n-1}];Print["The \!\(\*FractionBox[\(ΔV[i]\), \(Δx\)]\) function is ",((ΔV[i])/h)];p0=ListPlot[rateList,PlotStyle->{RGBColor[0,0,1],PointSize[0.015`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(i\)]\)","\!\(\*FractionBox[SubscriptBox[\(ΔV\), \(i\)], \(Δx\)]\)"}];volumeSum[k_]:=(∑_(i=0)^(k-1))N[ΔV[i]];volumelist=Table[{a+k h,volumeSum[k]},{k,0,n}];p1=ListPlot[volumelist,PlotRange->All,PlotStyle->{RGBColor[1,0,0],PointSize[0.0175`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*SubscriptBox[\(V\), \(total\)]\)(k)"}];(Subscript[V, approx])[x_]=Fit[volumelist,fitlist,x];Print["The function Vapprox[x] is ",(Subscript[V, approx])[x]];p2=Plot[(Subscript[V, approx])[x],{x,a,a+n h},PlotRange->All,PlotStyle->{RGBColor[0,0,1]},AxesLabel->{"x","\!\(\*SubscriptBox[\(V\), \(approx\)]\)[x]"},DisplayFunction->Identity];Show[{p2,p1},AxesLabel->{"x","\!\(\*SubscriptBox[\(V\), \(approx\)]\)[x] & \!\(\*SubscriptBox[\(V\), \(total\)]\)(k)"},DisplayFunction->$DisplayFunction];msecant=Table[{a+k h,(1/h)(volumeSum[k+1]-volumeSum[k])},{k,0,n-1}];p4=ListPlot[msecant,PlotStyle->{RGBColor[1,0,0],PointSize[0.02`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*SubscriptBox[\(m\), \(secant\)]\)"},DisplayFunction->Identity];Show[{p4,p0},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*FractionBox[SubscriptBox[\(ΔV\), \(i\)], \(Δx\)]\) & \!\(\*SubscriptBox[\(m\), \(secant\)]\)"},DisplayFunction->$DisplayFunction]];
Clear[lengths];
lengths:=Block[{},h=((b-a)/n);ΔL[i_]=√(1+((((1/h)(f[a+i h+h]-f[a+i h])))^2)) h;Print["The ΔL[i] function is ",ΔL[i]];rateList=Table[{a+i h,((ΔL[i])/h)},{i,0,n-1}];Print["The \!\(\*FractionBox[\(ΔL[i]\), \(Δx\)]\) function is ",((ΔL[i])/h)];p0=ListPlot[rateList,PlotStyle->{RGBColor[0,0,1],PointSize[0.015`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(i\)]\)","\!\(\*FractionBox[SubscriptBox[\(ΔL\), \(i\)], \(Δx\)]\)"}];lengthSum[k_]:=(∑_(i=0)^(k-1))N[ΔL[i]];lengthlist=Table[{a+k h,lengthSum[k]},{k,0,n}];p1=ListPlot[lengthlist,PlotRange->All,PlotStyle->{RGBColor[1,0,0],PointSize[0.0175`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*SubscriptBox[\(L\), \(total\)]\)(k)"}];(Subscript[L, exact])[x_]=Assuming[x∈Reals,(∫_a^x)(Sqrt[1+((f'[u])^2)])\[DifferentialD]u];Print["The function Lexact[x] is ",(Subscript[L, exact])[x]];p2=Plot[(Subscript[L, exact])[x],{x,a,a+n h},PlotRange->All,PlotStyle->{RGBColor[0,0,1]},AxesLabel->{"x","\!\(\*SubscriptBox[\(L\), \(exact\)]\)[x]"},DisplayFunction->Identity];Show[{p2,p1},AxesLabel->{"x","\!\(\*SubscriptBox[\(L\), \(exact\)]\)[x] & \!\(\*SubscriptBox[\(L\), \(total\)]\)(k)"},DisplayFunction->$DisplayFunction];msecant=Table[{a+k h,(1/h)(lengthSum[k+1]-lengthSum[k])},{k,0,n-1}];p4=ListPlot[msecant,PlotStyle->{RGBColor[1,0,0],PointSize[0.02`]},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*SubscriptBox[\(m\), \(secant\)]\)"},DisplayFunction->Identity];Show[{p4,p0},AxesLabel->{"\!\(\*SubscriptBox[\(x\), \(k\)]\)","\!\(\*FractionBox[SubscriptBox[\(ΔL\), \(i\)], \(Δx\)]\) & \!\(\*SubscriptBox[\(m\), \(secant\)]\)"},DisplayFunction->$DisplayFunction]];

Introduction

OBJECTIVE: Use Riemann sums to approximate areas, volumes, and lengths of arc. Construct accumulation functions, and see how the accumulated quantities converge on the antiderivative in the limit. 

In this module, we explore the use of Riemann sums to estimate areas, volumes of revolution, and the length of a curve. We first write an expression for (Subscript[ΔQ, i]), where Q is the quantity of interest (area, volume, or arc length); then we look at ((Subscript[ΔQ, i])/(Δ x))as the rate at which Q accumulates with respect to increments in x; we form a list of accumulated quantities, (Subscript[Q, i]); and finally, we use the list of (Subscript[Q, i])'s to reconstruct ((Subscript[ΔQ, i])/(Δ x)).

Technology Guidelines

NOTE:  If you have just finished a module, restart Mathematica or Quit Kernel under the Evaluation pull-down menu before executing a new module.
TO OPEN CELLS, click on the arrow to the left of the cell or put your cursor on the right cell bracket and double click. To open all cells, highlight the bracket on the far right and select Grouping under the Cell pull-down menu and select Open All Subgroups.
TO STOP AN EXECUTION
Select the Evaluation pull-down menu and click on Abort Evaluation.
ORDER OF EXECUTION
Execute cells in the order given. Do not skip any Input cells within a given notebook.
SAVING NOTEBOOKS
You can save anytime to any directory you choose, and it is wise to save often. However, before you do your final save to reduce the size of your file, it is a good idea to delete all your output by selecting the Delete All Output selection under the Cell pull-down menu.
EXPERIENCING MAJOR PROBLEMS
Save if appropriate, then shut down Mathematica and start it up again.

Part I: Areas

Note: In this exercise, Δ(Subscript[A, i]) represents the area of the (i^th) rectangle, as shown in the figure above.

In this Part, we will do the following:
1. Form a function, ΔA(i), that gives the area of the (i^th) rectangle in terms of f((Subscript[x, i])) and h.
2. Form a rate-of-change function, ((ΔA(i))/(Δ x)), that gives the rate of accumulation of area at x=a+i h.
3. Form a function, areaSum[k_], that gives the sum of the areas of the rectangles, that is, the ΔA(i)'s, as i ranges from 0 to k. This approximates the area under the graph of y=f(x), between x=a and x=a+k h.
4. Form a function that gives the slopes of the secant lines on the graph of the A(k) function found in step 3, and show that this is the same as the rate-of-change function found in step 2. 
5. In the You Try It exercise, you explore what happens as the number of rectangles goes to infinity while h goes to 0.


Our first objective is to write Δ(Subscript[A, i]), the area of the (i^th) rectangle, in terms of f((Subscript[x, i])) and h where (Subscript[x, i]) = a+i h. At first, we let a = 0,  b = 5, and n=10.

Clear[f,ΔA,a,b,h,n];
f[x_]=x;
a=0;
b=5;
n=10;
h=(b-a)/n;
ΔA[i_]=f[a+i*h]*h

Note that if f((Subscript[x, i])) is negative and Δ x=h is positive, then (Subscript[ΔA, i]) is negative. The areas can be positive, negative, or zero, and so we refer to them as "signed areas." Areas above the x-axis are positive, and areas below the x-axis are negative, provided Δ x=h is positive.

Next, we form the rate-of-change function, ((ΔA(i))/(Δx)). The function ((ΔA(i))/(Δx)) is the rate at which the total signed area of the rectangles accumulates with each increment of Δ x=h added to x. We generate a list of the rate-of-change values for each (Subscript[x, i])=a+i h, plot the rate of change versus (Subscript[x, i]), and then assign the graph to the symbol name p0 for later reference.

rateList=Table[{a+i h,((ΔA[i])/h)},{i,0,n-1}]

p0=ListPlot[rateList,PlotStyle->{RGBColor[0,0,1],PointSize[0.015`]},AxesLabel->{"(Subscript[x, i])","((Subscript[ΔA, i])/(Δx))"}]

You have probably noticed that, for the area problem, the rate at which the total area of the rectangles accumulates with each added increment h is simply f((Subscript[x, i])), the height of the (i^th) rectangle. That is, ((ΔA(i))/(Δx))=f((Subscript[x, i])).

Now we form a function that calculates the left Riemann sum of the (Subscript[ΔA, i])'s for the first k rectangles, where k can range between 0 and n.

areaSum[k_]:=(∑_(i=0)^(k-1))ΔA[i];

For example, we can use areaSum[ ]  to calculate the total signed area of the first four rectangles.

areaSum[4]

Or we can calculate the area of all ten rectangles. (Recall that we set n=10.)

areaSum[10]

Next, we form a list of the ordered pairs, in which the first element of each ordered pair is the x-coordinate of the left side of the last rectangle in the sum, and the second element in each ordered pair is the area of the first k rectangles.

arealist=Table[{a+k*h,areaSum[k]},{k,0,n}]

Now we plot the list of points and assign it to the symbol name p1 for later use.

p1=ListPlot[arealist,PlotStyle->{RGBColor[1,0,0],PointSize[0.015`]},AxesLabel->{"(Subscript[x, k])","(Subscript[A, total])(k)"}]

The function areaSum[ k ] looks as though it might be a quadratic polynomial, so now we use the Fit[ ] command to see if there is a polynomial function that passes through the points.

(Subscript[A, approx])[x_]=Fit[arealist,{1,x,(x^2)},x]

Now we plot (Subscript[A, approx])[x] and the points in arealist to show that the points do in fact lie on the graph of the quadratic polynomial. First, we plot (Subscript[A, approx])[x] and then show the two graphs on the same plot.

p2=Plot[(Subscript[A, approx])[x],{x,a,a+n h},PlotStyle->{RGBColor[0,0,1]},AxesLabel->{"x","(Subscript[A, approx])(x)"}]

Show[{p2,p1},AxesLabel->{"x","(Subscript[A, approx])(x) & (Subscript[A, total])(k)"}]

The points appear to lie on the curve.

The slopes of the secant lines taken from the areaSum[ k_ ] graph above give the rate at which the total area of the rectangles accumulates with each h increment of x. Now let's calculate the slopes of the secant lines between consecutive pairs of points on the graph above and plot them.

msecant=Table[{a+k h,((areaSum[k+1]-areaSum[k])/h)},{k,0,n-1}]

p4=ListPlot[msecant,PlotStyle->{RGBColor[1,0,0],PointSize[0.02`]},AxesLabel->{"(Subscript[x, k])","(Subscript[m, secant])"}]

But this is the same thing as ((ΔA(i))/(Δx))that we calculated at the beginning of this exercise. To confirm this, we show msecant and ((ΔA(i))/(Δx)) together on the same graph.

Show[{p4,p0},AxesLabel->{"(Subscript[x, k])","((Subscript[ΔA, i])/(Δx)) & (Subscript[m, secant])"}]

It looks as though we've come full circle. In the "You Try It" exercise that follows, you explore what happens as n, the number of rectangles, goes to infinity and as h->0.

You Try It: Part I - Taking it to the Limit and Other Functions

To help you with these exercises, we copy all of the commands from Part I into a single cell, the one that follows. In each exercise, you are asked to change some of the red entries and answer the questions. (Note that we have hidden all but the input commands and put them in a command called areas, the last command in the following cell. In addition, we suppress displaying the lists of values that are generated because they become too large when n is a big number.)

1. For the function f(x)=x, considered in Part I, increase the number of rectangles, n, so that the total signed area of the rectangles approaches the total signed area under the graph of f(x). Try n=25, 50, 100, 250, 500. (For larger values of n, the evaluation of the commands will take a while because of the large number of (Subscript[ΔA, i])'s that must be added to form each value of areaSum[ k ]. There are more efficient ways to calculate these sums, and these are investigated in the module "Riemann, Trapezoids, and Simpson," included in this supplement. As n gets larger, what function is A[ x ] approaching? Also, as n gets larger, Δ x=h gets closer to 0. What is the (Underscript[lim , Δ x->0])((Subscript[ΛA, i])/(Λ x))? In the limit as n->∞ and h->0, what is the relationship between ((Subscript[ΛA, i])/(Λ x))and A[ x ]?

2. Repeat Exercise 1 for the following: f(x)=(x^2), a=-5, b=5, and fitlist ={1, x, (x^2), (x^3)}.

3. Repeat Exercise 1 for the following: f(x)=cos x, a=0, b=2π, and fitlist = {1, Cos[x], Sin[x] }.

4. Repeat Exercise 1 for the following: f(x)=(e^x), a=-1, b=1, and fitlist ={1, (E^x)}. (Note that in Mathematica, Euler's number e is represented by upper case E.)

Clear[f,ΔA,a,b,h,n];
f[x_]=x;
a=0;
b=5;
n=10;
fitlist={1,x,(x^2)};
areas;

Part II: Volumes

Note: In this exercise, Δ(Subscript[V, i]) represents the volume of the (i^th) disk, as shown in the figure above.

Our first objective is to form a function, volumeSum[ k ], that estimates the volume of the solid that is generated when the region bounded by the graph of a function f(x), the x-axis, and the vertical lines x = a and x = (Subscript[x, k])=a+k h is rotated about the x-axis. We do this by adding the (Subscript[ΔV, i])'s, the volumes of the first k disks, where k can range from 0 up to n, the number of disks of thickness h between x=a and x=b.

For the function f(x) = x, we write Δ(Subscript[V, i]), the volume of the (i^th) disk, in terms of f((Subscript[x, i])) and h, where (Subscript[x, i]) = a+i h. At first, we let a =0, b=5, and n=10.

Clear[f,ΔV,a,b,h,n];
f[x_]=x;
a=0;
b=5;
n=10;
h=(b-a)/n;
ΔV[i_]=π (((f[a+i*h]))^2)*h

The function ((ΔV(i))/(Δx)) is the rate at which the total volume of the solid accumulates with each increment of h added to x. We generate a list of the rate-of-change values for each (Subscript[x, i])=a+i h, plot the rate of change versus (Subscript[x, i]), and then assign the graph to the symbol name p0 for later reference.

rateList=Table[{a+i h,((ΔV[i])/h)},{i,0,n-1}]

p0=ListPlot[rateList,PlotStyle->{RGBColor[0,0,1],PointSize[0.0175`]},AxesLabel->{"(Subscript[x, i])","((Subscript[ΔV, i])/(Δx))"}]

You have probably noticed that, for the volume problem, the rate at which the total volume of the disks accumulates with each added increment h is π ((f((Subscript[x, i])))^2), the area of the circular end of the (i^th) disk. That is, ((ΔV(i))/(Δx))= π ((f((Subscript[x, i])))^2).

Now we form a function that calculates the left Riemann sum of the (Subscript[ΔV, i])'s for the first k disks where k can range between 0 and n.

volumeSum[k_]:=(∑_(i=0)^(k-1))ΔV[i];

We form a list of the ordered pairs, in which the first element of each ordered pair is the x-coordinate of the left side of the last disk in the sum, and the second element in each ordered pair is the volume of the first k disks.

volumelist=Table[{a+k*h,volumeSum[k]},{k,0,n}]

Let's plot the list of points and assign it to the symbol name p1 for later use.

p1=ListPlot[volumelist,PlotStyle->{RGBColor[1,0,0],PointSize[0.0175`]},AxesLabel->{"(Subscript[x, k])","(Subscript[V, total])(k)"},PlotRange->All]

The function volumeSum[ k ] appears to be a cubic polynomial, so now we use the Fit[ ] command to see if there is a cubic function that passes through the points.

(Subscript[V, approx])[x_]=Fit[volumelist,{1,x,(x^2),(x^3)},x]

Now we plot (Subscript[V, approx])[x] and the points in volumelist to show that the points do in fact lie on the graph of the cubic polynomial. First, we plot (Subscript[V, approx])[x] and then show the two graphs on the same plot.

p2=Plot[(Subscript[V, approx])[x],{x,a,a+n h},PlotRange->All,PlotStyle->{RGBColor[0,0,1]},AxesLabel->{"x","(Subscript[V, approx])(x)"}]

Show[{p2,p1},AxesLabel->{"x","(Subscript[V, approx])(x) & (Subscript[V, total])(k)"}]

The points appear to lie on the curve.

The slopes of the secant lines taken from the volumeSum[ k_ ] graph give the rate at which the total area of the rectangles accumulates with each h increment of x. Now let's calculate the slopes of the secant lines between consecutive pairs of points on the graph above and plot them.

msecants=Table[{a+k h,(1/h)(volumeSum[k+1]-volumeSum[k])},{k,0,n-1}]

p4=ListPlot[msecants,PlotStyle->{RGBColor[1,0,0],PointSize[0.0225`]},AxesLabel->{"(Subscript[x, k])","(Subscript[m, secants])"}]

But this is the same thing as ((ΔV(i))/(Δx))that we calculated at the beginning of this exercise. To confirm this, we show msecants and ((ΔV(i))/(Δx)) together on the same graph.

Show[{p4,p0},AxesLabel->{"(Subscript[x, k])","((Subscript[ΔV, i])/(Δx)) & (Subscript[m, secants])"}]

It looks as though we've come full circle again.

You Try It: Part II - Taking it to the Limit and Another Function

To help you with these exercises, we again copy all of the commands from Part II into a single cell, the one that follows. In each exercise, you are asked to change some of the red entries and answer the questions. (Note that we have hidden all but the input commands and put them in a command called volumes, the last command in the following cell. In addition, we suppress displaying the lists of values that are generated because they become too large when n is a big number.)

1. For the function f(x)=x, considered in Part II, increase n, the number of disks between x=a and x=b, so that the total volume of the disks approaches the volume of revolution. Try n=25, 50, 100, 250, 500. (For larger values of n, the evaluation of the commands will take a while because of the large number of (Subscript[ΔV, i])'s that must be added to form each value of volumeSum[ k ].) As n gets larger, what function does V[ x ] appear to be approaching? Also, as n gets larger, Δ x=h gets closer to 0. What is the (Underscript[lim , Δ x->0])((Subscript[ΛV, i])/(Λ x))? In the limit as n->∞ and h->0, what is the relationship between ((Subscript[ΛV, i])/(Λ x))and V[ x ]?

2. Repeat Exercise 1 for the following: f(x)=sin x, a=0, b=2π, and fitlist ={1,x,sin 2x,cos 2x}. Explain the stair-step pattern in the graph of V[x], and explain why we chose the functions in fitlist for the Fit[ ] command.

Clear[f,ΔV,a,b,h,n];
f[x_]=x;
a=0;
b=5;
n=10;
fitlist={1,x,(x^2),(x^3)};
volumes;

Part III: Lengths of Arc

Note: In this exercise, Δ(Subscript[L, i]) represents the length of the (i^th) line segment, as shown in the figure above.

Our first objective is to form a function, lengthSum[ k ], that estimates the length of the graph of a function, f(x) as x varies from x = a and x = (Subscript[x, k])=a+k h. We do this by adding the (Subscript[ΔL, i])'s, the lengths of the first k line segments, where k can range from 0 up to n, the number of line segments between x=a and x=b.

For the function f(x) = (x^2), we need to write Δ(Subscript[L, i]) in terms of f((Subscript[x, i])), f((Subscript[x, i])+h), and h, where (Subscript[x, i]) = a + ih. To do this, we use the Pythagorean theorem to calculate the length of the line segment that begins at the point ((Subscript[x, i]), f((Subscript[x, i]))) and ends at the point ((Subscript[x, i])+h, f((Subscript[x, i])+h)).

Δ(Subscript[L, i]) = (Sqrt[((((Subscript[Δx, i])))^2)+((((Subscript[Δy, i])))^2)])= (Sqrt[(h^2)+(((((Subscript[Δy, i])/h)))^2)(h^2)])=h(Sqrt[1+(((((Subscript[Δy, i])/h)))^2)])=h(Sqrt[1+(((((f((Subscript[x, i])+h)-f((Subscript[x, i])))/h)))^2)]).

Now let's put it into Mathematica code. We let a =-5, b=5, and n=10.

Clear[f,ΔL,a,b,h,n];
f[x_]=(x^2);
a=-5;
b=5;
n=10;
h=(b-a)/n;
ΔL[i_]=h√(1+(((((f[a+i h+h]-f[a+i h])/h)))^2))

The function ((ΔL(i))/(Δx)) is the rate at which the total length of the line segments accumulates with each increment of h added to x. We generate a list of the rate-of-change values for each (Subscript[x, i])=a+i h, plot the rate of change versus (Subscript[x, i]), and then assign the graph to the symbol name p0 for later reference.

rateList=Table[{a+i h,((ΔL[i])/h)},{i,0,n-1}]

p0=ListPlot[rateList,PlotRange->{0,Max[rateList]},PlotStyle->{RGBColor[0,0,1],PointSize[0.02`]},AxesLabel->{"(SubMinus[x])","((Subscript[ΔL, i])/(Δx))"}]

The rate at which the total length of the line segments accumulates with each added increment h is 

(Sqrt[1+(((((f((Subscript[x, i])+h)-f((Subscript[x, i])))/h)))^2)]), that is, ((ΔL(i))/(Δx))=(Sqrt[1+(((((f((Subscript[x, i])+h)-f((Subscript[x, i])))/h)))^2)]).

Now we form a function that calculates the left Riemann sum of the (Subscript[ΔL, i])'s for the first k line segments where k can range between 0 and n.

lengthSum[k_]:=(∑_(i=0)^(k-1))ΔL[i];

We form a list of the ordered pairs, in which the first element of each ordered pair is the x-coordinate of the left side of the last line segment in the sum, and the second element in each ordered pair is the length of the first k line segments.

lengthlist=Table[{a+k*h,lengthSum[k]},{k,0,n}]

Let's plot the list of points and assign it to the symbol name p1 for later use.

p1=ListPlot[lengthlist,PlotStyle->{RGBColor[1,0,0],PointSize[0.0175`]},AxesLabel->{"(Subscript[x, k])","(Subscript[L, total])(k)"},PlotRange->All]

For comparison, we calculate the exact arc-length function, (Subscript[L, exact])(x), by integrating ((d L)/(d u))=(Sqrt[1+((f'(u))^2)]) from u=a, to u=x.

(Subscript[L, exact])[x_]=Assuming[x∈Reals,(∫_a^x)(Sqrt[1+((f'[u])^2)])\[DifferentialD]u]

Now let's plot the function and then show the lengthSum[ k ] points and the function on the same graph.

p2=Plot[(Subscript[L, exact])[x],{x,a,a+n h},PlotStyle->{RGBColor[0,0,1]},PlotRange->All,AxesLabel->{"x","L[x]"}]

Show[p1,p2,AxesLabel->{"x","(Subscript[L, exact])(x) & (Subscript[L, total])(k)"}]

The slopes of the secant lines taken from the lengthSum[ k_ ] graph give the rate at which the total length of the straight-line segments accumulates with each h increment of x. Now let's calculate the slopes of the secant lines between consecutive pairs of points on the graph above and plot them.

msecants=Table[{a+k h,(1/h)(lengthSum[k+1]-lengthSum[k])},{k,0,n-1}]

p4=ListPlot[msecants,PlotRange->{0,Max[msecants]},PlotStyle->{RGBColor[1,0,0],PointSize[0.0225`]},AxesLabel->{"(Subscript[x, k])","(Subscript[m, secants])"}]

But this is the same thing as ((ΔL(i))/(Δx))that we calculated at the beginning of this exercise. To confirm this, we show msecants and ((ΔL(i))/(Δx)) together on the same graph.

Show[{p4,p0},AxesLabel->{"(Subscript[x, k])","((Subscript[ΔL, i])/(Δx)) & (Subscript[m, secants])"}]

Yet again, it looks as though we've come full circle.

You Try It: Part III - Taking it to the Limit and Another Function

To help you with these exercises, we again copy all of the commands from Part III into a single cell, the one that follows. In each exercise, you are asked to change some of the red entries and answer the questions. (Note that we have hidden all but the input commands and put them in a command called lengths, the last command in the following cell. In addition, we suppress displaying the lists of values that are generated because they become too large when n is a big number.)

1. For the function f(x)=(x^2), considered in Part III, increase n, the number of straight-line segments between x=a and x=b, so that the total length of the line segments approaches the length of the graph of f(x) for a≤x≤b. Try n=25, 50, 100, 250, 500. (For larger values of n, the evaluation of the commands will take a while because of the large number of (Subscript[ΔL, i])'s that must be added to form each value of lengthSum[ k ].)  What is the (Underscript[lim , Δ x->0])((Subscript[ΛL, i])/(Λ x))? In the limit as n->∞ and h->0, what is the relationship between ((Subscript[ΛL, i])/(Λ x))and (Subscript[L, exact])[ x ]?

2. Repeat Exercise 1 for the following: f(x)=5sin (2x), a=0, b=π. In addition, explain the stair-step pattern in the graph of (Subscript[L, exact])[x]. Under what conditions does the accumulated length of the straight-line segments increase the slowest with each increment h added to x, and under what conditions does it increase most rapidly?

Clear[f,ΔL,a,b,h,n];
f[x_]=(x^2);
a=-5;
b=5;
n=10;
lengths;

You probably noticed that the arc length integrals for the function f(x)=5sin(2x) are not elementary, giving EllipticE[ ] functions. Unlike most of the area and volume integrals that we consider in beginning calculus, the arc length integrals for elementary functions can easily give rise to non-elementary integrals.