Skip to main content
3 of 5
added 1197 characters in body
David
  • 15k
  • 4
  • 47
  • 121

Comparing unit normal definition in calculus with FrenetSerretSystem

I'm trying to compare the unit normal definition in calculus texts (i.e., $\vec N=\vec T'/||\vec T'||$) where $\vec T$ is the unit tangent vector, with the unit normal vector returned by the FrenetSerretSystem. Using the calculus definition, this works:

Manipulate[
 
 Module[{r, unitT, unitN},
  
  r[x_] = {x, Sin[x]};
  unitT[x_] = r'[x]/Sqrt[r'[x].r'[x]];
  unitN[x_] = unitT'[x]/Sqrt[unitT'[x].unitT'[x]];
  
  ParametricPlot[r[x], {x, 0, 2 Pi},
   Epilog -> { 
     Orange, Thick, Arrow[{r[tt], r[tt] + unitN[tt]}],
     Red, PointSize[Large], Point[r[tt]]
     }, PlotRange -> {{0, 2 Pi}, {-4, 4}}]],
 
 {tt, 0.01, 2 Pi - 0.01}]

But trying the FrenetSerretSystem, this doesn't.

Manipulate[
 
 Module[{r, unitT, unitN, sys},
  
  r[x_] = {x, Sin[x]};
  sys = FrenetSerretSystem[r[x], x];
  unitT[x_] = sys[[2, 1]];
  unitN[x_] = sys[[2, 2]];
  
  ParametricPlot[r[x], {x, 0, 2 Pi},
   Epilog -> { 
     Orange, Thick, Arrow[{r[tt], r[tt] + unitN[tt]}],
     Red, PointSize[Large], Point[r[tt]]
     }, PlotRange -> {{0, 2 Pi}, {-4, 4}}]
  
  ],
 
 {tt, 0.01, 2 Pi - 0.01}]

I get an error such as this:

Coordinate {0.01 - Cos[$CellContext`x] (1 + Cos[$CellContextx]^2)^Rational[-1, 2], 0.009999833334166664 + (1 + Cos[$CellContextx]^2)^Rational[-1, 2]} should be a pair of numbers, or a Scaled or Offset form.

And this gives a similar error.

DynamicModule[{r, unitT, unitN, sys},
 
 r[x_] = {x, Sin[x]};
 sys = FrenetSerretSystem[r[x], x];
 unitT[x_] = sys[[2, 1]];
 unitN[x_] = sys[[2, 2]];
 
 Manipulate[
  
  ParametricPlot[r[x], {x, 0, 2 Pi},
   Epilog -> { 
     Orange, Thick, Arrow[{r[tt], r[tt] + unitN[tt]}],
     Red, PointSize[Large], Point[r[tt]]
     }, PlotRange -> {{0, 2 Pi}, {-4, 4}}],
  
  {tt, 0.01, 2 Pi - 0.01}]]

Once I get this repaired, I am going to see the unit normal vector (calculus definition) pointing in the opposite direction of the unit normal vector (FrenetSerretSystem) from 0 to $\pi$ and I am wondering why. I think it might have something to do with the fact that the calculus books tend to use the curvature, whereas the FrenetSerretSystem uses the signed curvature, but I am still trying to figure out the different directions of the unit normal.

Thanks for the help.

Update due to m_goldberg help:

This works:

Manipulate[
 
 Module[{r, k, unitT, unitN},
  
  r[x_] = {x, Sin[x]};
  {{k[x_]}, {unitT[x_], unitN[x_]}} = FrenetSerretSystem[r[x], x];
  
  ParametricPlot[r[x], {x, 0, 2 Pi},
   Epilog -> { 
     Orange, Thick, Arrow[{r[tt], r[tt] + unitN[tt]}],
     Red, Thick, Arrow[{r[tt], r[tt] + unitT[tt]}],
     Red, PointSize[Large], Point[r[tt]]
     }, PlotRange -> {{0, 2 Pi}, {-4, 4}}]
  
  ],
 
 {tt, 0.01, 2 Pi - 0.01}]

And this works:

DynamicModule[{r, unitT, unitN, k},
 
 r[x_] = {x, Sin[x]};
 {{k[x_]}, {unitT[x_], unitN[x_]}} = FrenetSerretSystem[r[x], x];
 
 Manipulate[ParametricPlot[r[x], {x, 0, 2 Pi},
   Epilog -> {
     Orange, Thick, Arrow[{r[tt], r[tt] + unitN[tt]}],
     Red, Thick, Arrow[{r[tt], r[tt] + unitT[tt]}],
     Red, PointSize[Large], Point[r[tt]]}, 
   PlotRange -> {{0, 2 Pi}, {-4, 4}}], {tt, 0.01, 2 Pi - 0.01}]]

Both protect the functions in the modules from being changed when functions with the same name are entered in the same notebook in the global workspace.

David
  • 15k
  • 4
  • 47
  • 121