(************** 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[ 27328, 919]*) (*NotebookOutlinePosition[ 28189, 950]*) (* CellTagsIndexPosition[ 28145, 946]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{Cell[TextData[{ "Example 05\nTwo Dimensional Graphics\nUsing ", StyleBox["Plot[]", FontFamily->"Courier"] }], "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. The bare ", StyleBox["Plot[]", FontFamily->"Courier"], " command.\n2. The general function ", StyleBox["Options[]", FontFamily->"Courier"], ".\n3. Eliminating ", StyleBox["-Graphics-", FontFamily->"Courier"], " .\n4. Resizing a plot area.\n5. Reading out graph coordinates.\n6. \ Displaying multiple graphs on a single plot using one ", StyleBox["Plot[]", FontFamily->"Courier"], " command.\n7. The general structure of ", StyleBox["Plot[]", FontFamily->"Courier"], " options.\n8. Curve options: ", StyleBox["Compiled", FontFamily->"Courier"], ", ", StyleBox["PlotPoints", FontFamily->"Courier"], ", ", StyleBox["PlotDivision", FontFamily->"Courier"], ",\n ", StyleBox["MaxBend", FontFamily->"Courier"], ".\n9. \"Appearance\" Options\n a. Axes: ", StyleBox["Axes", FontFamily->"Courier"], ", ", StyleBox["AxesLabel", FontFamily->"Courier"], ", ", StyleBox["AxesOrigin", FontFamily->"Courier"], ", ", StyleBox["AxesStyle", FontFamily->"Courier"], ".\n b. Frame: ", StyleBox["Frame", FontFamily->"Courier"], ", ", StyleBox["FrameStyle", FontFamily->"Courier"], ", ", StyleBox["FrameLabel", FontFamily->"Courier"], ", ", StyleBox["Ticks", FontFamily->"Courier"], ",\n ", StyleBox["FrameTicks", FontFamily->"Courier"], ".\n c. General: ", StyleBox["AspectRatio", FontFamily->"Courier"], ", ", StyleBox["PlotLabel", FontFamily->"Courier"], ", ", StyleBox["DefaultFont", FontFamily->"Courier"], ", \n ", StyleBox["Background", FontFamily->"Courier"], ", ", StyleBox["DefaultColor", FontFamily->"Courier"], ", ", StyleBox["GridLines", FontFamily->"Courier"], ", ", StyleBox["PlotRange", FontFamily->"Courier"], ",\n ", StyleBox["PlotStyle", FontFamily->"Courier"], ".\n d. Graphics Directives: ", StyleBox["RGBColor[]", FontFamily->"Courier"], ", ", StyleBox["Thickness[]", FontFamily->"Courier"], ", ", StyleBox["GrayLevel[]", FontFamily->"Courier"], ".\n10. Assigning names to plots.\n11. Plotting multiple graphs on a \ single plot using ", StyleBox["Show[]", FontFamily->"Courier"], ".\n12. Miscellaneous option: ", StyleBox["DisplayFunction", FontFamily->"Courier"], ".\n13. ", StyleBox["GraphicsArray[]", FontFamily->"Courier"], ".\n14. Animation." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Problem", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ An object moves vertically in one dimension near the surface of the earth \ under the force due to gravity. Assuming that the object is launched from \ the origin and that the x-axis points vertically upward, the relevant \ equations are\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ " \t", StyleBox["v[t] = v[0] - gt\n\tx[t] = v[0]t - (1/2)gt", FontFamily->"Courier"], StyleBox["2", FontFamily->"Courier", FontVariations->{"CompatibilityType"->"Superscript"}], StyleBox[",", FontFamily->"Courier"] }], "Special1", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "where g = 9.8 m/s", StyleBox["2", FontVariations->{"CompatibilityType"->"Superscript"}], ". Plot v[t] and x[t] as a function of t when the initial velocity \ v[0] equals 20 m/s and 40 m/s." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Solution: Creating the Appropriate Functions", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell[TextData[{ "Step 1 - Complete the code below which creates the functions ", StyleBox["x[vo,t]", FontFamily->"Courier"], " and ", StyleBox["v[vo,t]", FontFamily->"Courier"], " that allows you to calculate the position and velocity of the object as \ a function of the initial velocity vo and the time t. When you're done, \ activate the cell." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Clear[g, vo, t, v, x] g = 9.8; v[vo_, t_] = x[vo_, t_] = \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 1. You could have included g as an argument in the functions. What would \ be the advantages and disadvantages of doing so? 2. Did you use semicolons to suppress any output? If so, why? If not, why \ not?\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Solution: The Bare Plot", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Step 1 - Use help and extended help to find and describe the MMA command for \ plotting curves in two dimension.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. How do the results for the commands ", StyleBox["?", FontFamily->"Courier"], " and ", StyleBox["??", FontFamily->"Courier"], " applied to ", StyleBox["Plot[]", FontFamily->"Courier"], " differ?\n2. ", StyleBox["Options[]", FontFamily->"Courier"], " looks like a function. It is. When applied to the head of a function, \ it gives the options of a function, but not the function's usage statement. \ You'll use this command later on.\n3. For now, don't worry about the options \ to ", StyleBox["Plot[]", FontFamily->"Courier"], ". To start with, just concentrate on the bare ", StyleBox["Plot[]", FontFamily->"Courier"], " command. What do you know about this command so far?" }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell["\<\ Step 2 - For vo = 20, plot x[vo, t] from t = 0.0 to 5.0. Describe \ what you see displayed.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 2", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Select the cell containing the plot by clicking on its cell boundary. \ Then use the ", StyleBox["Format \\ Style Inspector", FontFamily->"Helvetica"], " on the NeXT or ", StyleBox["Style \\ Cell Style", FontFamily->"Helvetica"], " on the Mac to find out the cell style for the cell containing the plot. \ \n2. What's the cell style of the cell containing the word ", StyleBox["-Graphics-", FontFamily->"Courier"], " ? \n3. The cell with ", StyleBox["-Graphics-", FontFamily->"Courier"], " doesn't seem to serve a purpose other than bookkeeping. You can prevent \ this cell from appearing on the screen by putting a semicolon after ", StyleBox["Plot[]", FontFamily->"Courier"], ". Try it.\n4. In your function ", StyleBox["x[vo,t]", FontFamily->"Courier"], ", should you replace vo by 20 or 20.0?" }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell["\<\ Step 3 - Click inside the graph. You should see an outline of a box appear \ around the plot that has eight handles. Click and drag one of the handles. \ Describe what happens. Note that you can't move the sides of the outlined \ box independently. Why not? \ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 3", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. The aspect ratio is preserved unless you uncheck \"Preserve aspect \ ratio\" in NeXT's Style Inspector's ", StyleBox["Graphics Attributes ", FontFamily->"Helvetica"], " menu or in the menu item ", StyleBox["Graph", FontFamily->"Helvetica"], " on the Mac." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 4 - Disable the ", StyleBox["Preserve aspect ratio", FontFamily->"Helvetica"], ", and then click and drag on one of the handles in the plot area. What \ happens now?" }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 5 - Read out coordinates in the graph region by clicking on the graph \ to highlight it, holding down the", StyleBox[" ", FontFamily->"Helvetica"], " key, and moving the mouse without clicking. Coordinates are displayed \ in the bottom right corner of the MMA window on the NeXT and in the bottom \ left corner on the Mac." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 6 - Plot graphs of x[t] versus t for vo equal to 20.0 and \ 40.0 on the same plot. To do so, just include the functions to be plotted \ in a list as the first argument of ", StyleBox["Plot[]", FontFamily->"Courier"], "." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell[TextData[{ "Solution - Comments on ", StyleBox["Plot[]", FontFamily->"Courier"], "'s Options" }], "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 1 - Find out the possible options for ", StyleBox["Plot[]", FontFamily->"Courier"], " by using the MMA function ", StyleBox["Options[]", FontFamily->"Courier"], "." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. The options are all in the form of rules with the right hand side of \ the rules set to various values or expressions. Where else have you seen \ rules used?\n2. The options listed above have the default settings; other \ possible setting are discussed in Wolfram, A.8, \"Listing of Built-in ", StyleBox["Mathematica", FontSlant->"Italic"], " Objects\".\n3. Automatic setting use various internal algorithms to \ choose appropriate values for parameters. \n4. Options are added to the ", StyleBox["Plot[]", FontFamily->"Courier"], " command after the range specification in ", StyleBox["Plot[]", FontFamily->"Courier"], "'s argument. Each option is separated from one another by commas.\n5. \ There are two classes of options for ", StyleBox["Plot[]", FontFamily->"Courier"], ": (1) those that effect the calculation of the curve, and (2) those \ that enhance the overall appearance of the graph." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Solution - \"Curve\" Options", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1\t", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. There are four \"curve\" options specific to ", StyleBox["Plot[]", FontFamily->"Courier"], ".\n2. ", StyleBox["Compiled -> True", FontFamily->"Courier"], " causes expressions to be automatically compiled. Why might you want to \ do this? If you need high precision, you should set this option to ", StyleBox["False", FontFamily->"Courier"], ".\n3. ", StyleBox["PlotPoints", FontFamily->"Courier"], " gives the minimum number of points sampled. This is usually the option \ you should try if you want to increase resolution.\n4. ", StyleBox["PlotDivision", FontFamily->"Courier"], " gives the maximum number of times an interval is subdivided.\n5. ", StyleBox["MaxBend", FontFamily->"Courier"], " is the maximum angle (in degrees) between sampled points, consistent \ with the value of ", StyleBox["PlotDivision", FontFamily->"Courier"], ". \n6. See Blachman, Sec. 4.2.2, for a nice example of plotting problems \ that can occur because of MMA's adaptive sampling procedure." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Solution - \"Appearance\" Options", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["\<\ Step 1 - You're going to look at a small, but useful set of plot options in \ some detail and the remaining options more superficially. Activate the cell \ below and ascertain what the various options are doing.\ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], PlotRange -> {{0, 4.5}, {0, 25}} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Get help on each of the four options used in the plot above.\n2. Get \ help on the graphics directives ", StyleBox["RGBColor[]", FontFamily->"Courier"], " and ", StyleBox["FontForm[]", FontFamily->"Courier"], ".\n3. Note how strings, the stuff between double quotes, are used for \ plotting purposes." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell[TextData[{ "Step 2 - Activate the following cells to get a feeling for some of the \ other options that are available for ", StyleBox["Plot[]", FontFamily->"Courier"], "." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], AspectRatio -> 0.25 ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], AxesOrigin -> {2.1, 0.0} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], Axes -> {True, False} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> \"Position versus Time\", DefaultFont -> {\"Helvetic-Bold\", 16} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], AxesStyle -> {RGBColor[0, 0, 1], Thickness[0.02]} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], Background -> GrayLevel[0.5] ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], DefaultColor -> RGBColor[0.2, 0, 1] ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], AxesLabel -> {\"t\", \"x\"}, PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], Ticks -> {{2, 4}, Automatic} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], Frame -> True, FrameLabel -> {\"t\", \"x\"}, FrameStyle -> RGBColor[0, 0, 1] ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], PlotLabel -> FontForm[\"Position versus Time\", {\"Helvetica-Bold\", 12}], Frame -> True, FrameLabel -> {\"t\", \"x\", \"x vs t\", \"\"}, FrameTicks -> {{0, 2, 4}, {-15, 0, 15}}, GridLines -> { {0, 2, 4}, {-15, 0, 15}}, PlotRange -> {-30, 30} ]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 2", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Frame diagrams are quite useful. One can get a lot of milage out of \ the options ", StyleBox["Frame", FontFamily->"Courier"], " and ", StyleBox["FrameLabel", FontFamily->"Courier"], ". The latter option is a cheap way to title your plot as well as label \ the axes." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]]}, Open]], Cell[CellGroupData[{Cell["Multiple Plots", "Section", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "Step 1 - Produce four separate framed plots: ", StyleBox["x[20,t]", FontFamily->"Courier"], ", ", StyleBox["v[20,t]", FontFamily->"Courier"], ", ", StyleBox["x[40,t]", FontFamily->"Courier"], ", and ", StyleBox["v[40,t]", FontFamily->"Courier"], ". Each plot should have its axes appropriately labeled. Draw the curves \ in a different color for each value of v[0]. Assign the plots the names ", StyleBox["plotx1", FontFamily->"Courier"], ", ", StyleBox["plotv1", FontFamily->"Courier"], ", ", StyleBox["plotx2", FontFamily->"Courier"], ", and ", StyleBox["plotv2", FontFamily->"Courier"], ", respectively. In writing your code, make liberal use of copy and paste. \ " }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 1", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 1. Why might it be useful to assign names to plots? 2. An error message appears. What's it about?\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 2 - Display ", StyleBox["plotx1", FontFamily->"Courier"], " and ", StyleBox["plotx2", FontFamily->"Courier"], " together, and ", StyleBox["plotv1", FontFamily->"Courier"], " and ", StyleBox["plotv2", FontFamily->"Courier"], " together by using the MMA command ", StyleBox["Show[]", FontFamily->"Courier"], ". " }], "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["Show[]", FontFamily->"Courier"], "? If not, do so.\n2. How else have you displayed multiple graphs on the \ same plot? How does that technique compare to the technique using ", StyleBox["Show[]", FontFamily->"Courier"], "?" }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["\<\ Step 3 - Suppose you didn't want the individual plots to be shown, but just \ the composite ones. To do so, you can insert the option \ \>", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ StyleBox[" ", FontFamily->"Courier", FontWeight->"Bold"], StyleBox["DisplayFunction -> Identity", FontFamily->"Courier", FontSize->14, FontWeight->"Bold"], " " }], "Text", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ StyleBox["in each individual plots and then the option ", FontSize->14, FontWeight->"Bold"], " " }], "Text", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ StyleBox[" ", FontFamily->"Courier", FontWeight->"Bold"], StyleBox["DisplayFunction -> $DisplayFunction", FontFamily->"Courier", FontSize->14, FontWeight->"Bold"] }], "Text", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ StyleBox["in ", FontSize->14, FontWeight->"Bold"], StyleBox["Show[]", FontFamily->"Courier", FontSize->14, FontWeight->"Bold"], StyleBox[". Try this out by activating the two cells below.", FontSize->14, FontWeight->"Bold"] }], "Text", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Clear[plotx1, plotv1, plotx2, plotv2] plotx1 = Plot[x[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], Frame -> True, FrameLabel -> {\"t\", \"x\"}, DisplayFunction -> Identity]; plotv1 = Plot[v[20, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], Frame -> True, FrameLabel -> {\"t\", \"v\"}, DisplayFunction -> Identity]; plotx2 = Plot[x[40, t], {t, 0, 5.0}, PlotStyle -> RGBColor[0, 0, 1], Frame -> True, FrameLabel -> {\"t\", \"x\"}, DisplayFunction -> Identity]; plotv2 = Plot[v[40, t], {t, 0, 5.0}, PlotStyle -> RGBColor[0, 0, 1], Frame -> True, FrameLabel -> {\"t\", \"v\"}, DisplayFunction -> Identity]; \ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Show[plotx1, plotx2, DisplayFunction -> $DisplayFunction]; Show[plotv1, plotv2, DisplayFunction -> $DisplayFunction];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 3", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Options placed in ", StyleBox["Show[] ", FontFamily->"Courier"], "override those in the individual graphics.\n2. The symbol ", StyleBox["$", FontFamily->"Courier"], " signifies pre-defined global variables. Get help on ", StyleBox["$DisplayFunction", FontFamily->"Courier"], " and then locate all the symbol that have a ", StyleBox["$", FontFamily->"Courier"], " in front." }], "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell[TextData[{ "Step 4 - You can produce a two dimension graphics array of plots using a \ combination of the MMA functions ", StyleBox["GraphicArray[]", FontFamily->"Courier"], " and ", StyleBox["Show[]", FontFamily->"Courier"], ". Get help on ", StyleBox["GraphicsArray[]", FontFamily->"Courier"], " and then activate the cell below. You should find that the first row \ has ", StyleBox["plotx1", FontFamily->"Courier"], " and ", StyleBox["plotv1", FontFamily->"Courier"], ", while the second row has ", StyleBox["plotx2", FontFamily->"Courier"], " and ", StyleBox["plotv2", FontFamily->"Courier"], "." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Show[ GraphicsArray[{{plotx1, plotv1}, {plotx2, plotv2}}]];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell["Comment 4", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ 1. You may need to enlarge the graphics to see the individual plots better. \ How do you do this?\ \>", "Special1", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[CellGroupData[{Cell[TextData[{ "Step 5 - Active the following cell which produces a table of plots of \ x[t] for vo going from 0 to 40 in steps of 5. The option\n\n ", StyleBox["PlotRange -> {-100, 100}\n", FontFamily->"Courier"], "\nis included so that all the plots have the same range." }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell["\<\ Table[Plot[x[vo, t], {t, 0, 5.0}, PlotStyle -> RGBColor[1, 0, 0], Frame -> True, FrameLabel -> {\"t\", \"x\"}, PlotRange -> {-100, 100}], {vo, 0, 40, 5}];\ \>", "Input", ImageRegion->{{0, 1}, {0, 1}}]}, Open]], Cell[TextData[{ "Step 6 - Double-click on the cell grouping for the plots and collapse the \ cells to a single cell. Then press ", StyleBox["-y", FontFamily->"Helvetica"], ". What happens?" }], "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[CellGroupData[{Cell["Comment 6", "Subsection", ImageRegion->{{0, 1}, {0, 1}}], Cell[TextData[{ "1. Play with the animation controls.\n2. You could also activate \ animation with ", StyleBox["Graph \\ Animate Selected Graphics", FontFamily->"Helvetica"], ".\n3. Do you see why it was nice to have the same range on all the plots?\ \n4. Never save a file containing lots of graphics. Why?\n5. Where else \ might grouping cells be useful?" }], "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[" myEx05", 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->{{220, Automatic}, {23, Automatic}}, 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, 160, 5, 70, "Title"], Cell[1890, 59, 265, 7, 70, "Subsubtitle"], Cell[CellGroupData[{ Cell[2178, 68, 69, 1, 70, "Section"], Cell[2250, 71, 2592, 101, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[4874, 174, 59, 1, 70, "Section"], Cell[4936, 177, 299, 6, 70, "Special1"], Cell[5238, 185, 303, 10, 70, "Special1"], Cell[5544, 197, 278, 7, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[5854, 206, 97, 1, 70, "Section"], Cell[CellGroupData[{ Cell[5974, 209, 424, 11, 70, "Subsection"], Cell[6401, 222, 116, 6, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[6549, 230, 64, 1, 70, "Subsection"], Cell[6616, 233, 272, 6, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[6929, 241, 76, 1, 70, "Section"], Cell[7008, 244, 176, 4, 70, "Subsection"], Cell[CellGroupData[{ Cell[7207, 250, 64, 1, 70, "Subsection"], Cell[7274, 253, 812, 24, 70, "Special1"] }, Open ]], Cell[8098, 279, 164, 4, 70, "Subsection"], Cell[CellGroupData[{ Cell[8285, 285, 64, 1, 70, "Subsection"], Cell[8352, 288, 939, 24, 70, "Special1"] }, Open ]], Cell[9303, 314, 326, 6, 70, "Subsection"], Cell[CellGroupData[{ Cell[9652, 322, 64, 1, 70, "Subsection"], Cell[9719, 325, 346, 10, 70, "Special1"] }, Open ]], Cell[10077, 337, 250, 7, 70, "Subsection"], Cell[10330, 346, 417, 9, 70, "Subsection"], Cell[10750, 357, 316, 8, 70, "Subsection"] }, Open ]], Cell[CellGroupData[{ Cell[11098, 367, 158, 6, 70, "Section"], Cell[11259, 375, 258, 9, 70, "Subsection"], Cell[CellGroupData[{ Cell[11540, 386, 64, 1, 70, "Subsection"], Cell[11607, 389, 1017, 21, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[12665, 412, 80, 1, 70, "Section"], Cell[CellGroupData[{ Cell[12768, 415, 66, 1, 70, "Subsection"], Cell[12837, 418, 1117, 28, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[13995, 448, 85, 1, 70, "Section"], Cell[CellGroupData[{ Cell[14103, 451, 275, 5, 70, "Subsection"], Cell[14381, 458, 321, 10, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[14734, 470, 64, 1, 70, "Subsection"], Cell[14801, 473, 395, 11, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[15228, 486, 239, 7, 70, "Subsection"], Cell[15470, 495, 316, 10, 70, "Input"], Cell[15789, 507, 317, 10, 70, "Input"], Cell[16109, 519, 310, 10, 70, "Input"], Cell[16422, 531, 277, 9, 70, "Input"], Cell[16702, 542, 338, 10, 70, "Input"], Cell[17043, 554, 321, 10, 70, "Input"], Cell[17367, 566, 324, 10, 70, "Input"], Cell[17694, 578, 317, 10, 70, "Input"], Cell[18014, 590, 349, 11, 70, "Input"], Cell[18366, 603, 471, 13, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[18869, 618, 64, 1, 70, "Subsection"], Cell[18936, 621, 360, 11, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[19337, 634, 66, 1, 70, "Section"], Cell[19406, 637, 818, 29, 70, "Subsection"], Cell[CellGroupData[{ Cell[20247, 668, 64, 1, 70, "Subsection"], Cell[20314, 671, 161, 4, 70, "Special1"] }, Open ]], Cell[20487, 677, 434, 18, 70, "Subsection"], Cell[CellGroupData[{ Cell[20944, 697, 64, 1, 70, "Subsection"], Cell[21011, 700, 349, 10, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[21392, 712, 203, 4, 70, "Subsection"], Cell[21598, 718, 251, 10, 70, "Text"], Cell[21852, 730, 177, 6, 70, "Text"], Cell[22032, 738, 251, 9, 70, "Text"], Cell[22286, 749, 320, 12, 70, "Text"], Cell[22609, 763, 969, 28, 70, "Input"], Cell[23581, 793, 185, 6, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[23798, 801, 64, 1, 70, "Subsection"], Cell[23865, 804, 486, 15, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[24383, 821, 728, 26, 70, "Subsection"], Cell[25114, 849, 118, 4, 70, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[25264, 855, 64, 1, 70, "Subsection"], Cell[25331, 858, 160, 4, 70, "Special1"] }, Open ]], Cell[CellGroupData[{ Cell[25523, 864, 348, 7, 70, "Subsection"], Cell[25874, 873, 249, 8, 70, "Input"] }, Open ]], Cell[26135, 883, 262, 7, 70, "Subsection"], Cell[CellGroupData[{ Cell[26420, 892, 64, 1, 70, "Subsection"], Cell[26487, 895, 423, 9, 70, "Special1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[26951, 906, 70, 1, 70, "Section"], Cell[27024, 909, 283, 9, 70, "Special1"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)