Differential Properties of Curves

Two examples of closed curves:

Here are two vectors with components given in terms of the parameter t:

PrettyFlower[t_] := ((1/4)  + (3/4) Cos[3  t]){ Cos[t]^3, Sin[t]^3, Sin[t] Cos[t]^2}

Both of these functions define a list of 3 positions along each axis in terms of a single parameter

Bendy[t_ ]  :=  { Cos[t],  Sin[t],  Sin[t] Cos[t]}

Defining Functions to Display Them

showcurve[VecFunc_  , tl_ ]  :=  
      ParametricPlot3D[Evaluate[VecFunc[tval]], {tval, 0, tl}, 
        Compiled -> False,  
DisplayFunction -> 
          Identity, 
        PlotRange -> {{-1, 1}, {-1, 1}, {-1, 1}}, 
        BoxRatios -> {1, 1, 1}]

showline[VecFunc_ , tl_ ]  :=  
      Graphics3D[{Thickness[0.01], Hue[1], 
          Line[{{0, 0, 0}, VecFunc[tl]}]}]

showcurveline[VecFunc_ ,  tl_ ]  :=  
      Show[{showcurve[VecFunc, tl], showline[VecFunc, tl]}, 
        DisplayFunction -> $DisplayFunction]

CurveLineSequence[VecFunc_ ]  := 
      Table[showcurveline[VecFunc, i], {i,  .1, 3 Pi,  .1}]

Animating the Curves with Their Parameter

The following command produces a sequence of 3D graphics objects that can be animated.  To animate: Select all the graphics objects that are output; use the "Cell" menu to access "Cell Grouping" and select "Open/Close Group" (this will collapse the output to a single plot and make your notebook less cluttered); then use the "Cell" menu again and select "Animate Selected Graphics."

CurveLineSequence[PrettyFlower];

Do the same thing for a different parameterized vector function:

CurveLineSequence[Bendy];

Example of a parameritized surface

FlowerPot[u_,  v_] :={(3  +  Cos[v]) Cos[u],Sin[u]  +  (3  +  Cos[v]) Sin[u], (3/2  +  Cos[u + v]) Sin[v]}

<< Graphics`ParametricPlot3D`

Flowerplot  =  
      ParametricPlot3D[FlowerPot[u, v], {u, 0, 2 Pi}, {v, 0, 2 Pi}, 
        ViewPoint -> {0.141,  1.653,  1.117}, 
        PlotPoints -> {120, 40}]

A Curve on a parameritized surface

Vines[t_] := 1.025*FlowerPot[t Cos[t],-t^2 Sin[ t]]
vineplot  = 
      ParametricPlot3D[Vines[t], {t, 0,  2 Pi}, 
        ViewPoint -> {0.141,  1.653,  1.117}, 
        PlotPoints -> 500]

In the above, I want to put the vine outside the surface so I scale it out a little bit...

thickvineplot  =  
      Show[{Graphics3D[Thickness[0.02]], Graphics3D[Hue[0.333, 0.5, 0.5]], 
          vineplot}]

Show[thickvineplot, Flowerplot]

Show[Flowerplot, thickvineplot]

Calculating Arc Length and Re-parameterizing

Here is a general way to take a function of a general parameter, t, and compute the arc length traversed as t varies from one value to another:

dFlowerDt  =  D[Flower[t], t]

This is the arclength up to the parameter t

sFlower  = Integrate[Sqrt[dFlowerDt . dFlowerDt], t]

\(In\ other\ words, \ 
    ds\^2 = \ \ \ \ dx\^2\ \ \  + \ \ \ \ dy\^2\ \ \ \  + \ \ \ \ \ dz\^2\ \ \ so\ integrating\ the\ square\ root\ of\ this\ is\ the\ arclength\)

Applying this to the function Bendy defined above:

dBendyDt  =  D[Bendy[t], t]

sBendy  = Integrate[Sqrt[dBendyDt . dBendyDt], t]

The arc length in this case is given by a tabulated  function called an elliptic integral and after checking its behavior at t = 0 we can plot it over the range {t,0,2π}:

sBendy /. t -> 0

Plot[sBendy, {t, 0, 2  Pi}]

Alternatively, we can evaluate the expression for arc length numberically using the following:

Plot[
      Evaluate[NIntegrate[Sqrt[dBendyDt . dBendyDt], {t, 0, uplim}]], {uplim, 
        0, 6.4}]

Multivariable Calculus: Mathematica Review

AScalarFunction is defined everywhere in (x,y,z)

AScalarFunction[x_ ,  y_ ,  z_]  :=  
      SomeFunction[x, y, z]

AScalarFunction[x, y, z]

The following lines print and they define expressions.

Print["derivative w/r to first argument is " ];   dFuncX  =  
      D[AScalarFunction[x, y, z], x]
Print["derivative w/r to second argument is " ];   dFuncY  =  
      D[AScalarFunction[x, y, z], y]
Print["derivative w/r to third argument is " ];   dFuncZ  =  
      D[AScalarFunction[x, y, z], z]

In the output lines above, partial derivatives are denoted by superscripts: e.g., (1,0,0) indicates the first partial derivative with respect to the first variable, x. The second partial with respect to y and z would be denoted by a superscript (0,1,1).

x(w,v), y(w,v), z(w,v) is a restriction of all space to a surface parameterized by (w,v), 
AScalarFunction is now defined on the surface as a function of (w,v)

AScalarFunction[x[w, v],  y[w, v],  z[w, v]]

Because it is now a function of w and v, the derivative with respect to x will vanish:

D[AScalarFunction[x[w, v], y[w, v], z[w, v]], x]

Two more flavors of derivatives, these are partial derivatives evaluated on the surface

