0% found this document useful (0 votes)
39 views4 pages

Wolfram Mathematica Code

To plot the tangent, normal, and binormal vectors

Uploaded by

M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views4 pages

Wolfram Mathematica Code

To plot the tangent, normal, and binormal vectors

Uploaded by

M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

In[455]:= (* define path one *)

r1[x_] := x, x2 
(* calculate curvature, unit tangent vector *)
(* and unit normal vectors *)
fs1 = FrenetSerretSystem[r1[x], x]
2 1 2x 2x 1
Out[456]=  ,  , , - , 
3/2
1 + 4 x2  1 + 4 x2 1 + 4 x2 1 + 4 x2 1 + 4 x2

In[457]:= (* here is the curvature *)


fs1〚1, 1〛
2
Out[457]=
3/2
1 + 4 x2 

In[458]:= (* here is the unit tangent vector *)


fs1〚2, 1〛
1 2x
Out[458]=  , 
1 + 4 x2 1 + 4 x2

In[459]:= (* here is the unit normal vector *)


fs1〚2, 2〛
2x 1
Out[459]= - , 
1 + 4 x2 1 + 4 x2

In this case, the curvature at x = 0.5 is positive and the unit normal vector points toward the center of
curvature.
In[461]:= (* curvature at x=0.5 *)
fs1〚1, 1〛 /. x  0.5
Out[461]= 0.707107
2 directionOfUnitNormal.nb

In[462]:= (* here is a graph of the unit normal *)


(* evaluated at t=0.5 *)
Show
ParametricPlotx, x2 , {x, 0, 1}, ImageSize  150, PlotRange  {{- 0.5, 1}, {0, 1.5}},
AxesLabel  {"x", "y"}, Ticks  {{0, .5, 1}, {0, .5, 1, 1.5}},
Graphics[{
Red, Point[r1[.5]],
Arrow[{r1[.5], r1[.5] + nHat1}]
}]

y
1.5

Out[462]=

0.5

x
0 0.5 1

In[463]:= (* define path two *)


r2[x_] := x, x
(* calculate curvature, unit tangent vector *)
(* and unit normal vectors *)
fs1 = FrenetSerretSystem[r2[x], x]
2 2 1 1 2
Out[464]= - ,  , , - , 
1+4 x 1+4 x 1+4 x 1+4 x 1+4 x
x (1 + 4 x) x x
x x x x x

In[465]:= (* here is the curvature *)


fs2〚1, 1〛
2
Out[465]= -
1+4 x
x (1 + 4 x)
x

In[466]:= (* here is the unit tangent vector *)


fs2〚2, 1〛
2 1
Out[466]=  , 
1+4 x 1+4 x
x
x x
directionOfUnitNormal.nb 3

In[467]:= (* here is the unit normal vector *)


fs2〚2, 2〛
1 2
Out[467]= - , 
1+4 x 1+4 x
x
x x

In this case, the curvature at t = 0.5 is negative and the unit normal vector points away from the center
of curvature.
In[468]:= fs2〚1, 1〛 /. x  0.5
Out[468]= - 0.3849

In[469]:= Show[
ParametricPlot[r2[x], {x, 0, 1}, ImageSize  150,
PlotRange  {{- 0.5, 1}, {0, 1.5}}, AspectRatio  Automatic,
AxesLabel  {"x", "y"}, Ticks  {{0, .5, 1}, {0, .5, 1, 1.5}}],
Graphics[{
Red, Point[r2[.5]],
Arrow[{r2[.5], r2[.5] + nHat2}]
}]
]
y
1.5

Out[469]=

0.5

x
0 0.5 1

There is a way to deal with this using the built-in function Sign.
(* here is the curvature at t=0.5 *)
fs2〚1, 1〛 /. x  0.5
(* and here is the unit normal at t=0.5 *)
(* remember, this is the unit normal *)
(* that points away from the center of curvature *)
fs2〚2, 2〛 /. x  0.5
Out[470]= - 0.3849

Out[471]= {- 0.57735, 0.816497}

In[474]:= (* here is the sign of the curvature *)


Sign[fs2〚1, 1〛 /. x  0.5]
Out[474]= -1
4 directionOfUnitNormal.nb

Here is the unit normal taking into account of the sign of the curvature.
In[477]:= (Sign[fs2〚1, 1〛] × fs2〚2, 2〛) /. x  0.5
Out[477]= {0.57735, - 0.816497}

This unit normal vector points toward the center of curvature.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy