L8-LineInt.mws

Calculus IV with Maple
Copyright 2002, Dr. Jack Wagner
j.wagner@intelligentsearch.com


Lesson 8: Arc Length and Line Integrals

For curves   h(t) = [x(t), y(t), z(t)] , we approximate the arc length by the sum of the lengths of a sequence of chords.

We want to add the lengths of the chords as an estimate of arc length, for any arbitrary number, n, of chords.  By increasing the number of chords we refine the estimate of length.  The arc length is defined as the limit of this sum as n goes to infinity.  When this limit exists, the curve is rectifiable. A necessary and sufficient condition for a curve to be rectifiable is that it be continuously differentiable.

   

Example 8.1

 

Let   h(t) = [t*cos(t), t*sin(t), t] , and find its arc length between t=1 and t=2.5.  

>    restart: with(plots): with(LinearAlgebra): with(VectorCalculus):

>    h := <t*cos(t), t*sin(t), t>;

h := Vector(%id = 2900168)

>    P1 := spacecurve(evalm(h), t=1..2.5, color=black, thickness=1):

Define the chords

>    pts := [seq(evalm(subs(t=k/2, h)), k=2..5)]:  

Plot the chords

>    P2 := pointplot3d(pts, connect=true, color=red):    

>    display(P1, P2, axes=framed);

[Maple Plot]

Now compute the sum of the lengths of p chords.

>    L := p->sum(Norm(eval(h, t=1+(3/(2*p))*(k+1))-eval(h, t=1+(3/(2*p))*k), 2), k=0..p-1):

>    L(p);

sum((abs((3/2/p*(k+1)+1)*cos(3/2/p*(k+1)+1)-(3/2/p*k+1)*cos(3/2/p*k+1))^2+abs((3/2/p*(k+1)+1)*sin(3/2/p*(k+1)+1)-(3/2/p*k+1)*sin(3/2/p*k+1))^2+abs(3/2/p*(k+1)-3/2/p*k)^2)^(1/2),k = 0 .. p-1)
sum((abs((3/2/p*(k+1)+1)*cos(3/2/p*(k+1)+1)-(3/2/p*k+1)*cos(3/2/p*k+1))^2+abs((3/2/p*(k+1)+1)*sin(3/2/p*(k+1)+1)-(3/2/p*k+1)*sin(3/2/p*k+1))^2+abs(3/2/p*(k+1)-3/2/p*k)^2)^(1/2),k = 0 .. p-1)

An approximation of the arc length of the curve

>    evalf(  Limit(L(q), q=infinity) );

3.400526357

For a curve parameterized by t, h(t) = [x(t), y(t), z(t)]  , the arc length from t=a to t=b is:

s = int((diff(x(t),t)^2, diff(y(t),t)^2, diff(z(t),t)^2)^(1/2),t = a .. b)     =     Int(sqrt(diff(h(t),t)*diff(h(t),t)),t = a .. b)     

>    dh[t] := diff(h, t);

dh[t] := Vector(%id = 20577020)

>    ds := Norm(dh[t], 2);

ds := (1+abs(-cos(t)+t*sin(t))^2+abs(sin(t)+t*cos(t))^2)^(1/2)

Simplify the expression for ds.

>    ds := simplify( ds ) assuming real;

ds := (2+t^2)^(1/2)

The exact arc length using integration

>    int(ds, t=1..5/2);

5/8*33^(1/2)-ln(2)+ln(5*2^(1/2)+2^(1/2)*33^(1/2))-1/2*3^(1/2)-ln(2^(1/2)+2^(1/2)*3^(1/2))

Numeric approximation of the above

>    evalf(%);

3.400526356

Example 8.2

   

Find the length of the curve   h(t) = [-t^2+3*t, sin(t), t^3]  ,  from t=1 to t=7.

>    restart: with(plots): with(LinearAlgebra): with(VectorCalculus):

>    h := <-t^2+3*t, sin(t), t^3>;

h := Vector(%id = 27267012)

>    spacecurve(evalm(h), t=1..7, axes=framed, labels=[x, y, z], color=red);

[Maple Plot]

>    df := diff(h, t);

df := Vector(%id = 23022532)

>    ds := Norm(df, 2);

ds := (abs(2*t-3)^2+abs(cos(t))^2+9*abs(t)^4)^(1/2)

>    ds := simplify( ds ) assuming real;

ds := (4*t^2-12*t+9+cos(t)^2+9*t^4)^(1/2)

This integral cannot be evaluated in closed form, so Maple simply echoes it back.

>    int(ds, t=1..7);

int((4*t^2-12*t+9+cos(t)^2+9*t^4)^(1/2),t = 1 .. 7)

But we can approximate it numerically.

>    evalf(%);

343.4335705

Line Integrals

If a particle is moving along the curve, h(t) = [x(t), y(t), z(t)]  , under the influence of a force F, now much work will be done as the particle moves from point a to point b, say from t=a to t=b ?

