(*^
::[ Information =
"This is a Mathematica Notebook file. It contains ASCII text, and can be
transferred by email, ftp, or other text-file transfer utility. It should
be read or edited using a copy of Mathematica or MathReader. If you
received this as email, use your mail application or copy/paste to save
everything from the line containing (*^ down to the line containing ^*)
into a plain text file. On some systems you may have to give the file a
name ending with ".ma" to allow Mathematica to recognize it as a Notebook.
The line below identifies what version of Mathematica created this file,
but it can be opened using any other version as well.";
FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2";
MacintoshStandardFontEncoding;
fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times";
fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times";
fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times";
fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times";
fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times";
fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times";
fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times";
fontset = input, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, 12, "Courier";
fontset = output, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-4, 12, "Courier";
fontset = message, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier";
fontset = print, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier";
fontset = info, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, 12, "Courier";
fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakBelow, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier";
fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Times";
fontset = header, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = leftheader, inactive, L2, 12, "Times";
fontset = footer, inactive, nohscroll, noKeepOnOnePage, preserveAspect, center, M7, 12, "";
fontset = leftfooter, inactive, L2, 12, "Times";
fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times";
fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Courier";
fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 14, "Times";
fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 14, "Times";
fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Courier";
fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "";
paletteColors = 128; automaticGrouping; currentKernel;
]
:[font = title; inactive; preserveAspect; startGroup]
Example 06
Two Dimensional Parametric Plots
and Graphics Primitives
:[font = subsubtitle; inactive; preserveAspect]
Copyright ã 1993 by Bill Titus, Carleton College,
Department of Physics and Astronomy, Northfield, MN 55057-4025
September 6, 1993
;[s]
3:0,0;10,1;11,0;133,-1;
2:2,16,12,Times,2,14,0,0,0;1,16,12,Symbol,0,14,0,0,0;
:[font = section; inactive; preserveAspect; startGroup]
Topics and Skills
:[font = special1; inactive; preserveAspect; endGroup]
1. ParametricPlot[].
2. The MMA constant Degree.
3. Two dimensional graphics primitives, including global and local options.
4. Removing input and output stored in memory.
;[s]
5:0,0;4,1;20,0;44,1;50,0;177,-1;
2:3,16,12,Times,0,14,0,0,0;2,15,11,Courier,0,14,0,0,0;
:[font = section; inactive; preserveAspect; startGroup]
Problem
:[font = special1; inactive; preserveAspect]
A place-kicker in the Carleton - St. Olaf football game is located 40 m from the goal post. The horizontal bar for the goal post is 3.0 m above the ground. The football is kicked with an initial speed of vo = 25 m/s at an angle of a equal to 30° with respect to the ground. Does the football clear the bar?
;[s]
5:0,0;240,1;241,0;255,1;256,0;320,-1;
2:3,16,12,Times,0,14,0,0,0;2,16,12,Symbol,0,14,0,0,0;
:[font = special1; inactive; preserveAspect]
In terms of a coordinate system whose origin is at the launch site and whose x-axis is horizontal and y-axis is vertical, the relevant equations are
:[font = special1; inactive; preserveAspect]
x[t] = vx[0]t
y[t] = vy[0]t - (1/2)gt2
;[s]
7:0,0;4,1;12,2;13,1;28,2;29,1;43,3;45,-1;
4:1,16,12,Times,0,14,0,0,0;3,15,11,Courier,0,14,0,0,0;2,23,15,Courier,64,14,0,0,0;1,23,15,Courier,32,14,0,0,0;
:[font = special1; inactive; preserveAspect]
where
:[font = special1; inactive; preserveAspect]
vx[0] = vo cos[a]
vy[0] = vo sin[a].
;[s]
10:0,0;4,1;5,2;6,1;19,3;20,1;27,2;28,1;41,3;42,1;45,-1;
4:1,16,12,Times,0,14,0,0,0;5,15,11,Courier,0,14,0,0,0;2,23,15,Courier,64,14,0,0,0;2,16,12,Symbol,0,14,0,0,0;
:[font = special1; inactive; preserveAspect; endGroup]
Find out whether the football clears the bar by plotting the trajectory of the football on a x-y graph using the parametric representation x[t] and y[t].
:[font = section; inactive; preserveAspect; startGroup]
Solution
:[font = subsection; inactive; preserveAspect; startGroup]
Step 1 - Complete the code below which uses Set[] to create the projectile equations for x[t] and y[t] as functions of t, vo, angle, and g.
;[s]
3:0,0;45,1;50,0;153,-1;
2:2,16,12,Times,1,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = input; preserveAspect; endGroup]
Clear[vo, angle, g, t, x, y]
x[vo_, angle_, t_, g_] =
y[vo_, angle_, t_, g_] =
:[font = subsection; inactive; preserveAspect; startGroup]
Comment 1
:[font = special1; inactive; preserveAspect; endGroup]
1. Was it necessary to use all four variables as arguments in the functions?
:[font = subsection; inactive; preserveAspect]
Step 2 - Check your functions by finding the values for x and y when t = 1.0 s, using the initial conditions specified in the problem. You may find the MMA constant Degree useful.
;[s]
3:0,0;172,1;178,0;188,-1;
2:2,16,12,Times,1,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Comment 2
:[font = special1; inactive; preserveAspect; endGroup]
1. Did you get help on Degree? If not, do so.
2. In order to force a numerical evaluation, you can use N[] to calculate the numerical value of the angle.
3. What are the advantages and disadvantages of inserting numbers directly as the arguments of a function versus setting symbols equal to the numerical results and then inserting the symbols as the arguments of a function?
;[s]
5:0,0;25,1;31,0;109,1;113,0;384,-1;
2:3,16,12,Times,0,14,0,0,0;2,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect]
Step 3 - Now you want to plot x[t] versus y[t]. To do so, find out information on the MMA function ParametricPlot[].
;[s]
2:0,0;105,1;123,-1;
2:1,16,12,Times,1,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Comment 3
:[font = special1; inactive; preserveAspect; endGroup]
1. How do these options compare with those in Plot[]?
;[s]
3:0,0;48,1;54,0;56,-1;
2:2,16,12,Times,0,14,0,0,0;1,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect]
Step 4 - Plot the desired trajectory, but for now don't include any options.
:[font = subsection; inactive; preserveAspect]
Step 5 - Add options to your plot so that the projectile is not shown entering the earth. Also label your axes and title the plot. Finally name the graphics object plot1 so you can refer to it latter.
;[s]
3:0,0;167,1;172,0;205,-1;
2:2,16,12,Times,1,14,0,0,0;1,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Comment 5
:[font = special1; inactive; preserveAspect; endGroup]
1. Note the importance of lines and indents to make your code readable.
2. You can use PlotRange to cut off the trajectory below ground.
3. What if you want to add the goal post to the graph and label it. You can do this within MMA using "graphics primitives".
;[s]
3:0,0;90,1;99,0;267,-1;
2:2,16,12,Times,0,14,0,0,0;1,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect]
Step 6 - Start by finding out about MMA's InputForm[] and then apply this function to plot1. Describe what you see.
;[s]
5:0,0;43,1;54,0;89,1;94,0;120,-1;
2:3,16,12,Times,1,14,0,0,0;2,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Comment 6
:[font = special1; inactive; preserveAspect; endGroup]
1. You should see a Line[] command followed by a list of points and then various options, all embedded in the command Graphics[]. Get help of the command Graphics[].
2. ParametricPlot[] is thus a short hand notation for producing graphics objects which are then displayed using Show[].
3. To plot graphics primitives one uses the format
Show[Graphics[{primitives}, {global options}]].
4. There are eight graphics primitives: Point, Line, Circle, Disk, Rectangle, Polygon, Text, and Raster.
5. The global options are those in Plot[] or ParametricPlot[], minus the curve enhancing ones.
6. The local options are the graphics directives; they go before graphics primitives and affect all that follows.
;[s]
33:0,0;22,1;28,0;122,1;132,0;160,1;170,0;176,1;193,0;286,1;292,0;359,1;405,0;449,1;454,0;457,1;461,0;464,1;470,0;473,1;477,0;480,1;489,0;492,1;499,0;502,1;506,0;514,1;520,0;559,1;566,0;570,1;586,0;738,-1;
2:17,16,12,Times,0,14,0,0,0;16,15,11,Courier,0,14,0,0,0;
:[font = subsection; inactive; preserveAspect; startGroup]
Step 7 - Look over the following code. Try to guess the object that will be produced. Then activate the cell and describe what you see.
:[font = input; preserveAspect; endGroup]
Clear[myGraphics]
myGraphics =
Graphics[
{RGBColor[0, 0, 1],
Circle[{0, 0}, 1],
Circle[{0, 0}, 0.7, {Pi, 2Pi}],
RGBColor[1, 0, 0],
Disk[{-0.5, 0.5}, 0.1],
Disk[{0.5, 0.5}, 0.1],
RGBColor[0, 1, 0],
Line[{{-0.2, -0.2}, {0.0, 0.2}, {0.2, -0.2}}],
RGBColor[0, 0, 0],
Text[FontForm["I'm pleased with myself",
{"Times-Bold", 16}], {0, -1.2}]
},
{AspectRatio -> Automatic,
Background -> RGBColor[1,1,0]
}];
Show[myGraphics];
:[font = subsection; inactive; preserveAspect]
Step 8 - Use Graphics[] and the graphics primitives Line[] and Text[] to construct a graphics object called goalPost so you can superimpose it on plot1.
;[s]
11:0,0;14,1;24,0;55,1;61,0;68,1;74,0;115,1;123,0;155,1;160,0;162,-1;
2:6,16,12,Times,1,14,0,0,0;5,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect]
Step 9 - Combine the graphics object goalPost with plot1 using Show[].
;[s]
7:0,0;38,1;46,0;54,1;59,0;68,1;74,0;76,-1;
2:4,16,12,Times,1,14,0,0,0;3,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect]
Step 10 - During a given MMA session, MMA saves all the input and output in memory, even if you delete material from your notebook. The commands ??In and ??Out list all the input and output stored in memory. Try typing ??In. What do you find?
;[s]
7:0,0;147,1;151,0;158,1;163,0;226,1;230,0;251,-1;
2:4,16,12,Times,1,14,0,0,0;3,15,11,Courier,1,14,0,0,0;
:[font = subsection; inactive; preserveAspect; leftWrapOffset = 20; startGroup]
Step 11 - Why might you want to delete the input and output information stored in memory? To do so, you can use the following sequence of commands:
:[font = special3; inactive; preserveAspect]
Unprotect[Out];
Clear[Out]
Protect[Out];
Unprotect[In];
Clear[In]
Protect[In];
:[font = special2; inactive; preserveAspect; leftWrapOffset = 21; endGroup]
Find out about these commands and then use them to remove the input and output information stored in memory. Verify that you were successful.
:[font = subsection; inactive; preserveAspect; startGroup]
Comment 11
:[font = special1; inactive; preserveAspect; endGroup; endGroup]
1. These commands do not delete what's displayed in the notebook itself.
2. Even if the memory is clear, the numbers labeling the input and output are not reset.
:[font = section; inactive; preserveAspect; startGroup]
Save Your Notebook
:[font = special1; inactive; preserveAspect; endGroup; endGroup]
Remove any output cells from this notebook and then use Save As to store your notebook under the name myEx06.
;[s]
5:0,0;57,1;64,0;105,1;111,0;113,-1;
2:3,16,12,Times,0,14,0,0,0;2,15,11,Helvetica,0,14,0,0,0;
^*)