(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of 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[ 7837, 272]*) (*NotebookOutlinePosition[ 8500, 296]*) (* CellTagsIndexPosition[ 8456, 292]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Taylor Series with Mathematica", "Title", TextAlignment->Center, TextJustification->0, FontSize->18], Cell[CellGroupData[{ Cell["Clear symbols", "Section", Evaluatable->False, AspectRatioFixed->True], Cell["\<\ In order to avoid interference from symbols defined in other \ notebooks, we first Clear all symbols. We assume that the relevant symbols \ are in the Global` context.\ \>", "Text", Evaluatable->False, AspectRatioFixed->True], Cell["Clear[\"Global`*\"]", "Input", AspectRatioFixed->True], Cell[CellGroupData[{ Cell["Background", "Subsection"], Cell["\<\ A Taylor series is an expansion of a function in a polynomial about \ a starting point. Often we expand f(x) about x=0, but we can expand around a general point \ x0.\ \>", "Text"], Cell[TextData[{ "The ", StyleBox["Mathematica", FontSlant->"Italic"], " command to do the expansion is Series. The syntax is\n Series[ \ function, {variable, x0, # of terms}] ,\nso to expand f(x) about x=x0 for 4 \ terms:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Series[f[x], {x, x0, 4}]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{\(f[x0]\), "+", RowBox[{ RowBox[{ SuperscriptBox["f", "\[Prime]", MultilineFunction->None], "[", "x0", "]"}], " ", \((x - x0)\)}], "+", RowBox[{\(1\/2\), " ", RowBox[{ SuperscriptBox["f", "\[DoublePrime]", MultilineFunction->None], "[", "x0", "]"}], " ", \(\((x - x0)\)\^2\)}], "+", RowBox[{\(1\/6\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((3)\), Derivative], MultilineFunction->None], "[", "x0", "]"}], " ", \(\((x - x0)\)\^3\)}], "+", RowBox[{\(1\/24\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((4)\), Derivative], MultilineFunction->None], "[", "x0", "]"}], " ", \(\((x - x0)\)\^4\)}], "+", InterpretationBox[\(O[x - x0]\^5\), SeriesData[ x, x0, {}, 0, 5, 1]]}], SeriesData[ x, x0, { f[ x0], Derivative[ 1][ f][ x0], Times[ Rational[ 1, 2], Derivative[ 2][ f][ x0]], Times[ Rational[ 1, 6], Derivative[ 3][ f][ x0]], Times[ Rational[ 1, 24], Derivative[ 4][ f][ x0]]}, 0, 5, 1]]], "Output"] }, Open ]], Cell["The special case with x0=0 is:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Series[f[x], {x, 0, 4}]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{\(f[0]\), "+", RowBox[{ RowBox[{ SuperscriptBox["f", "\[Prime]", MultilineFunction->None], "[", "0", "]"}], " ", "x"}], "+", RowBox[{\(1\/2\), " ", RowBox[{ SuperscriptBox["f", "\[DoublePrime]", MultilineFunction->None], "[", "0", "]"}], " ", \(x\^2\)}], "+", RowBox[{\(1\/6\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((3)\), Derivative], MultilineFunction->None], "[", "0", "]"}], " ", \(x\^3\)}], "+", RowBox[{\(1\/24\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((4)\), Derivative], MultilineFunction->None], "[", "0", "]"}], " ", \(x\^4\)}], "+", InterpretationBox[\(O[x]\^5\), SeriesData[ x, 0, {}, 0, 5, 1]]}], SeriesData[ x, 0, { f[ 0], Derivative[ 1][ f][ 0], Times[ Rational[ 1, 2], Derivative[ 2][ f][ 0]], Times[ Rational[ 1, 6], Derivative[ 3][ f][ 0]], Times[ Rational[ 1, 24], Derivative[ 4][ f][ 0]]}, 0, 5, 1]]], "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Example 1: Binomial Series", "Subsection"], Cell["For example, the binomial series is an expansion about x=0:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Series[\((1 + x)\)^n, {x, 0, 4}]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{ "1", "+", \(n\ x\), "+", \(1\/2\ \((\(-1\) + n)\)\ n\ x\^2\), "+", \(1\/6\ \((\(-2\) + n)\)\ \((\(-1\) + n)\)\ n\ x\^3\), "+", \(1\/24\ \((\(-3\) + n)\)\ \((\(-2\) + n)\)\ \((\(-1\) + n)\)\ n\ x\^4\), "+", InterpretationBox[\(O[x]\^5\), SeriesData[ x, 0, {}, 0, 5, 1]]}], SeriesData[ x, 0, {1, n, Times[ Rational[ 1, 2], Plus[ -1, n], n], Times[ Rational[ 1, 6], Plus[ -2, n], Plus[ -1, n], n], Times[ Rational[ 1, 24], Plus[ -3, n], Plus[ -2, n], Plus[ -1, n], n]}, 0, 5, 1]]], "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Example 2: Sin and Cos", "Subsection"], Cell["Try expanding sin(x) and cos(x) about x=0 out to 8 terms:", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Series[Sin[x], {x, 0, 8}]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{ "x", "-", \(x\^3\/6\), "+", \(x\^5\/120\), "-", \(x\^7\/5040\), "+", InterpretationBox[\(O[x]\^9\), SeriesData[ x, 0, {}, 1, 9, 1]]}], SeriesData[ x, 0, {1, 0, Rational[ -1, 6], 0, Rational[ 1, 120], 0, Rational[ -1, 5040]}, 1, 9, 1]]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Series[Cos[x], {x, 0, 8}]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{ "1", "-", \(x\^2\/2\), "+", \(x\^4\/24\), "-", \(x\^6\/720\), "+", \(x\^8\/40320\), "+", InterpretationBox[\(O[x]\^9\), SeriesData[ x, 0, {}, 0, 9, 1]]}], SeriesData[ x, 0, {1, 0, Rational[ -1, 2], 0, Rational[ 1, 24], 0, Rational[ -1, 720], 0, Rational[ 1, 40320]}, 0, 9, 1]]], "Output"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"X 3.0", ScreenRectangle->{{0, 1024}, {0, 768}}, WindowToolbars->"EditBar", WindowSize->{561, 533}, WindowMargins->{{Automatic, 212}, {Automatic, 53}} ] (*********************************************************************** 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[1731, 51, 112, 3, 83, "Title"], Cell[CellGroupData[{ Cell[1868, 58, 80, 2, 52, "Section", Evaluatable->False], Cell[1951, 62, 240, 6, 50, "Text", Evaluatable->False], Cell[2194, 70, 62, 1, 27, "Input"], Cell[CellGroupData[{ Cell[2281, 75, 32, 0, 45, "Subsection"], Cell[2316, 77, 190, 5, 50, "Text"], Cell[2509, 84, 253, 7, 68, "Text"], Cell[CellGroupData[{ Cell[2787, 95, 57, 1, 27, "Input"], Cell[2847, 98, 1374, 40, 78, "Output"] }, Open ]], Cell[4236, 141, 46, 0, 32, "Text"], Cell[CellGroupData[{ Cell[4307, 145, 56, 1, 27, "Input"], Cell[4366, 148, 1298, 39, 43, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[5713, 193, 49, 0, 45, "Subsection"], Cell[5765, 195, 75, 0, 32, "Text"], Cell[CellGroupData[{ Cell[5865, 199, 65, 1, 27, "Input"], Cell[5933, 202, 726, 21, 78, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[6708, 229, 45, 0, 45, "Subsection"], Cell[6756, 231, 73, 0, 32, "Text"], Cell[CellGroupData[{ Cell[6854, 235, 58, 1, 27, "Input"], Cell[6915, 238, 356, 9, 44, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[7308, 252, 58, 1, 27, "Input"], Cell[7369, 255, 416, 11, 44, "Output"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)