Arclength

Dr. Therese Shelton
Southwestern University
Georgetown, TX

Caution:  remember that you may have to tweak some things if you change functions or windows.

Set-up

Remember, the curve should be a simple smooth path.

Clear[x,y,tmin,tmax, xmin,xmax,ymin,ymax];
x[t_]:=Cos[t];
 y[t_]:=Sin[t];
tmin=0; tmax=2 π;
xmin = -1.25; xmax=1.25;
ymin=-1.25;  ymax=1.25;

Clear[colorr,colors,colr,cols]

colorr=RGBColor[1.,0.,0.]; 
colors=RGBColor[0.,0.,1.];

colr="red";
cols="blue";

Clear[plotAll];
plotAll =ParametricPlot[     {x[t],y[t]},           {t,tmin,tmax},
 PlotRange->{    {xmin,xmax},{ymin,ymax}    }  ,
AspectRatio->Automatic,PlotStyle->{colorr}   ]

arclength

arclength = (∫_tmin^tmax)(Sqrt[(((x'[u]))^2) + (((y'[u]))^2)])\[DifferentialD]u

N[%]

gross approximation

Clear[numberIntervals,deltat];

numberIntervals = 4;

deltat=(tmax-tmin)/numberIntervals

Clear[total,plist,u1,u2];
total=0.
plist={{x[tmin],y[tmin]}}
For[ i=1, i ≤numberIntervals, i++,
u1 = tmin + (i-1) * deltat;
u2 = tmin + i * deltat;
total = total+ (Sqrt[(((x[u2]-x[u1]))^2) + (((y[u2]-y[u1]))^2)]);
AppendTo[plist, {x[u2], y[u2]}];
Print["i = ", i, "  u2 = ", u2, "  total= ",total, "    plist:  ",N[plist]]
      ];
total

N[plist]

p1=ListPlot[plist,Joined->True,PlotStyle->{colors}]

Show[p1,plotAll,AspectRatio->Automatic]

better approximation

Clear[numberIntervals,deltat];

numberIntervals = 10;

deltat=(tmax-tmin)/numberIntervals
Clear[total,plist,u1,u2];
total=0.;
plist={{x[tmin],y[tmin]}};
For[ i=1, i ≤numberIntervals, i++,
u1 = tmin + (i-1) * deltat;
u2 = tmin + i * deltat;
total = total+ (Sqrt[(((x[u2]-x[u1]))^2) + (((y[u2]-y[u1]))^2)]);
AppendTo[plist, {x[u2], y[u2]}];
      ];
total

N[plist]

p1=ListPlot[plist,Joined->True,PlotStyle->{colors}]

Show[p1,plotAll,AspectRatio->Automatic]

very good approximation

Clear[numberIntervals,deltat];

numberIntervals = 20;

deltat=(tmax-tmin)/numberIntervals
Clear[total,plist,u1,u2];
total=0.;
plist={{x[tmin],y[tmin]}};
For[ i=1, i ≤numberIntervals, i++,
u1 = tmin + (i-1) * deltat;
u2 = tmin + i * deltat;
total = total+ (Sqrt[(((x[u2]-x[u1]))^2) + (((y[u2]-y[u1]))^2)]);
AppendTo[plist, {x[u2], y[u2]}];
      ];
total

N[plist]

p1=ListPlot[plist,Joined->True,PlotStyle->{colors}]

Show[p1,plotAll,AspectRatio->Automatic]