(*^
::[paletteColors = 128; currentKernel;
fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e8, 24, "Times"; ;
fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, L1, e6, 18, "Times"; ;
fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, L1, e6, 14, "Times"; ;
fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, L1, a20, 18, "Times"; ;
fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, L1, a15, 14, "Times"; ;
fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, L1, a12, 12, "Times"; ;
fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ;
fontset = input, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L1, 12, "Courier"; ;
fontset = output, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; ;
fontset = message, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ;
fontset = print, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ;
fontset = info, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L1, 12, "Courier"; ;
fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, L1, 12, "Courier"; ;
fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, L1, 10, "Times"; ;
fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = Left Header, nohscroll, cellOutline, 12;
fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, L1, 12;
fontset = Left Footer, cellOutline, blackBox, 12;
fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 10, "Times"; ;
fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12, "Courier"; ;
fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, L1, 12;
next21StandardFontEncoding; ]
:[font = title; inactive; Cclosed; preserveAspect; startGroup; ]
IntroVectors
:[font = subsubtitle; inactive; preserveAspect; endGroup; ]
Version 2.0
11/4/92
John B. Schneider
:[font = section; inactive; Cclosed; preserveAspect; startGroup; ]
Introduction
:[font = text; inactive; preserveAspect; endGroup; ]
Vectors have both a magnitude and a direction. It is important that you understand two different types of vectors. In this NoteBook we will discuss position vectors and distance (or displacement) vectors. Position vectors indicate a position relative to the origin while distance vectors indicate a magnitude and direction from one point in space (generally not the origin) to another.
We will discuss two-dimensional position and displacement vectors in the Cartesian and cylindrical (polar) coordinate systems.
:[font = section; inactive; Cclosed; preserveAspect; startGroup; ]
Vectors in Cartesian Coordinates
:[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ]
Position vectors.
:[font = text; inactive; preserveAspect; ]
A position vector indicates the distance and direction from the origin to a point in space. For example, the position of an airplane relative to a fixed coordinate system could be described with a position vector. Of course, this position vector would be a function of time. The magnitude of the vector would give the distance to the airplane and the direction from the origin would be given by the direction of the vector.
The program below defines a function that will plot a vector from the origin to a user specified point. The assumption is made that point of interest is within the region bounded by ±5 <= x <= 5 and ±5 <= y <= 5 (feel free to change these limits). The position vector itself is red. The function additionally shows the x and y unit vectors in blue. The purpose of the unit vectors will become more clear later.
:[font = input; initialization; preserveAspect; ]
*)
Off[General::Spell];
positionVector[x_,y_] :=
Block[{pVect,xUnit,yUnit,xMin=-5,xMax=5,yMin=-5,yMax=5},
pVect = Line[{{0,0},{x,y}}];
xUnit = Line[{{x,y},{x+1,y}}];
yUnit = Line[{{x,y},{x,y+1}}];
Show[Graphics[{axes[xMin,xMax,yMin,yMax],
RGBColor[1,0,0],pVect,
RGBColor[0,0,1],xUnit,yUnit}
],
PlotRange->All,
AspectRatio -> (yMax-yMin)/(xMax-xMin)
]
]
(*
:[font = text; inactive; preserveAspect; ]
Try this function for a few combinations of end points and convince yourself that it really does draw a position vector from the origin to the point you specify.
:[font = input; preserveAspect; ]
positionVector[ 1, 3 ]
:[font = text; inactive; preserveAspect; ]
The following command will generate a sequence of graphics (that can be animated if you wish). In this sequence the end point of the position vector will move in a circle with a radius of three. The x position is 3 cos(phi) and the y position is 3 sin(phi), where phi goes from 0 to 350 degrees in 10 degree increments.
:[font = input; preserveAspect; ]
Table[
positionVector[ 3 Cos[dum`i Pi/180], 3 Sin[dum`i Pi/180] ],
{dum`i,0,350,10}
]
:[font = text; inactive; preserveAspect; endGroup; ]
Note that no matter where the end point of the position vector is, the x and y unit vectors always point in fixed directions. The x unit vector always points in the positive x direction and the y unit vector always points in the positive y direction. As you will see, unit vectors do not point in constant directions in the cylindrical (or spherical) coordinate systems.
:[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ]
Distance vectors.
:[font = text; inactive; preserveAspect; ]
A distance or displacement vector specifies a magnitude and direction from a point in space other than the origin. A displacement vector can be used to indicate the speed and direction of an airplace. For example, when the plane is at the point (1,3) its speed is 2 units horizontally and 0.5 units vertically. The displacement vector is therefore (2,0.5) and it is drawn with its base at the point (1,3).
The following program defines a function that will draw a position vector to the base of the displacement vector and then draw the displacement vector from that point. The position vector and unit vectors are drawn as before. The displacement vector is drawn in black.
:[font = input; initialization; preserveAspect; ]
*)
distanceVector[x_,y_,x1_,y1_] :=
Block[{dVect,pVect,xUnit,yUnit,xMin=-5,xMax=5,yMin=-5,yMax=5},
dVect = Line[{{x,y},{x+x1,y+y1}}];
pVect = Line[{{0,0},{x,y}}];
xUnit = Line[{{x,y},{x+1,y}}];
yUnit = Line[{{x,y},{x,y+1}}];
Show[Graphics[{axes[xMin,xMax,yMin,yMax],dVect,
RGBColor[1,0,0],pVect,
RGBColor[0,0,1],xUnit,yUnit}],
PlotRange -> All,
AspectRatio -> (yMax-yMin)/(xMax-xMin)
]
]
(*
:[font = text; inactive; preserveAspect; ]
The following command will display the position and displacement vectors. The first two arguments give the x and y coordinates to the base of the displacement vector. The next two arguments indicate the distance along the x unit vector and the distance along the y unit vector for the displacement vector itself.
:[font = input; preserveAspect; ]
distanceVector[(*position*) 1,3, (*displacement*) 2,0.5 ]
:[font = text; inactive; preserveAspect; ]
We can again generate a sequence similar to the one for the position vector. The x and y components move in a circle, but the x and y displacement are held fixed at 2 and 0.5, respectively.
:[font = input; preserveAspect; ]
Table[
distanceVector[ 3 Cos[dum`i Pi/180], 3 Sin[dum`i Pi/180], 2, 0.5 ],
{dum`i,0,350,10}
]
:[font = text; inactive; preserveAspect; endGroup; endGroup; ]
Notice that the orientation of the displacement vector does not change. It is always two units to the ªrightº and 0.5 units ªup.º
:[font = section; inactive; Cclosed; preserveAspect; startGroup; ]
Vectors in Polar Coordinates.
:[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ]
Position Vectors
:[font = text; inactive; preserveAspect; ]
In two-dimensional polar coordinates, a position vector is described by a radius from the origin and an angle from the positive x axis. The following program defines a function to draw a position vector where the radius (r) and the angle (p) are specified by the user. Again, the function is defined to draw the axes over the region ±5 <= x <= 5 and ±5 <= y <= 5. This function draws the position vector in red and the r and p unit vectors in green.
:[font = input; initialization; preserveAspect; ]
*)
positionVectorRP[r_,p_] :=
Block[{pVect,x,y,rUnit,pUnit,cosp,sinp,
xMin=-5,xMax=5,yMin=-5,yMax=5},
(* Cos[p] and Sin[p] are used more than once so
calculate them once here and use again later. *)
cosp = Cos[p];
sinp = Sin[p];
x = r cosp;
y = r sinp;
dVect = Line[{{0,0},{x,y}}];
pVect = Line[{{0,0},{x,y}}];
rUnit = Line[{{x,y},{x+cosp,y+sinp}}];
pUnit = Line[{{x,y},{x-sinp,y+cosp}}];
Show[Graphics[{axes[xMin,xMax,yMin,yMax],
RGBColor[1,0,0],pVect,
RGBColor[0,1,0],rUnit,pUnit}],
PlotRange -> All,
AspectRatio -> (yMax-yMin)/(xMax-xMin)
]
]
(*
:[font = text; inactive; preserveAspect; ]
Here is the function set up and ready to use but feel free to change the arguments. Note that the angular dimension is specified in radians. (To use degrees, make sure you multiply the value in degrees by Pi/180 to get radians. In the command below, the p value is initially 30 degrees.)
:[font = input; preserveAspect; ]
positionVectorRP[ 3, 30 Pi/180 ]
:[font = text; inactive; preserveAspect; ]
Note the behavior of the unit vectors. The r unit vector always points in the direction the position vector would move if r were increased and p was unchanged. However, the direction of r depends on p. Therefore, the r unit vector does not point in a fixed direction the way the x and y unit vectors did in the Cartesian coordinate system. The p unit vector always points in the direction the position vector would move if p were increased and r was unchanged. Of course, the length of both unit vectors is one.
The command below generates a sequence of graphics where the radius is held at three and p ranges from 0 to 350 in 10 degree increments. These are the same positions that were used in the Cartesian coordinate sequences. Position vectors describe a physical ªtruthº that is independent of the coordinate system you are using. The airplane is at the same point in space whether you are using Cartesian coordinates or polar coordinates. All that changes is how you describe that point.
:[font = input; preserveAspect; ]
Table[positionVectorRP[3, dum`i Pi/180],
{dum`i,0,350,10}
]
:[font = text; inactive; preserveAspect; endGroup; ]
Note the movement of the unit vectors as the position moves.
:[font = subsection; inactive; Cclosed; preserveAspect; startGroup; ]
Displacement Vectors
:[font = text; inactive; preserveAspect; ]
The following program defines a function to draw a displacement vector where the base of the vector is specified as a radius from the origin and an angle from the x axis. The displacement vector itself is specified by a distance along the r unit vector and a distance along the p unit vector. The displacement vector is drawn in black.
:[font = input; initialization; preserveAspect; ]
*)
distanceVectorRP[r_,p_,r1_,phiDistance_] :=
Block[{dVect,pVect,x,y,rUnit,pUnit,cosp,sinp,
xMin=-5,xMax=5,yMin=-5,yMax=5},
(* Cos[p] and Sin[p] are used more than once so
calculate them once here and use again later. *)
cosp = Cos[p];
sinp = Sin[p];
x = r cosp;
y = r sinp;
dVect =
Line[{{x,y},
{x+r1 cosp-phiDistance sinp,
y+r1 sinp+phiDistance cosp}}];
pVect = Line[{{0,0},{x,y}}];
rUnit = Line[{{x,y},{x+cosp,y+sinp}}];
pUnit = Line[{{x,y},{x-sinp,y+cosp}}];
Show[Graphics[{axes[xMin,xMax,yMin,yMax],dVect,
RGBColor[1,0,0],pVect,
RGBColor[0,1,0],rUnit,pUnit}],
PlotRange -> All,
AspectRatio -> (yMax-yMin)/(xMax-xMin)
]
]
(*
:[font = text; inactive; preserveAspect; ]
The displacement vector is specified by two distances, a distance along the r unit vector and a distance along the p unit vector. This is not another radius and angle. It is similar to the displacement vectors in the Cartesian coordiante system in that we are specifying two distances. However, in the polar coordinate system the unit vectors are not constant.
The following command will draw a position vector, the unit vectors associated with that position, and the displacement vector. Please change the arguments to whatever you want. Initially, the arguments are for a position vector that is 3 units long and forms a 30 degree angle with the positive x axis. The displacement vector is 2 units along the r unit vector (or 2 units in the r direction) and 0.5 units along the p unit vector.
:[font = input; preserveAspect; ]
distanceVectorRP[3,30 Pi/180,2,0.5]
:[font = text; inactive; preserveAspect; ]
The command below will again create a sequence of graphics where the end point of the position vector moves in a circle. In this command, the displacement vector is always 2 units in the r direction and 0.5 units in the p direction. Note how the displacement vectors changes with different position vectors.
:[font = input; preserveAspect; endGroup; endGroup; ]
Table[distanceVectorRP[3, dum`i Pi/180,2,0.5],
{dum`i,0,350,10}
]
:[font = section; inactive; Cclosed; preserveAspect; startGroup; ]
Conclusions
:[font = text; inactive; preserveAspect; endGroup; ]
This NoteBook illustrated the difference between position vectors and displacement vectors in two different coordinate systems. It was shown that unit vectors point in a constant direction in the Cartesian coordinate system but that their orientation is position dependent in the cylindrical coordinate system. Position vectors are described by two distances in the Cartesian coordinate system and by a distance and an angle in the cylindrical coordinate system. However, displacement vectors are specified by two distances in both coordinate systems.
Although the illstrations were restricted to two dimensions, the same concepts hold in three dimensions. For example, in spherical coordinates a position vector would be described by a distance and two angles. However, a displacement vector would consist of three distances Ð the distance in the r direction, the distance in the theta direction, and the distance in the phi direction.
:[font = section; inactive; Cclosed; preserveAspect; startGroup; ]
Initialization Cells
:[font = text; inactive; preserveAspect; ]
The following command is used in the drawing of the axes.
:[font = input; initialization; preserveAspect; endGroup; ]
*)
axes[x0_,x1_,y0_,y1_] :=
Block[{tick,x,y},
tick = .02 Min[{x1-x0,y1-y0}];
{(* x axis *) Line[{{0,y0},{0,y1}}],
(* y axis *) Line[{{x0,0},{x1,0}}],
(* x axis tick marks *) Table[Line[{{x,-tick},{x,tick}}],{x,x0,x1}],
(* y axis tick marks *) Table[Line[{{-tick,y},{tick,y}}],{y,y0,y1}]}
]
(*
^*)