Example 8.3

Returning to Example 1, Let h(t) = [t*cos(t), t*sin(t), t]    , compute the work done by a force in the z direction F = -ln(z) .  First look at the tangents to the curve.

>    restart: with(plots): with(LinearAlgebra): with(VectorCalculus):

>    h := <t*cos(t), t*sin(t), t>;

h := Vector(%id = 2574948)

>    dh[t] := diff(h, t);

dh[t] := Vector(%id = 2575148)

>    dh[s] := simplify( dh[t]/Norm(dh[t], 2) ) assuming real;

dh[s] := Vector(%id = 19350328)

>    for k to 25 do
  T||k := evalm(subs(t=k/10, h)+s*subs(t=k/10, dh[s]))
end do:  

Note the use of the concatenation operator, "||",   to label the tangents.

>    S1 := spacecurve(evalm(h), t=1..2.5, color=black, thickness=2):

>    S2 := seq(spacecurve(eval(T||k), s=0..1, color=red), k=10..25):

>    display(S1, S2, axes=framed, labels=[x, y, z]);

[Maple Plot]

The tangents point upward in the direction of increasing t.

Now we define the force vector and evaluate it on the curve.  In the present case the vector expression for F is F=[0, 0, -ln(z)].  

>    F := <0, 0, -ln(z)>;

F := Vector(%id = 22125112)

>    Fh := subs({x=h[1], y=h[2], z=h[3]}, F);

Fh := Vector(%id = 21853128)

At each point where we have drawn a tangent we would like to see a vector representing the applied force.

>    for k to 25 do
  F||k := evalm(subs(t=k/10, h)+s*subs(t=k/10, Fh))
end do:

Note that for s=0 each Fk is a point on the curve; for s=1 each Fk is the tip of the vector representing F.

>    S3 := seq(spacecurve(eval(F||k), s=0..1, color=blue), k=10..25):

>    display(S1, S2, S3, axes=framed, labels=[x, y, z]);

[Maple Plot]

The component of the force in the direction of the tangent is easily found and visualized.

>    k := 'k':

>    FT := subs(t=k/10, dh[s]).subs(t=k/10, Fh);

FT := -1/(2+1/100*k^2)^(1/2)*ln(1/10*k)

>    for k to 25 do
  v||k := subs(t=k/10, h) + s*subs(t=k/10, dh[s])*FT;
end do:

The parameter range s=0..4 multiplies the length of the force vectors by 4 for ease of visibility.

>    S4 := seq(spacecurve(evalm(v||k), s=0..4, color=magenta), k=10..25):

>    display(S1, S4, axes=framed);

[Maple Plot]

The components of force in the direction of the tangents point downward along the curve.

The line integral, Int(f,s)   integrates the magnitude of the force in the direction of the tangent vectors over the length of the curve.  To visualize this we must straighten out the curve and lay it down on the x axis, relabel the the x axis as the s axis,  and erect perpendiculars the height of the force magnitude at points along the curve, corresponding to equidistant values of t, along the new s axis. In effect we graphically reparameterize F[T]  as a function of  s.

First, we compute the arc length from t=1 to points from 1 to 2.5 in steps of  0.1.

>    ds[t] := simplify( Norm(dh[t], 2) ) assuming real;

ds[t] := (2+t^2)^(1/2)

>    s := k->evalf(int(ds[t], t=1..k/10)):

We need coordinate points along the s axis corresponding to these distances with t=1 as the zero point.

>    S1 := seq([s(k), 0], k=10..25);