dFuncW  =  
      D[AScalarFunction[x[w, v],  y[w, v],  z[w, v]], w]

dFuncV  =  
      D[AScalarFunction[x[w, v],  y[w, v],  z[w, v]], v]

On the surface x(w,v), y(w,v), z(w,v), we can prescribe a curve w(t), v(t), now we have
AScalarFunction defined on that curve

AScalarFunction[x[w[t], v[t]],  y[w[t], v[t]],  
      z[w[t], v[t]]]

The following is a derivative of the function along the curve parameterized by t

dFuncT  =  
      D[AScalarFunction[x[w[t], v[t]],  y[w[t], v[t]],  z[w[t], v[t]]], 
        t]

Note on the step immediately above: by specifying w and v, values of x and y are specified, and additionally values of z.  The three functions x(w,v), y(w,v), and z(w,v) together describe a surface---it specifies that three points can be specified by two values (A familiar case is when w=x, and v=y, then z(x,y) is a surface that can be specified over the x-y plane. The functions  w(t) and v(t) trace out a plane curve on the w-v surface and map onto a corresponding twisted curve (see Kreyszig p.429 for distinction between "plane" and "twisted" if it is not obvious).

Finally, we could skip the surface and just define a space curve x(t), y(t), z(t) and  take the derivative of AScalarFunc along  that curve:

dFuncT  =  D[AScalarFunction[x[t],  y[t], z[t]], t]

\(This\ last\ equation\ is\ \ the\ \(form : \ 
          dF\/dt\) = \ \(\(∂F\/∂x\) 
            dx\/dt\  + \ \(∂F\/∂y\) 
            dy\/dt\ \  + \ \(∂F\/∂z\) 
            dz\/dt\ \ which\ looks\ like\ a\ thermodynamic\ expression\ if\ we\ multiply\ both\ sides\ by\ \(dt : 

dF\) = \ \(∂F\/∂x\) 
            dx\  + \ \(∂F\/∂y\) 
            dy\ \  + \ \(∂F\/∂z\) 
            dz\)\)
\(Here, \ 
    dF\ is\ interpreted\ as\ any\ change\ in\ the\ scalar\ function\ if\ its\ variables\ are\ also\ changed\ dx, \ dy, \ dz\)

Visualizing approximations (Taylor Expansions)  to surfaces at points

Getting Mathematica to represent a general change in a function--multidimensional versions of Taylor expansions

SmallChangeSeries  =  
      Expand[Series[
            AScalarFunction[x +  dx,  y  +  dy,  z  +  dz], {dx, 0, 
              1}, {dy, 0, 1},  {dz, 0, 1}]]  -  
        AScalarFunction[x, y, z]

dScalarFunction  =  Expand[Normal[SmallChangeSeries]]

The next step eliminates second- and third-order terms… (remember, dx, dy, and dz are small)

dScalarFunction  =  dScalarFunction/.{dx dy  ->  
            0,  dy dz -> 0,  dx dz -> 0}

\(The\ above\ form\ is\ like\ the\ thermodynamic\ \(expression : 
dF\) = \ \(∂F\/∂x\) 
          dx\  + \ \(∂F\/∂y\) 
          dy\ \  + \ \(∂F\/∂z\) dz\)

Example of using Taylor Expansion to turn a function of two variables into an approximating function of four  variables:

CrazyFun[x_,  
        y_]  :=  ((Sin[5  π x] Sin[5  π y] )/(x y))  + (( Sin[5  π (x - 1)] Sin[5  π (y - 1)])/((x - 1) ( y - 1)))

Plot this function over suitable range of the variables x and y:

theplot  =  
      Plot3D[CrazyFun[x, y], {x, 0.1,  .9}, {y, 0.1,  .9}, 
        PlotRange -> All, Mesh -> False]

Now, approximate the function about a specific point (xo, yo), using Mathematica's Series function:

Approxfunction[x_,  y_ ,  xo_ ,  yo_]  :=  
      Series[CrazyFun[x, y], {x, xo, 2}, {y, yo, 2}] // Normal

and plot the approximate function in the neighborhood of (xo, yo):

anapprox  = 
      Plot3D[Evaluate[
          Approxfunction[x, 
            y,  .7,  .1]], {x,  .7 -  .1,  .7 +  .1}, {y,  .1 -  .1,  .1 +  .1}]

Both the original and the approximate function can be plotted simultaneously:

Show[anapprox,  theplot]

This final little bit selects random points (xo, yo) and fits Taylor expansions to ten different points, then displays them individually as well as with a superposed plot of the original function.

Table[{xo[i] = Random[], yo[i] = Random[]}, {i, 1, 
          100}];

The next function automates the small approximating surface patch

ApproxPlot[i_]  :=  
      Plot3D[Evaluate[Approxfunction[x, y, xo[i], yo[i]]], {x, xo[i] -  .1, 
          xo[i] +  .1}, {y, yo[i] -  .1, yo[i] +  .1}, PlotPoints -> 6, 
        ColorFunction -> (RGBColor[xo[i], yo[i], #] &), 
        DisplayFunction ->  Identity]

To build a sequence of graphics, I'll build a stack of ten graphics objects by using a recursive method. The next command sets the end of the recursion loop.

Clear[GraphicsStack]

GraphicsStack[0]  =  
      Show[ApproxPlot[1], DisplayFunction -> Identity]

Here is the recursive function.

GraphicsStack[i_]  :=  GraphicsStack[i]  =  
        Show[GraphicsStack[i - 1],  ApproxPlot[i + 1]]

Show[
      GraphicsArray[{GraphicsStack[10], Show[theplot, GraphicsStack[10]]}], 
      DisplayFunction -> $DisplayFunction]