(************** 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[ 8539, 263]*) (*NotebookOutlinePosition[ 9238, 287]*) (* CellTagsIndexPosition[ 9194, 283]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Animated Wave Equation Solutions", "Title", CellFrame->True, TextAlignment->Center, TextJustification->0, Background->RGBColor[0, 1, 0]], Cell["\<\ This notebook is by Steven Amgott. Please send any questions or comments to \ samgott1@swarthmore.edu. Feel free to use and distribute this notebook, but \ keep this author information in any copy you use or distribute.\ \>", "SmallText"], Cell[TextData[{ "In the input cells in this notebook anything in ", StyleBox["magenta", FontColor->RGBColor[1, 0, 1]], " is something you can, and possibly should, change." }], "Text"], Cell[CellGroupData[{ Cell["A string with fixed ends.", "Section"], Cell["\<\ The cell below defines y(x,t) as the solution to the wave equation with fixed \ ends, a finite Fourier sine series initial condition on displacement, and no \ initial velocity.\ \>", "Text"], Cell[BoxData[{ \(Clear[y, x, t, b, n, l, a]\), "\n", \(y[x_, t_] := \[Sum]\+\(n = 1\)\%\(Length[b]\)b[\([n]\)]\ Sin[\(n\ \[Pi]\ \ x\)\/l] Cos[\(n\ \[Pi]\ a\ t\)\/l]\)}], "Input"], Cell[TextData[{ "The next cell produces the graphs for animation. Make sure to have ", StyleBox["b", FontColor->RGBColor[1, 0, 1]], " as a vector (even if it only has one coordinate). ", StyleBox["a", FontColor->RGBColor[1, 0, 1]], " is the proportionality constant from the wave equation, ", StyleBox["l", FontColor->RGBColor[1, 0, 1]], " is the length of the string, ", StyleBox["b", FontColor->RGBColor[1, 0, 1]], " is the vector of coefficients of the Fourier sine series of the initial \ displacement, and ", StyleBox["m", FontColor->RGBColor[1, 0, 1]], " is the number of frames you wish to produce." }], "Text"], Cell[BoxData[{\(Clear[x, t, k, n, m, l, i, a]\), "\n", RowBox[{ RowBox[{"a", "=", StyleBox["1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"l", "=", StyleBox["1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"b", "=", RowBox[{"{", StyleBox["1", FontColor->RGBColor[1, 0, 1]], "}"}]}], ";"}], "\n", RowBox[{ RowBox[{"m", "=", StyleBox["20", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", \(Do[ Plot[y[x, \(2\ l\ i\)\/\(a\ m\)], {x, 0, l}, PlotRange \[Rule] {\(-2\)\ Max[Abs[b]], 2 Max[Abs[b]]}], {i, 0, m}];\)}], "Input"], Cell[TextData[{ "To see the animation, evaluate the cell, select the entire collection of \ output graphs, and choose ", StyleBox["Animate Selected Graphics", FontColor->RGBColor[0, 0, 1]], " from the ", StyleBox["Cell", FontColor->RGBColor[0, 0, 1]], " menu item. VCR like controls will appear at the bottom of the notebook \ window so that you can slow (or speed) the animation, pause it, and do other \ operations." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["A string with one end free.", "Section"], Cell["\<\ The cell below defines y(x,t) as the solution to the wave equation with a \ free end at l, a finite Fourier sine series initial condition on \ displacement, and no initial velocity.\ \>", "Text"], Cell[BoxData[{ \(Clear[y, x, t, b, n, l, a]\), "\n", \(y[x_, t_] := \[Sum]\+\(n = 1\)\%\(Length[b]\)b[\([n]\)]\ Sin[\(\((2 n - 1)\ \)\ \[Pi]\ x\)\/\(2 l\)] Cos[\(\((2 n - 1)\)\ \[Pi]\ a\ t\)\/\(2 l\)]\)}], "Input"], Cell[TextData[{ "The next cell produces the graphs for animation. Make sure to have ", StyleBox["k", FontColor->RGBColor[1, 0, 1]], " as a vector (even if it only has one coordinate). ", StyleBox["a", FontColor->RGBColor[1, 0, 1]], " is the proportionality constant from the wave equation, ", StyleBox["l", FontColor->RGBColor[1, 0, 1]], " is the length of the string, ", StyleBox["b", FontColor->RGBColor[1, 0, 1]], " is the vector of coefficients of the Fourier sine series of the initial \ displacement, and ", StyleBox["m", FontColor->RGBColor[1, 0, 1]], " is the number of frames you wish to produce." }], "Text"], Cell[BoxData[{\(Clear[x, t, b, n, m, l, i, a]\), "\n", RowBox[{ RowBox[{"a", "=", StyleBox["1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"l", "=", StyleBox["1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"b", "=", RowBox[{"{", StyleBox[\(2, 3\), FontColor->RGBColor[1, 0, 1]], "}"}]}], ";"}], "\n", RowBox[{ RowBox[{"m", "=", StyleBox["20", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", \(Do[ Plot[y[x, \(4\ l\ i\)\/\(a\ m\)], {x, 0, l}, PlotRange \[Rule] {\(-2\)\ Max[Abs[b]], 2 Max[Abs[b]]}], {i, 0, m}];\)}], "Input"], Cell[TextData[{ "To see the animation, evaluate the cell, select the entire collection of \ output graphs, and choose ", StyleBox["Animate Selected Graphics", FontColor->RGBColor[0, 0, 1]], " from the ", StyleBox["Cell", FontColor->RGBColor[0, 0, 1]], " menu item. VCR like controls will appear at the bottom of the notebook \ window so that you can slow (or speed) the animation, pause it, and do other \ operations." }], "Text"] }, Closed]], Cell[CellGroupData[{ Cell["A traveling wave.", "Section"], Cell["\<\ The cell below defines y(x,t) as a traveling wave form of the solution to the \ wave equation, and creates the animation.\ \>", "Text"], Cell[BoxData[{\(Clear[x, t, s, y, \[Phi], \[Psi], a]\), "\n", RowBox[{ RowBox[{"a", "=", StyleBox["1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"l", "=", StyleBox["1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{\(\[Phi][s_]\), ":=", StyleBox[\(Sin[2\ \[Pi]\ s]\), FontColor->RGBColor[1, 0, 1]]}], "\n", RowBox[{\(\[Psi][s_]\), ":=", StyleBox["0", FontColor->RGBColor[1, 0, 1]]}], "\n", \(y[x_, t_] := \[Phi][x - a\ t] + \[Psi][x + a\ t]\), "\n", \(m = 20;\), "\n", \(Do[ Plot[y[x, \(l\ i\)\/\(a\ m\)], {x, 0, l}, PlotRange \[Rule] {\(-1\), 1}], {i, 0, m}];\)}], "Input"], Cell[TextData[{ "To see the animation, evaluate the cell, select the entire collection of \ output graphs, and choose ", StyleBox["Animate Selected Graphics", FontColor->RGBColor[0, 0, 1]], " from the ", StyleBox["Cell", FontColor->RGBColor[0, 0, 1]], " menu item. VCR like controls will appear at the bottom of the notebook \ window so that you can slow (or speed) the animation, pause it, and do other \ operations." }], "Text"] }, Closed]] }, Open ]] }, FrontEndVersion->"4.2 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 723}}, AutoGeneratedPackage->None, WindowToolbars->"EditBar", WindowSize->{603, 562}, WindowMargins->{{10, Automatic}, {8, Automatic}} ] (******************************************************************* 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[1776, 53, 150, 4, 186, "Title"], Cell[1929, 59, 250, 4, 44, "SmallText"], Cell[2182, 65, 194, 5, 33, "Text"], Cell[CellGroupData[{ Cell[2401, 74, 44, 0, 59, "Section"], Cell[2448, 76, 200, 4, 52, "Text"], Cell[2651, 82, 196, 4, 74, "Input"], Cell[2850, 88, 662, 18, 90, "Text"], Cell[3515, 108, 728, 21, 166, "Input"], Cell[4246, 131, 451, 11, 71, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[4734, 147, 46, 0, 39, "Section"], Cell[4783, 149, 205, 4, 52, "Text"], Cell[4991, 155, 247, 5, 74, "Input"], Cell[5241, 162, 662, 18, 90, "Text"], Cell[5906, 182, 733, 21, 166, "Input"], Cell[6642, 205, 451, 11, 71, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[7130, 221, 36, 0, 39, "Section"], Cell[7169, 223, 145, 3, 52, "Text"], Cell[7317, 228, 740, 18, 184, "Input"], Cell[8060, 248, 451, 11, 71, "Text"] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)