(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 4.2' 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[ 6811, 247]*) (*NotebookOutlinePosition[ 7503, 271]*) (* CellTagsIndexPosition[ 7459, 267]*) (*WindowFrame->Normal*) Notebook[{ Cell["Solving Equations, Tables, Parametric Plots, ListPlots", "Title"], Cell["\<\ Tuesday, September 19, 2006 Created by Jason Sherman and Bryan Loughry\ \>", "Subsubtitle"], Cell["These two commands load functions that are used later", "Text"], Cell[BoxData[ \(<< Graphics`Graphics`\)], "Input"], Cell[BoxData[ StyleBox[\(<< Graphics`Graphics3D`\), FormatType->StandardForm]], "Input"], Cell["Solving Equations using Solve and FindRoot", "Subsubsection"], Cell[BoxData[ \(\(?Solve\)\)], "Input"], Cell["\<\ The command Solve[ ] works on many functions including polynomials, \ rationals, and simple trig functions. Note the use of a Double-Equals -Sign \ == in the equation.\ \>", "Text"], Cell[BoxData[ \(\(\(Solve[x^2 - 9 == 0, x]\)\(\[IndentingNewLine]\) \)\)], "Input"], Cell[BoxData[ \(Solve[x^2 - x - 3 \[Equal] 0, x]\)], "Input"], Cell[BoxData[ \(Solve[a*x^2 + b*x + c \[Equal] 0, x]\)], "Input"], Cell["\<\ Solve[ ] does not work on everything... sometimes, we need to get a solution \ \"numerically\"\ \>", "Text"], Cell[BoxData[ \(Solve[Cos[x] - x \[Equal] 0, x]\)], "Input"], Cell["\<\ This equation does have a solution as the plot below shows...but Sovle[ ] \ does not work.\ \>", "Text"], Cell[BoxData[ \(Plot[Cos[x] - x, {x, \(-2\)*Pi, 2*Pi}]\)], "Input"], Cell["\<\ The command we need here is FindRoot[ ] . Note that FindRoot[ ] needs an \ 'initial guess' which we can often get from a plot.\ \>", "Text"], Cell[BoxData[ \(\(?FindRoot\)\)], "Input"], Cell[BoxData[ \(FindRoot[Cos[x] - x \[Equal] 0, {x, 1}]\)], "Input"], Cell["Building lists with Table", "Subsubsection"], Cell["We can use the Table function to build lists.", "Text"], Cell[BoxData[ \(\(?Table\)\)], "Input"], Cell[BoxData[ \(Table[i^2, {i, 0, 10}]\)], "Input"], Cell[BoxData[ \(F = Table[Exp[\(-b\)*x], {b, 1, 10}]\)], "Input"], Cell[BoxData[ \(F[\([2]\)]\)], "Input"], Cell["\<\ We can plot a list of functions using Plot. Notice the use of Evaluate due \ to Plots nonstandard evaluation procedure.\ \>", "Text"], Cell[BoxData[ \(Plot[Evaluate[F], {x, 0, 4}, PlotRange \[Rule] All, PlotLabel \[Rule] StyleForm["\", FontSize \[Rule] 14]]\)], "Input"], Cell[BoxData[ \(f[x_] := x^4\)], "Input"], Cell[BoxData[ \(D[f[x], {x, 1}]\)], "Input"], Cell[BoxData[ \(derivs = Table[D[f[x], {x, i}], {i, 0, 5}]\)], "Input"], Cell[BoxData[ \(derivs[\([3]\)]\)], "Input"], Cell[BoxData[ \(P = Table[Plot[Evaluate[D[f[x], {x, i}]], {x, \(-2\), 2}, PlotStyle \[Rule] Hue[i/5]], {i, 0, 4}]\)], "Input"], Cell["\<\ We can display all of the plots the table on one graph with show.\ \>", "Text"], Cell[BoxData[ \(Show[P[\([1]\)], P[\([2]\)], P[\([3]\)], P[\([4]\)], P[\([5]\)]]\)], "Input"], Cell["Show works with lists too.", "Text"], Cell[BoxData[ \(Show[P]\)], "Input"], Cell["Parametric Plots", "Subsubsection"], Cell["\<\ Use ParametricPlot and ParametricPlot3D for graphing parametrized \ functions.\ \>", "Text"], Cell[BoxData[ \(ParametricPlot[{Cos[t], 2*Sin[t]}, {t, \(-Pi\), Pi}]\)], "Input"], Cell[BoxData[ \(ParametricPlot[{Sin[t]/t, Cos[t]/t}, {t, 0, 10*Pi}]\)], "Input"], Cell[BoxData[{ \(f[t_] := \((Exp[Cos[t]] - 2 Cos[4\ t] + Sin[t/12]^5)\)* Cos[t]\), "\[IndentingNewLine]", \(g[t_] := \((Exp[Cos[t]] - 2 Cos[4\ t] + Sin[t/12]^5)\)* Sin[t]\)}], "Input"], Cell[BoxData[ \(ParametricPlot[{f[t], g[t]}, {t, 0, 2*Pi}, AspectRatio \[Rule] Automatic]\)], "Input"], Cell[BoxData[{ \(f[t_] := 1 - t\), "\[IndentingNewLine]", \(g[t_] := 2 + t\), "\[IndentingNewLine]", \(h[t_] := \(-1\) + 2*t\)}], "Input"], Cell[BoxData[ \(ParametricPlot3D[{f[t], g[t], h[t]}, {t, 0, 2}]\)], "Input"], Cell[BoxData[{ \(x[t_] := Cos[4 t]\), "\[IndentingNewLine]", \(y[t_] := Sin[4 t]\), "\[IndentingNewLine]", \(z[t_] := t\)}], "Input"], Cell[BoxData[ \(p1 = ParametricPlot3D[{x[t], y[t], z[t]}, {t, 0, 2*Pi}]\)], "Input"], Cell["\<\ Use list plot to graph a list of values or a list of points. \ \>", "Text"], Cell[BoxData[ \(\(?ListPlot\)\)], "Input"], Cell[BoxData[{ \(\(list1\ = \ {1, 1.5, 9, 2, 6};\)\), "\[IndentingNewLine]", \(ListPlot[list1]\)}], "Input"], Cell[BoxData[{ \(list2\ = {{1, 1}, {2, 1.5}, {3, 9}, {4, 2}, {5, 6}}\), "\[IndentingNewLine]", \(ListPlot[list2, \ PlotStyle \[Rule] \ PointSize[ .015]]\)}], "Input"], Cell[BoxData[ \(f[x_]\ = \ Sin[x]*x^2\)], "Input"], Cell[BoxData[ \(list3\ = \ Table[f[x], {x, 0, 2\ Pi, Pi/8}]\)], "Input"], Cell["\<\ This is a graph of the values but they don't corespond to the x values.\ \>", "Text"], Cell[BoxData[ \(ListPlot[list3, \ PlotStyle \[Rule] \ PointSize[ .015]]\)], "Input"], Cell["This is better.", "Text"], Cell[BoxData[ \(list4\ = \ Table[{x, f[x]}, {x, 0, 2\ Pi, Pi/8}]\)], "Input"], Cell[BoxData[ \(ListPlot[list4, \ PlotStyle \[Rule] \ PointSize[ .015]]\)], "Input"] }, FrontEndVersion->"4.2 for Macintosh", ScreenRectangle->{{0, 1024}, {0, 742}}, WindowSize->{1024, 720}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, ShowSelection->True, StyleDefinitions -> "DemoText.nb" ] (******************************************************************* 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[1754, 51, 71, 0, 64, "Title"], Cell[1828, 53, 101, 3, 76, "Subsubtitle"], Cell[1932, 58, 69, 0, 35, "Text"], Cell[2004, 60, 54, 1, 42, "Input"], Cell[2061, 63, 98, 2, 42, "Input"], Cell[2162, 67, 67, 0, 43, "Subsubsection"], Cell[2232, 69, 43, 1, 42, "Input"], Cell[2278, 72, 194, 4, 60, "Text"], Cell[2475, 78, 91, 2, 65, "Input"], Cell[2569, 82, 65, 1, 42, "Input"], Cell[2637, 85, 69, 1, 42, "Input"], Cell[2709, 88, 118, 3, 35, "Text"], Cell[2830, 93, 64, 1, 42, "Input"], Cell[2897, 96, 114, 3, 35, "Text"], Cell[3014, 101, 71, 1, 42, "Input"], Cell[3088, 104, 151, 3, 60, "Text"], Cell[3242, 109, 46, 1, 42, "Input"], Cell[3291, 112, 72, 1, 42, "Input"], Cell[3366, 115, 50, 0, 43, "Subsubsection"], Cell[3419, 117, 61, 0, 35, "Text"], Cell[3483, 119, 43, 1, 42, "Input"], Cell[3529, 122, 55, 1, 42, "Input"], Cell[3587, 125, 69, 1, 42, "Input"], Cell[3659, 128, 43, 1, 42, "Input"], Cell[3705, 131, 144, 3, 35, "Text"], Cell[3852, 136, 169, 3, 65, "Input"], Cell[4024, 141, 45, 1, 42, "Input"], Cell[4072, 144, 48, 1, 42, "Input"], Cell[4123, 147, 75, 1, 42, "Input"], Cell[4201, 150, 48, 1, 42, "Input"], Cell[4252, 153, 148, 3, 42, "Input"], Cell[4403, 158, 89, 2, 35, "Text"], Cell[4495, 162, 104, 2, 42, "Input"], Cell[4602, 166, 42, 0, 35, "Text"], Cell[4647, 168, 40, 1, 42, "Input"], Cell[4690, 171, 41, 0, 43, "Subsubsection"], Cell[4734, 173, 102, 3, 35, "Text"], Cell[4839, 178, 85, 1, 42, "Input"], Cell[4927, 181, 84, 1, 42, "Input"], Cell[5014, 184, 211, 4, 65, "Input"], Cell[5228, 190, 113, 2, 42, "Input"], Cell[5344, 194, 152, 3, 88, "Input"], Cell[5499, 199, 80, 1, 42, "Input"], Cell[5582, 202, 149, 3, 88, "Input"], Cell[5734, 207, 88, 1, 42, "Input"], Cell[5825, 210, 85, 2, 35, "Text"], Cell[5913, 214, 46, 1, 42, "Input"], Cell[5962, 217, 118, 2, 65, "Input"], Cell[6083, 221, 187, 3, 65, "Input"], Cell[6273, 226, 55, 1, 42, "Input"], Cell[6331, 229, 77, 1, 42, "Input"], Cell[6411, 232, 95, 2, 35, "Text"], Cell[6509, 236, 88, 1, 42, "Input"], Cell[6600, 239, 31, 0, 35, "Text"], Cell[6634, 241, 82, 1, 42, "Input"], Cell[6719, 244, 88, 1, 42, "Input"] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)