Arc Length
of
Curves

by
K. D.  Stroyan
University of Iowa

copyright 1997 by Academic Press, Inc. - All rights reserved.

Special Mathematica Functions used in this NoteBook

arcLength package

Off[General::spell1];
BeginPackage["ArcLength`"];

arcLength::usage = "arcLength[f, n, {a, b}] approximates the arc length
of the curve represented by the function f in the interval from a to b
by dividing the curve into n line segments.";

Begin["`Private`"];
Needs["Graphics`Colors`"];
makeLines[ f_, x_, n_ ] := Table[ Line[{{x[i], f[ x[i] ]},
	{x[i+1], f[ x[i+1] ]}}], {i, 0, n-1} ] 
	
distance[ {a_, b_}, {c_, d_} ] :=
	Sqrt[ (a - c)^2 + (d - b)^2 ]

arcLength[ f_, n_, {a_, b_} ] :=
Module[ {dx, x, i, partition, arcapprox,curve},
	dx = N[(b - a) / n] ;
	Do[x[i] = a + i dx
		,{i, 0, n} 
		] ;
	partition = makeLines[ f, x, n ] ;
	arcapprox = N[ Sum[ distance[ {x[i], f[ x[i] ]},
			{x[i+1], f[ x[i+1] ]} ], {i, 0, n-1} ], 10 ] ;
	curve = Plot[ f[x], {x, a, b},PlotStyle -> {Red},
	AxesStyle -> partition,DisplayFunction->Identity ];
Show[{Graphics[{AbsoluteThickness[2],Brown,partition}],curve},Axes->Automatic,DisplayFunction->$DisplayFunction];
Print[ "Length of Line Segments = ", arcapprox ] ; 
	];

End[];

EndPackage[] ;

wrongApprox package

BeginPackage["wrongApprox`"];

wrongApprox::usage = "wrongApprox[f, n, {a, b}] approximates the arc length of the curve represented by the function f in the interval from a to b
by (incorrectly) dividing the curve into n horizontal line segments.";

Begin["`Private`"];
Needs["Graphics`Colors`"];

makeLines[ f_, x_, n_ ] := Table[ Line[{{x[i], f[ x[i] ]},
	{x[i+1], f[ x[i] ]}}], {i, 0, n-1} ];
makeGuides[ f_, x_, n_ ] := Table[ Line[{{x[i], 0},{x[i], f[ x[i] ]},
	{x[i+1], f[ x[i] ]},{x[i+1], 0}}], {i, 0, n-1} ];
	
distance[ {a_, b_}, {c_, d_} ] :=
	Sqrt[ (a - c)^2 + (d - b)^2 ];

wrongApprox[ f_, n_, {a_, b_} ] :=
Module[ {dx, x, i, partition, guides,curve},
	dx = N[(b - a) / n] ;
	Do[x[i] = a + i dx
		,{i, 0, n} ] ;
	partition = makeLines[ f, x, n ] ;
	guides = makeGuides[f,x,n];
	curve = Plot[ f[x], {x, a, b},PlotStyle -> {Red},
	AxesStyle -> partition,DisplayFunction->Identity ];
Show[{Graphics[{AbsoluteThickness[4],DarkGreen,partition}],Graphics[{AbsoluteThickness[1],Blue,guides}],curve},Axes->Automatic,DisplayFunction->$DisplayFunction];

Print["Slide the THICK Green segments along the thin blue guides to the x-axis.  How does this show that the total length of THICK Green line segments is b - a ≈ ", N[b-a ]] ; 
	];
	
End[];

EndPackage[] ;

Notebook Overview

The approximation to the length of a curve by sloping line segments that connenct (x, f[x]) and (x + dx, f[x + dx]) produces a good appproximation. These segments are drawn by arcLength[.] package.  The way you `slice' sometimes matters. `Slices' that just run horizontally out from the slice points do not approximate the length, try the wrongApprox[.] package. The horizontal slices are a good approximation to the area, but not to the length.

The commands are
  
            arcLength[f, n, {a,b}]   and  wrongApprox[f, n, {a,b}] ,     
     
where n is the number slices along  the x-axis, and a and b are the limits.

References to the Text

This NoteBook goes with Chapter 12 & 14 of the text.

Step-by-step

Clear[x, f]; f[x_] := Sin[x]; {a, b} = {-π, π}; arcLength[f, 8, {a, b}]

{a, b} = {-π, π}; wrongApprox[f, 20, {a, b}]

Practice Exercises

Try the arcLength[.] function and the wrongApprox[.] function on the curve  y = x from  x = 0 to x = 1.  What is the exact length of this straight line?

Exercises

Problem 14.1

Show that the approximate length of a curve  y = f[x]  can be computed with

(∑_({{x = a}, {Δ x = dx}})^(b - dx))(Sqrt[(dx^2) + (((f[x + dx] - f[x]))^2)])

which is approximately

(∑_({{x = a}, {Δ x = dx}})^(b - dx))(Sqrt[1+((f'[x])^2)]) dx

and tends to

(∫_a^b)(Sqrt[1+((f'[x])^2)])dx

Test this on the curve  y = Sin[x]  by summing each formula with small values of dx and by computing the value of the integral.  Compare your answer to the one from the package above.

Exercise 14.1.3

Find the expression for the incorrect "approximation" to the length given by horizontal slices and sum your expression for various sizes of dx.  The value should not depend on how small you make dx.  What is wrong with this "approximation"?

Problem 14.11

Find a parametric formula for the arclength of the ellipse

x = 3 Cos[ t]
	y = 2 Sin[ t ]

A small piece of the curve has length

(Sqrt[(((x[t + dt] - x[t]))^2) + (((y[t + dt] - y[t]))^2)])

and the increment approximation says

x[t+dt]-x[t] = x'[t] dt + (Subscript[ϵ, 1]) dt
	y[t+dt]-y[t] = y'[t] dt + (Subscript[ϵ, 2]) dt

where (Subscript[ϵ, 1]) and  (Subscript[ϵ, 2])  are small when  dt is small, so the elngth of the segment above is

(Sqrt[((x'[t])^2)+((y'[t])^2)]) dt+(Subscript[ϵ, 3]) dt

with  (Subscript[ϵ, 3]) small.

Use this to find an integral expression for the length of the form:

Length = NIntegrate[ f[t] dt , {t,-Pi, Pi}]