(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. 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[ 13044, 439]*) (*NotebookOutlinePosition[ 13682, 462]*) (* CellTagsIndexPosition[ 13638, 458]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Calculus/Differential", "Title", Evaluatable->False, TextAlignment->Center, AspectRatioFixed->True], Cell["Taylor Series", "Subtitle"], Cell[TextData[{ "Sean Mauch\nsean@its.caltech.edu\n", ButtonBox["http://www.its.caltech.edu/~sean", ButtonData:>{ URL[ "http://www.its.caltech.edu/~sean"], None}, ButtonStyle->"Hyperlink"], "\n4/6/00" }], "Text", Evaluatable->False, AspectRatioFixed->True], Cell[CellGroupData[{ Cell[TextData[{ "Taylor Series Approximation of ", Cell[BoxData[ \(TraditionalForm\`sin(x)\)]] }], "Section"], Cell[TextData[{ "Find a polynomial approximation of ", Cell[BoxData[ \(TraditionalForm\`sin(x)\)]], " on the interval ", Cell[BoxData[ \(TraditionalForm\`\([\(-1\), 1]\)\)]], " that has a maximum error of ", Cell[BoxData[ \(TraditionalForm\`1/1000\)]], ". Don't use any more terms that you need to. Prove the error bound. Use \ your polynomial to approximate ", Cell[BoxData[ \(TraditionalForm\`sin(1)\)]], "." }], "Text"], Cell[BoxData[ \(Clear[app, x]\)], "Input"], Cell[TextData[{ "The Taylor series expansion of ", Cell[BoxData[ \(TraditionalForm\`sin(x)\)]], " about the point ", Cell[BoxData[ \(TraditionalForm\`x = 0\)]], " up to terms of order ", Cell[BoxData[ \(TraditionalForm\`x\^10\)]], " is" }], "Text"], Cell[BoxData[ \(Series[Sin[x], {x, 0, 10}]\)], "Input"], Cell[TextData[{ "The seventh derivative of ", Cell[BoxData[ \(TraditionalForm\`sin(x)\)]], " is ", Cell[BoxData[ \(TraditionalForm\`\(-\(cos(x)\)\)\)]], "." }], "Text"], Cell[BoxData[ \(\[PartialD]\_{x, 7}\((Sin[x])\)\)], "Input"], Cell[TextData[{ "Thus we have that ", Cell[BoxData[ \(TraditionalForm\`sin(x) = x - x\^3\/6 + x\^5\/120 - \(\(cos(x\_0)\)\/5040\) x\^7\)]], ", where ", Cell[BoxData[ \(TraditionalForm\`0 \[LessEqual] x\_0 \[LessEqual] x\)]], ". " }], "Text"], Cell[TextData[{ "Since we are considering ", Cell[BoxData[ \(TraditionalForm\`x \[Element] \([\(-1\), 1]\)\)]], " and ", Cell[BoxData[ \(TraditionalForm\`\(-1\) \[LessEqual] cos(x\_0) \[LessEqual] 1\)]], " the approximation" }], "Text"], Cell[TextData[{ "\t", Cell[BoxData[ \(TraditionalForm\`sin(x) = x - x\^3\/6 + x\^5\/120\)]] }], "Text"], Cell[TextData[{ "has a maximum error of ", Cell[BoxData[ \(TraditionalForm\`1\/5040 \[TildeTilde] 0.000198\)]], "." }], "Text"], Cell[TextData[{ "We use this polynomial to approximate ", Cell[BoxData[ \(TraditionalForm\`sin(1)\)]], "." }], "Text"], Cell[BoxData[ \(1 - 1\^3\/6 + 1\^5\/120 // N\)], "Input"], Cell["This has the required accuracy.", "Text"], Cell[BoxData[ \(Sin[1. ]\)], "Input"], Cell[TextData[{ "To see how well the Taylor series of ", Cell[BoxData[ \(TraditionalForm\`sin(x)\)]], " about ", Cell[BoxData[ \(TraditionalForm\`x = 0\)]], " approximates the function, here is a plot of ", Cell[BoxData[ \(TraditionalForm\`sin(x)\)]], " and the series up to the ", Cell[BoxData[ \(TraditionalForm\`x\^3\)]], " term." }], "Text"], Cell[BoxData[ \(app[x_] = Normal[Series[Sin[x], {x, 0, 3}]]\)], "Input"], Cell[BoxData[ \(\(Plot[{Sin[x], app[x]}, {x, \(-\[Pi]\), \[Pi]}];\)\)], "Input"], Cell[TextData[{ "Here is the approximation when you include the ", Cell[BoxData[ \(TraditionalForm\`x\^5\)]], " term." }], "Text"], Cell[BoxData[ \(app[x_] = Normal[Series[Sin[x], {x, 0, 5}]]\)], "Input"], Cell[BoxData[ \(\(Plot[{Sin[x], app[x]}, {x, \(-\[Pi]\), \[Pi]}];\)\)], "Input"], Cell[TextData[{ "Here is the approximation when you include the ", Cell[BoxData[ \(TraditionalForm\`x\^7\)]], " term." }], "Text"], Cell[BoxData[ \(app[x_] = Normal[Series[Sin[x], {x, 0, 7}]]\)], "Input"], Cell[BoxData[ \(\(Plot[{Sin[x], app[x]}, {x, \(-\[Pi]\), \[Pi]}];\)\)], "Input"], Cell[BoxData[ \(Clear[app, x]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Approximation of ", Cell[BoxData[ \(TraditionalForm\`f'' \((x)\)\)]] }], "Section"], Cell["You use the formula ", "Text"], Cell[BoxData[ \(f'' \((x)\) \[TildeEqual] \(f \((x + \[CapitalDelta]\ x)\) - 2 f \((x)\ \) + f \((x - \[CapitalDelta]\ x)\)\)\/\(\[CapitalDelta]\ x\^2\)\)], \ "DisplayFormula"], Cell[TextData[{ "to approximate ", Cell[BoxData[ \(TraditionalForm\`f'' \((x)\)\)]], ". What is the error in this approximation?" }], "Text"], Cell[BoxData[ \(Clear[f, x]\)], "Input"], Cell["We expand the terms in the formula in Taylor series.", "Text"], Cell[BoxData[ \(Series[f[x + \[CapitalDelta]], {\[CapitalDelta], 0, 4}]\)], "Input"], Cell[BoxData[ \(% // TraditionalForm\)], "Input"], Cell[BoxData[ FormBox[ RowBox[{ RowBox[{\(f(x + \[CapitalDelta])\), "=", InterpretationBox[ RowBox[{\(f(x)\), "+", RowBox[{ RowBox[{ SuperscriptBox["f", "\[Prime]", MultilineFunction->None], "(", "x", ")"}], " ", "\[CapitalDelta]"}], "+", RowBox[{\(1\/2\), " ", RowBox[{ SuperscriptBox["f", "\[Prime]\[Prime]", MultilineFunction->None], "(", "x", ")"}], " ", \(\[CapitalDelta]\^2\)}], "+", RowBox[{\(1\/6\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((3)\), Derivative], MultilineFunction->None], "(", "x", ")"}], " ", \(\[CapitalDelta]\^3\)}], "+", RowBox[{\(1\/24\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((4)\), Derivative], MultilineFunction->None], "(", \(x\_1\), ")"}], " ", \(\[CapitalDelta]\^4\)}]}], SeriesData[ \[CapitalDelta], 0, { f[ x], Derivative[ 1][ f][ x], Times[ Rational[ 1, 2], Derivative[ 2][ f][ x]], Times[ Rational[ 1, 6], Derivative[ 3][ f][ x]], Times[ Rational[ 1, 24], Derivative[ 4][ f][ x]]}, 0, 5, 1]]}], ",", " ", \(x \[LessEqual] x\_1 \[LessEqual] x + \[CapitalDelta]\)}], TraditionalForm]], "DisplayFormula"], Cell[BoxData[ \(Series[f[x - \[CapitalDelta]], {\[CapitalDelta], 0, 4}]\)], "Input"], Cell[BoxData[ \(% // TraditionalForm\)], "Input"], Cell[BoxData[ FormBox[ RowBox[{ RowBox[{\(f(x + \[CapitalDelta])\), "=", InterpretationBox[ RowBox[{\(f(x)\), "-", RowBox[{ RowBox[{ SuperscriptBox["f", "\[Prime]", MultilineFunction->None], "(", "x", ")"}], " ", "\[CapitalDelta]"}], "+", RowBox[{\(1\/2\), " ", RowBox[{ SuperscriptBox["f", "\[Prime]\[Prime]", MultilineFunction->None], "(", "x", ")"}], " ", \(\[CapitalDelta]\^2\)}], "-", RowBox[{\(1\/6\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((3)\), Derivative], MultilineFunction->None], "(", "x", ")"}], " ", \(\[CapitalDelta]\^3\)}], "+", RowBox[{\(1\/24\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((4)\), Derivative], MultilineFunction->None], "(", \(x\_2\), ")"}], " ", \(\[CapitalDelta]\^4\)}]}], SeriesData[ \[CapitalDelta], 0, { f[ x], Times[ -1, Derivative[ 1][ f][ x]], Times[ Rational[ 1, 2], Derivative[ 2][ f][ x]], Times[ Rational[ -1, 6], Derivative[ 3][ f][ x]], Times[ Rational[ 1, 24], Derivative[ 4][ f][ x]]}, 0, 5, 1]]}], ",", " ", \(x - \[CapitalDelta] \[LessEqual] x\_2 \[LessEqual] x\)}], TraditionalForm]], "DisplayFormula"], Cell[TextData[{ "The formula ", Cell[BoxData[ \(TraditionalForm\`\(f(x + \[CapitalDelta]) - 2 \( f(x)\) + f(x - \ \[CapitalDelta])\)\/\[CapitalDelta]\^2\)]], " is" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{\(f[x]\), "+", RowBox[{ RowBox[{ SuperscriptBox["f", "\[Prime]", MultilineFunction->None], "[", "x", "]"}], " ", "\[CapitalDelta]"}], "+", RowBox[{\(1\/2\), " ", RowBox[{ SuperscriptBox["f", "\[DoublePrime]", MultilineFunction->None], "[", "x", "]"}], " ", \(\[CapitalDelta]\^2\)}], "+", RowBox[{\(1\/6\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((3)\), Derivative], MultilineFunction->None], "[", "x", "]"}], " ", \(\[CapitalDelta]\^3\)}], "+", RowBox[{\(1\/24\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((4)\), Derivative], MultilineFunction->None], "[", "x1", "]"}], " ", \(\[CapitalDelta]\^4\)}], "-", \(2 f[x]\), "+", \(f[x]\), "-", RowBox[{ RowBox[{ SuperscriptBox["f", "\[Prime]", MultilineFunction->None], "[", "x", "]"}], " ", "\[CapitalDelta]"}], "+", RowBox[{\(1\/2\), " ", RowBox[{ SuperscriptBox["f", "\[DoublePrime]", MultilineFunction->None], "[", "x", "]"}], " ", \(\[CapitalDelta]\^2\)}], "-", RowBox[{\(1\/6\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((3)\), Derivative], MultilineFunction->None], "[", "x", "]"}], " ", \(\[CapitalDelta]\^3\)}], "+", RowBox[{\(1\/24\), " ", RowBox[{ SuperscriptBox["f", TagBox[\((4)\), Derivative], MultilineFunction->None], "[", "x2", "]"}], " ", \(\[CapitalDelta]\^4\)}]}], ")"}], "/", \(\[CapitalDelta]\^2\)}], "//", "Expand"}]], "Input"], Cell[TextData[{ "We see that the error in the approximation is ", Cell[BoxData[ \(TraditionalForm\`\(\[CapitalDelta]\^2\/24\) \((\(\(\(f'\)'\)'\)' \((x\ \_1)\) + \(\(\(f'\)'\)'\)' \((x\_2)\))\)\)]], " where ", Cell[BoxData[ \(TraditionalForm\`x \[LessEqual] x\_1 \[LessEqual] x + \[CapitalDelta]\)]], " and ", Cell[BoxData[ \(TraditionalForm\`x - \[CapitalDelta] \[LessEqual] x\_2 \[LessEqual] x\)]], "." }], "Text"] }, Open ]] }, Open ]] }, FrontEndVersion->"4.0 for X", ScreenRectangle->{{0, 1152}, {0, 864}}, WindowSize->{520, 579}, WindowMargins->{{10, Automatic}, {Automatic, 1}} ] (*********************************************************************** 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[1739, 51, 111, 3, 107, "Title", Evaluatable->False], Cell[1853, 56, 33, 0, 64, "Subtitle"], Cell[1889, 58, 280, 9, 86, "Text", Evaluatable->False], Cell[CellGroupData[{ Cell[2194, 71, 119, 4, 54, "Section"], Cell[2316, 77, 467, 15, 68, "Text"], Cell[2786, 94, 46, 1, 27, "Input"], Cell[2835, 97, 280, 11, 32, "Text"], Cell[3118, 110, 59, 1, 27, "Input"], Cell[3180, 113, 190, 8, 32, "Text"], Cell[3373, 123, 64, 1, 28, "Input"], Cell[3440, 126, 273, 9, 37, "Text"], Cell[3716, 137, 258, 8, 32, "Text"], Cell[3977, 147, 113, 4, 37, "Text"], Cell[4093, 153, 139, 5, 34, "Text"], Cell[4235, 160, 130, 5, 32, "Text"], Cell[4368, 167, 61, 1, 46, "Input"], Cell[4432, 170, 47, 0, 32, "Text"], Cell[4482, 172, 41, 1, 27, "Input"], Cell[4526, 175, 387, 14, 50, "Text"], Cell[4916, 191, 76, 1, 27, "Input"], Cell[4995, 194, 84, 1, 27, "Input"], Cell[5082, 197, 142, 5, 32, "Text"], Cell[5227, 204, 76, 1, 27, "Input"], Cell[5306, 207, 84, 1, 27, "Input"], Cell[5393, 210, 142, 5, 32, "Text"], Cell[5538, 217, 76, 1, 27, "Input"], Cell[5617, 220, 84, 1, 27, "Input"], Cell[5704, 223, 46, 1, 27, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5787, 229, 110, 4, 54, "Section"], Cell[5900, 235, 37, 0, 32, "Text"], Cell[5940, 237, 181, 3, 40, "DisplayFormula"], Cell[6124, 242, 154, 5, 32, "Text"], Cell[6281, 249, 44, 1, 27, "Input"], Cell[6328, 252, 68, 0, 32, "Text"], Cell[6399, 254, 88, 1, 27, "Input"], Cell[6490, 257, 53, 1, 27, "Input"], Cell[6546, 260, 1727, 43, 59, "DisplayFormula"], Cell[8276, 305, 88, 1, 27, "Input"], Cell[8367, 308, 53, 1, 27, "Input"], Cell[8423, 311, 1757, 44, 59, "DisplayFormula"], Cell[10183, 357, 187, 6, 35, "Text"], Cell[10373, 365, 2174, 54, 117, "Input"], Cell[12550, 421, 466, 14, 55, "Text"] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)