S1 := [0., 0], [.176154400, 0], [.358445423, 0], [.547203678, 0], [.742726979, 0], [.945283300, 0], [1.155113675, 0], [1.372434935, 0], [1.597442251, 0], [1.830311472, 0], [2.071201226, 0], [2.32025480...
S1 := [0., 0], [.176154400, 0], [.358445423, 0], [.547203678, 0], [.742726979, 0], [.945283300, 0], [1.155113675, 0], [1.372434935, 0], [1.597442251, 0], [1.830311472, 0], [2.071201226, 0], [2.32025480...

Now we need a sequence of points with these same distances as the  abscissa  and the magnitude of force as the ordinate.

>    S2 := [seq([s(k), evalf(subs(k=k, FT))], k=10..25)];

S2 := [[0., 0.], [.176154400, -.5319695487e-1], [.358445423, -.9830119546e-1], [.547203678, -.1365813806], [.742726979, -.1690836608], [.945283300, -.1966794669], [1.155113675, -.2200993652], [1.372434...
S2 := [[0., 0.], [.176154400, -.5319695487e-1], [.358445423, -.9830119546e-1], [.547203678, -.1365813806], [.742726979, -.1690836608], [.945283300, -.1966794669], [1.155113675, -.2200993652], [1.372434...
S2 := [[0., 0.], [.176154400, -.5319695487e-1], [.358445423, -.9830119546e-1], [.547203678, -.1365813806], [.742726979, -.1690836608], [.945283300, -.1966794669], [1.155113675, -.2200993652], [1.372434...
S2 := [[0., 0.], [.176154400, -.5319695487e-1], [.358445423, -.9830119546e-1], [.547203678, -.1365813806], [.742726979, -.1690836608], [.945283300, -.1966794669], [1.155113675, -.2200993652], [1.372434...

The peculiar syntax "k=k" works because Maple reads the right side of the equation first.  P1 is a sequence of plot structures each of which connects corresponding points in the two sets.

>    P1 := seq(pointplot([S1[j], S2[j]], color=red, connect=true), j=1..16):

P2 is a plot structure connecting the points representing the force magnitudes.

>    P2 := pointplot(S2, connect=true, color=red, thickness=2, labels=[s, 'Force']):

>    display(P1, P2);

[Maple Plot]

fit

>    with(stats):

>    xvals := [seq(S2[k, 1], k=1..16)];

xvals := [0., .176154400, .358445423, .547203678, .742726979, .945283300, 1.155113675, 1.372434935, 1.597442251, 1.830311472, 2.071201226, 2.320254808, 2.577601884, 2.843359969, 3.117635773, 3.40052635...
xvals := [0., .176154400, .358445423, .547203678, .742726979, .945283300, 1.155113675, 1.372434935, 1.597442251, 1.830311472, 2.071201226, 2.320254808, 2.577601884, 2.843359969, 3.117635773, 3.40052635...

>    yvals := [seq(S2[k, 2], k=1..16)];

yvals := [0., -.5319695487e-1, -.9830119546e-1, -.1365813806, -.1690836608, -.1966794669, -.2200993652, -.2399583898, -.2567757967, -.2709909231, -.2829761516, -.2930476320, -.3014742066, -.3084848602,...
yvals := [0., -.5319695487e-1, -.9830119546e-1, -.1365813806, -.1690836608, -.1966794669, -.2200993652, -.2399583898, -.2567757967, -.2709909231, -.2829761516, -.2930476320, -.3014742066, -.3084848602,...

After two trials, starting with third degree polynomials, we find that the following result produces the plot below.

>    eq := fit[leastsquare[[s, y], y=mm*s^4+nn*s^3+pp*s^2+qq*s+rr, {mm, nn, pp
, qq, rr}]]([xvals, yvals]);

eq := y = .3445362863e-2*s^4-.3510680370e-1*s^3+.1451507484*s^2-.3164412625*s-.1012667338e-2

Values of s  corresponding to t=1 and 2.5

>    x1 := s(10); x2 := s(25);   

x1 := 0.

x2 := 3.400526356

>    P3 := plot(rhs(eq), s=x1..x2, color=blue, thickness=3):

>    display(P1, P2, P3);

[Maple Plot]

The polynomial is visually indistinguishable from the original plot. Actually, the third degree polynomial was almost as good.  Integration of the polynomial yields:

>    int(rhs(eq), s=x1..x2);

-.7907519111

How about the real thing?  The line integral is easily found; in this case with the formula    W = Int(F[T]*Diff(C(t),t),t = a .. b) .

>    int(Fh.dh[t], t=1..2.5);

-.7907268297

Considering the number of calculations involved and the inevitable loss of accuracy due to rounding etc. this is good agreement.  The negative sign indicates that the particle must do work in moving up the curve against the resistance of the force.

Example  8.4

Integrate the function,   h(t) = exp(-.1*t)  over the path described by s(t) = [t, t^2, t]   between t = 0  and t = 10 .

>    restart:with(plots): with(LinearAlgebra): with(VectorCalculus):

>    f := <t, t^2, t>;                                     

f := Vector(%id = 19590508)

>    spacecurve(evalm(f), t=0..10, axes=framed, labels=[x, y, z], color=red);

[Maple Plot]

>    df := diff(f, t);

df := Vector(%id = 17465228)

>    ds := Norm(df, 2);

ds := (2+4*abs(t)^2)^(1/2)

>    h := exp(-.1*t);

h := exp(-.1*t)

>    Int(h*ds, t=0..10);

Int(exp(-.1*t)*(2+4*abs(t)^2)^(1/2),t = 0 .. 10)

>    evalf(%);

54.39345305

Practice

1. For each of the following, plot the curve and find its length over the range indicated.

2. For each of the following repeat the exercise of the text; i.e. plot the curve and its unit tangents, together with the "force vectors".  Then plot the curve with the "force vector" components in the direction of the unit tangents.  Finally, find the line integral of the given force function along the curve over the given range.

3. For each of the problems in #2,  graphically reparameterize the "force vector" as a function of s. Now approximate the force function with a polynomial, and integrate the polynomial over s to obtain an approximation to the answer.  Check
with the results found in #2.