(************** Content-type: application/mathematica ************** Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 13444, 458]*) (*NotebookOutlinePosition[ 14304, 489]*) (* CellTagsIndexPosition[ 14260, 485]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell["\<\ Example 06 Two Dimensional Parametric Plots and Graphics Primitives\ \>", "Title", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Copyright ", StyleBox["\[Copyright]", FontSlant->"Plain"], " 1993 by Bill Titus, Carleton College, \nDepartment of Physics and \ Astronomy, Northfield, MN 55057-4025\nSeptember 6, 1993" }], "Subsubtitle", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Topics and Skills", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. ", StyleBox["ParametricPlot[]", FontFamily->"Courier"], ".\n2. The MMA constant ", StyleBox["Degree", FontFamily->"Courier"], ".\n3. Two dimensional graphics primitives, including global and local \ options.\n4. Removing input and output stored in memory." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Problem", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 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 \[Alpha] equal to 30\[Degree] with respect to the ground. \ Does the football clear the bar?\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 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\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "\t ", StyleBox["x[t] = v", FontFamily->"Courier"], StyleBox["x", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["[0]t\n\t y[t] = v", FontFamily->"Courier"], StyleBox["y", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["[0]t - (1/2)gt", FontFamily->"Courier"], StyleBox["2", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Superscript"}] }], "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell["where ", "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ " ", StyleBox["v", FontFamily->"Courier"], StyleBox["x", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["[0] = vo cos[", FontFamily->"Courier"], "\[Alpha]", StyleBox["] \n v", FontFamily->"Courier"], StyleBox["y", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Subscript"}], StyleBox["[0] = vo sin[", FontFamily->"Courier"], "\[Alpha]", StyleBox["].", FontFamily->"Courier"] }], "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 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].\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Solution", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell[TextData[{ "Step 1 - Complete the code below which uses ", StyleBox["Set[]", FontFamily->"Courier"], " to create the projectile equations for x[t] and y[t] as functions of \ t, vo, angle, and g. " }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Clear[vo, angle, g, t, x, y] x[vo_, angle_, t_, g_] = y[vo_, angle_, t_, g_] = \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 1. Was it necessary to use all four variables as arguments in the functions?\ \ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "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 ", StyleBox["Degree", FontFamily->"Courier"], " useful." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 2", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Did you get help on ", StyleBox["Degree", FontFamily->"Courier"], "? If not, do so.\n2. In order to force a numerical evaluation, you can \ use ", StyleBox["N[] ", FontFamily->"Courier"], "to calculate the numerical value of the angle.\n3. 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?" }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 3 - Now you want to plot x[t] versus y[t]. To do so, find out \ information on the MMA function ", StyleBox["ParametricPlot[].", FontFamily->"Courier"] }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 3", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. How do these options compare with those in ", StyleBox["Plot[]", FontFamily->"Courier"], "?" }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell["\<\ Step 4 - Plot the desired trajectory, but for now don't include any options. \ \ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "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 ", StyleBox["plot1", FontFamily->"Courier"], " so you can refer to it latter." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 5", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Note the importance of lines and indents to make your code readable.\n\ 2. You can use ", StyleBox["PlotRange", FontFamily->"Courier"], " to cut off the trajectory below ground.\n3. What if you want to add the \ goal post to the graph and label it. You can do this within MMA using \ \"graphics primitives\"." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 6 - Start by finding out about MMA's ", StyleBox["InputForm[]", FontFamily->"Courier"], " and then apply this function to ", StyleBox["plot1", FontFamily->"Courier"], ". Describe what you see." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 6", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. You should see a ", StyleBox["Line[]", FontFamily->"Courier"], " command followed by a list of points and then various options, all \ embedded in the command ", StyleBox["Graphics[]", FontFamily->"Courier"], ". Get help of the command ", StyleBox["Graphics[]", FontFamily->"Courier"], ".\n2. ", StyleBox["ParametricPlot[] ", FontFamily->"Courier"], "is thus a short hand notation for producing graphics objects which are \ then displayed using ", StyleBox["Show[]", FontFamily->"Courier"], ".\n3. To plot graphics primitives one uses the format \n ", StyleBox["Show[Graphics[{primitives}, {global options}]]", FontFamily->"Courier"], ".\n4. There are eight graphics primitives: ", StyleBox["Point", FontFamily->"Courier"], ", ", StyleBox["Line", FontFamily->"Courier"], ", ", StyleBox["Circle", FontFamily->"Courier"], ", ", StyleBox["Disk", FontFamily->"Courier"], ", ", StyleBox["Rectangle", FontFamily->"Courier"], ", ", StyleBox["Polygon", FontFamily->"Courier"], ", ", StyleBox["Text", FontFamily->"Courier"], ", and ", StyleBox["Raster", FontFamily->"Courier"], ".\n5. The global options are those in ", StyleBox["Plot[] ", FontFamily->"Courier"], "or ", StyleBox["ParametricPlot[]", FontFamily->"Courier"], ", minus the curve enhancing ones. \n6. The local options are the \ graphics directives; they go before graphics primitives and affect all that \ follows." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["\<\ 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.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 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];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 8 - Use ", StyleBox["Graphics[]", FontFamily->"Courier"], " and the graphics primitives ", StyleBox["Line[]", FontFamily->"Courier"], " and ", StyleBox["Text[]", FontFamily->"Courier"], " to construct a graphics object called ", StyleBox["goalPost", FontFamily->"Courier"], " so you can superimpose it on ", StyleBox["plot1", FontFamily->"Courier"], "." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 9 - Combine the graphics object ", StyleBox["goalPost", FontFamily->"Courier"], " with ", StyleBox["plot1", FontFamily->"Courier"], " using ", StyleBox["Show[]", FontFamily->"Courier"], "." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "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 ", StyleBox["??In", FontFamily->"Courier"], " and ", StyleBox["??Out", FontFamily->"Courier"], " list all the input and output stored in memory. Try typing ", StyleBox["??In", FontFamily->"Courier"], ". What do you find?" }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["\<\ 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: \ \ \>", "Subsection", CellMargins->{{20, Inherited}, {Inherited, Inherited}}, ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ \t Unprotect[Out]; Clear[Out] Protect[Out]; Unprotect[In]; Clear[In] Protect[In]; \ \>", "Special3", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Find out about these commands and then use them to remove the input and \ output information stored in memory. Verify that you were successful. \ \>", "Special2", CellMargins->{{21, Inherited}, {Inherited, Inherited}}, ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 11", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 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.\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Save Your Notebook", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Remove any output cells from this notebook and then use ", StyleBox["Save As", FontFamily->"Helvetica"], " to store your notebook under the name ", StyleBox["myEx06", FontFamily->"Helvetica"], "." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]] }, FrontEndVersion->"4.1 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 695}}, WindowToolbars->{}, CellGrouping->Manual, WindowSize->{499, 599}, WindowMargins->{{257, Automatic}, {Automatic, 0}}, PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}}, ShowCellLabel->True, ShowCellTags->False, RenderingOptions->{"ObjectDithering"->True, "RasterDithering"->False} ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1727, 52, 125, 5, 70, "Title"], Cell[1855, 59, 265, 7, 70, "Subsubtitle"], Cell[CellGroupData[{ Cell[2143, 68, 69, 1, 70, "Section"], Cell[2215, 71, 348, 10, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[2595, 83, 59, 1, 70, "Section"], Cell[2657, 86, 403, 7, 70, "Special1"], Cell[3063, 95, 211, 4, 70, "Special1"], Cell[3277, 101, 544, 18, 70, "Special1"], Cell[3824, 121, 59, 1, 70, "Special1"], Cell[3886, 124, 553, 21, 70, "Special1"], Cell[4442, 147, 221, 5, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[4695, 154, 60, 1, 70, "Section"], Cell[CellGroupData[{ Cell[4778, 157, 274, 7, 70, "Subsection"], Cell[5055, 166, 139, 5, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5226, 173, 64, 1, 70, "Subsection"], Cell[5293, 176, 140, 4, 70, "Special1"] }, Open ]], Cell[5445, 182, 311, 8, 70, "Subsection"], Cell[CellGroupData[{ Cell[5779, 192, 64, 1, 70, "Subsection"], Cell[5846, 195, 560, 13, 70, "Special1"] }, Open ]], Cell[6418, 210, 238, 6, 70, "Subsection"], Cell[CellGroupData[{ Cell[6679, 218, 64, 1, 70, "Subsection"], Cell[6746, 221, 173, 6, 70, "Special1"] }, Open ]], Cell[6931, 229, 142, 4, 70, "Subsection"], Cell[7076, 235, 328, 8, 70, "Subsection"], Cell[CellGroupData[{ Cell[7427, 245, 64, 1, 70, "Subsection"], Cell[7494, 248, 394, 9, 70, "Special1"] }, Open ]], Cell[7900, 259, 288, 9, 70, "Subsection"], Cell[CellGroupData[{ Cell[8211, 270, 64, 1, 70, "Subsection"], Cell[8278, 273, 1604, 55, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[9914, 330, 202, 4, 70, "Subsection"], Cell[10119, 336, 583, 22, 70, "Input"] }, Open ]], Cell[10714, 360, 477, 18, 70, "Subsection"], Cell[11194, 380, 293, 12, 70, "Subsection"], Cell[11490, 394, 470, 13, 70, "Subsection"], Cell[CellGroupData[{ Cell[11983, 409, 274, 6, 70, "Subsection"], Cell[12260, 417, 173, 9, 70, "Special3"], Cell[12436, 428, 264, 5, 70, "Special2"] }, Open ]], Cell[CellGroupData[{ Cell[12732, 435, 65, 1, 70, "Subsection"], Cell[12800, 438, 226, 5, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[13067, 445, 70, 1, 70, "Section"], Cell[13140, 448, 283, 9, 70, "Special1"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)