(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 7795, 254] NotebookOptionsPosition[ 6684, 219] NotebookOutlinePosition[ 7330, 242] CellTagsIndexPosition[ 7287, 239] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell["Plotting with Mathematica", "Subsection"], Cell[TextData[{ "Make a copy of the \"cell\" below this and replace the red words with the \ function you want to graph, enter appropriate limits. (A ", StyleBox["Mathematica", FontSlant->"Italic"], " \"cell\" is all of the lnes within one of the square brackets along the \ right edge of the \"notebook.\" You can copy and paste an entire cell at \ once by clicking on the bracket so that is becomes a thick black line.) \n\n\ To \"execute\" the contents of a cell, move your cursor to anywhere within \ the cell and hit Shift-Enter at the same time. You must \ndo this after you \ define your function. To plot your function move your cursor to the cell \ with the Plot command and hit Shift-Enter at the same time again; a graph \ should appear." }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"v", "[", "t_", "]"}], ":=", " ", StyleBox[ RowBox[{"function", " ", "goes", " ", "here"}], FontColor->RGBColor[1, 0, 0]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["lowerLimit", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["=", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->RGBColor[1, 0, 0]], StyleBox[ RowBox[{"-", "2"}], FontColor->RGBColor[1, 0, 0]]}], StyleBox[";", FontColor->GrayLevel[0]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox["upperLimit", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["=", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->RGBColor[1, 0, 0]], StyleBox["2", FontColor->RGBColor[1, 0, 0]]}], StyleBox[";", FontColor->GrayLevel[0]]}]}], "Input"], Cell["Example 1", "Subsubsection"], Cell[TextData[{ "In the cell below I have replaced the red text above with the text in blue \ so that I plot a cosine function with an amplitude of 0.5. (Notice that in \ ", StyleBox["Mathematica", FontSlant->"Italic"], " all functions start with capital letters.) " }], "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"v", "[", "t_", "]"}], ":=", " ", StyleBox[ RowBox[{"Sin", "[", RowBox[{"2", " ", "\[Pi]", " ", "t"}], "]"}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"lowerLimit", " ", "=", " ", StyleBox[ RowBox[{"-", "1"}], FontColor->RGBColor[0, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"upperLimit", " ", "=", " ", StyleBox["1", FontColor->RGBColor[0, 0, 1]]}], ";"}]}], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"v", "[", "t", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "lowerLimit", ",", "upperLimit"}], "}"}]}], "]"}]], "Input"], Cell["Example 2", "Subsubsection"], Cell["\<\ In the cell below I have defined a function that includes a sum of cosines: \tv[t] = 1*Sin[2 \[Pi] t] + (1/2) Sin[4 \[Pi] t]\ \>", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{"v", "[", "t_", "]"}], ":=", " ", StyleBox[ RowBox[{ RowBox[{"Sin", "[", RowBox[{"2", " ", "\[Pi]", " ", "t"}], "]"}], " ", "+", " ", RowBox[{"0.5", "*", RowBox[{"Sin", "[", RowBox[{"4", " ", "\[Pi]", " ", "t"}], "]"}]}]}], FontColor->RGBColor[0, 0, 1]]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"lowerLimit", " ", "=", " ", RowBox[{"-", "1"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"upperLimit", " ", "=", " ", "1"}], ";"}]}], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"v", "[", "t", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "lowerLimit", ",", "upperLimit"}], "}"}]}], "]"}]], "Input"], Cell["Example 3", "Subsubsection"], Cell[TextData[{ "In the cell below I redo Example 2 in a fancy way: I define the \ coefficients as a function of the index n,\nand the function v[t] as a sum. \ If the upper limit of the sum is n=", StyleBox["2", FontColor->RGBColor[0, 1, 0]], ", then I recover Example 2,\nbut I can easily let the sum extend to much \ higher values. There are palletes with things like summation signs, \nbut \ you can just write things out too. \n\nWith my limits for n this function is\ \n\n\tv[t] = 1*Sin[2 \[Pi] t] + (1/2)*Sin[4 \[Pi] t]\n\t\nYou can adjust the \ limits as you like." }], "Text"], Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{ RowBox[{ StyleBox[ RowBox[{ RowBox[{"a", "[", "n_", "]"}], "=", " ", RowBox[{"1", "/", "n"}]}], FontColor->RGBColor[0, 0, 1]], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"v", "[", "t_", "]"}], ":=", " ", RowBox[{ StyleBox["Sum", FontColor->RGBColor[0, 0, 1]], StyleBox["[", FontColor->RGBColor[0, 0, 1]], RowBox[{ StyleBox[ RowBox[{ RowBox[{"a", "[", "n", "]"}], "*", RowBox[{"Sin", "[", RowBox[{"n", " ", "2", " ", "\[Pi]", " ", "t"}], "]"}]}], FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], RowBox[{ StyleBox["{", FontColor->RGBColor[0, 0, 1]], RowBox[{ StyleBox["n", FontColor->RGBColor[0, 0, 1]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox["1", FontColor->RGBColor[0, 1, 0]], StyleBox[",", FontColor->RGBColor[0, 0, 1]], StyleBox["2", FontColor->RGBColor[0, 0, 1]]}], StyleBox["}", FontColor->RGBColor[0, 0, 1]]}]}], StyleBox["]", FontColor->RGBColor[0, 0, 1]]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"lowerLimit", " ", "=", " ", StyleBox[ RowBox[{"-", "1"}], FontColor->RGBColor[0, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"upperLimit", " ", "=", " ", StyleBox["1", FontColor->RGBColor[0, 0, 1]]}], ";"}]}]}]], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"v", "[", "t", "]"}], ",", RowBox[{"{", RowBox[{"t", ",", "lowerLimit", ",", "upperLimit"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]], "Input"] }, CellGrouping->Manual, WindowSize->{867, 600}, WindowMargins->{{169, Automatic}, {Automatic, -3}}, PrintingPageRange->{Automatic, Automatic}, PrintingOptions->{"Magnification"->1, "PaperOrientation"->"Portrait", "PaperSize"->{612, 792}, "PostScriptOutputFile":>FrontEnd`FileName[{"home", "mligare", "Mathnb"}, "Untitled-1.ps", CharacterEncoding -> "WindowsANSI"]}, ShowSelection->True, FrontEndVersion->"6.0 for Linux x86 (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 47, 0, 39, "Subsection"], Cell[618, 23, 776, 13, 148, "Text"], Cell[1397, 38, 905, 34, 77, "Input"], Cell[2305, 74, 34, 0, 30, "Subsubsection"], Cell[2342, 76, 284, 7, 48, "Text"], Cell[2629, 85, 492, 15, 77, "Input"], Cell[3124, 102, 189, 6, 32, "Input"], Cell[3316, 110, 34, 0, 30, "Subsubsection"], Cell[3353, 112, 150, 4, 68, "Text"], Cell[3506, 118, 532, 15, 77, "Input"], Cell[4041, 135, 189, 6, 32, "Input"], Cell[4233, 143, 34, 0, 30, "Subsubsection"], Cell[4270, 145, 595, 11, 208, "Text"], Cell[4868, 158, 1573, 51, 121, "Input"], Cell[6444, 211, 236, 6, 32, "Input"] } ] *) (* End of internal cache information *)