660 days ago by pub

We are exploring arc length. We want to understand what is happening. (We do NOT care whether we can integrate symbollically! Any program will integrate for us.)

var ('t') #Define a 3d curve s (parametrically) and an interval for t s=vector((2*cos(t)^2,3*sin(t),2*t)) t1=0; t2=4*pi 

Remember that a curve in 3d can ONLY be defined parametrically!

#Let's plot C xmin=-3; xmax=3; ymin=-3; ymax=3; zmin=0; zmax=30 C=parametric_plot(s,(t,t1,t2),color='orange',thickness=6, opacity=.7) #Let's add a reference var ('x y z') px0y= implicit_plot3d(z==0,(x,xmin,xmax),(y,ymin,ymax),(z,zmin,zmax), color='grey', opacity=0.3) Ax=line3d(([xmin,0,0],[xmax,0,0]), thickness=2, color='red') Ay=line3d(([0,ymin,0],[0,ymax,0]), thickness=2, color='blue') Az=line3d(([0,0,zmin],[0,0,zmax]), thickness=2, color='green') show(C+px0y+Ax+Ay+Az, aspect_ratio=[3,3,1]) 

Look at the curve above and estimate a minimum and maximum value for its length L.

Arc Length of a Curve given parametrically $C=s$: $\lt x(t),\, y(t),\, z(t) \gt $ for $t \in [t1,t2]$  is  $$L= \int_C \,ds =\int_{t1}^{t2} \, \sqrt{{\dot{x}}^2 + {\dot{y}}^2+ {\dot{z}}^2 } \, dt$$

ds=diff(s,t) view(ds) 
\newcommand{\Bold}[1]{\mathbf{#1}}\left(-4 \, \sin\left(t\right) \cos\left(t\right),\,3 \, \cos\left(t\right),\,2\right)
\newcommand{\Bold}[1]{\mathbf{#1}}\left(-4 \, \sin\left(t\right) \cos\left(t\right),\,3 \, \cos\left(t\right),\,2\right)
Lexact=integral(norm(ds),(t,t1,t2)) n(Lexact) 

So the arc length of this weirdo curve using the formula (which we are calling our "exact" result even though it is being calculated numerically) is $L=40.03$

Let us approximate this length by finding tangent line segments at regularly spaced values of t along the curve.

This algorithm is exactly the same as for parametric curves in 2d!

  • We decide how many steps.
  • The program calculates the stepsize of t.
  • We draw points on the curve regularly spaced with repect to stepsize. They are the points: (s(j))
steps=4 stepsize=(t2-t1)/steps points=sum([point3d(s(t=j), color='purple', size=10) for j in [t1..t2-stepsize,step=stepsize]]) show(C+points, aspect_ratio=[3,3,1]) 

We draw pieces of tangent line segments starting at these points.

  • Start point is s(j)
  • Slope is value of the derivative vector ds(j). 
  • Length is $ \left\| {ds} \right\| \cdot $ stepsize = $\sqrt{{\dot{x}}^2 + {\dot{y}}^2 + {\dot{z}}^2} \cdot $ stepsize.

So parametrically these line segments are: s(j)+λ·ds(j) for λ=[0, stepsize].

pieces=sum([line3d([(s(t=j)),(s(t=j)+ds(t=j)*stepsize)],thickness=4,color='purple') for j in [t1..t2-stepsize,step=stepsize]]) show(C+pieces+points, aspect_ratio=[7,1,1]) 

We sum the length of these pieces.

Lapprox=sum([norm(ds(t=j))*stepsize for j in [t1..t2-stepsize,step=stepsize]]) n(Lapprox) 

So the approximate arc length of this weirdo curve using 4 tangent pieces is: $L_4 =45.31$.

We calculate our error.

error=abs((Lexact-Lapprox)/Lexact) n(error) 

Our error is $\approx 13$%.

Let us try more or less step sizes - change the value of steps2 and revaluate.

steps2=16 stepsize2=(t2-t1)/steps2 points2=sum([point3d(s(t=j), color='purple', size=10) for j in [t1..t2-stepsize2,step=stepsize2]]) pieces2=sum([line3d([(s(t=j)),(s(t=j)+ds(t=j)*stepsize2)],thickness=4,color='purple') for j in [t1..t2-stepsize2,step=stepsize2]]) show(C+pieces2+points2, aspect_ratio=[3,3,1]) 

We sum the length of these pieces.

Lapprox2=sum([norm(ds(t=j))*stepsize2 for j in [t1..t2-stepsize2,step=stepsize2]]) n(Lapprox2) 

So the approximate arc length of this weirdo curve using 16 tangent pieces is: $L_4 =39.82$.

We calculate our new error.

error2=abs((Lexact-Lapprox2)/Lexact) n(error2) 

Our error is now $\approx 0.5$%.