(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.0' 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[ 27270, 787]*) (*NotebookOutlinePosition[ 27968, 811]*) (* CellTagsIndexPosition[ 27924, 807]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Taylor Polynomials", "Title", CellFrame->True, TextAlignment->Center, 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["\<\ This notebook produces Taylor polynomials for various functions, and plots \ the polynomials on the same axes as the function. A sequence of graph of \ Taylor polynomials of increasing degree is created and can be animated. A \ final graph shows all the Taylor polynomials on the same set of axes.\ \>", "Text"], Cell[CellGroupData[{ Cell["\<\ Initialization. (Can be skipped, if you answer \"Yes\" to the initialization \ request.)\ \>", "Section"], Cell["\<\ The cells in this section are initialization cells, and will be automatically \ evaluated if you answer \"Yes\" to the initialization request. If you do not \ answer \"Yes\" to this request, you must evaluate them before creating the \ graphs in the second section below.\ \>", "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[TextData[{ "Eliminating some unnecessary warning messages. ", StyleBox["(Should be skipped)", FontColor->RGBColor[1, 0, 1]] }], "Subsubsection"], Cell[BoxData[{ \(\(Off[General::"\"];\)\), "\n", \(\(Off[General::"\"];\)\)}], "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[TextData[Cell[BoxData[ FormBox[ SuperscriptBox[ StyleBox["e", FontSlant->"Plain"], StyleBox["x", FontSlant->"Plain"]], TraditionalForm]]]], "Section"], Cell[TextData[{ "The next cell creates the graphs to be animated. ", StyleBox["max", FontColor->RGBColor[1, 0, 1]], " is the highest degree polynomial to be used. ", StyleBox["xmin", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["xmax", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["ymin", FontColor->RGBColor[1, 0, 1]], ", and ", StyleBox["ymax", FontColor->RGBColor[1, 0, 1]], " give the bounds on the graph window. You can change the size of the \ displayed graphs by adjusting the value following the option ", StyleBox["ImageSize", FontColor->RGBColor[1, 0, 0]], " at the end of the cell." }], "Text"], 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"], Cell[BoxData[{\(Clear[x, xmin, xmax, ymin, ymax, pPlot, fPlot, n, k, max]\), "\n", RowBox[{ RowBox[{"max", "=", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmax", "=", StyleBox["5", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymax", "=", StyleBox["150", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", \(fPlot = Plot[\[ExponentialE]\^x, {x, xmin, xmax}, PlotStyle \[Rule] {Thickness[0.005]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(pPlot[n_, c_] := Plot[\[Sum]\+\(k = 0\)\%n x\^k\/\(k!\), {x, xmin, xmax}, PlotStyle \[Rule] {Hue[c]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", RowBox[{"Animate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ "fPlot", ",", \(pPlot[k, k\/max]\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", \(PlotLabel \[Rule] "\" <> ToString[k]\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ",", \({k, 0, max, 1}\)}], "]"}]}], "Input", AnimationDisplayTime->19.005], Cell["\<\ To show all the polynomials on the same set of axes simultaneously, evaluate \ the next cell. (This only works after the previous cell has been evaluated.)\ \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Show", "[", RowBox[{\(Append[Table[pPlot[n, n\/max], {n, 0, max}], fPlot]\), ",", \(PlotLabel \[Rule] "\"\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["sin(x)", "Section"], Cell[TextData[{ "The next cell creates the graphs to be animated. (2 ", StyleBox["max", FontColor->RGBColor[1, 0, 1]], " +1) is the highest degree polynomial to be used. ", StyleBox["xmin", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["xmax", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["ymin", FontColor->RGBColor[1, 0, 1]], ", and ", StyleBox["ymax", FontColor->RGBColor[1, 0, 1]], " give the bounds on the graph window. You can change the size of the \ displayed graphs by adjusting the value following the option ", StyleBox["ImageSize", FontColor->RGBColor[1, 0, 0]], " at the end of the cell." }], "Text"], 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"], Cell[BoxData[{\(Clear[x, xmin, xmax, ymin, ymax, pPlot, fPlot, n, k, max]\), "\n", RowBox[{ RowBox[{"max", "=", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmin", "=", StyleBox[\(\(-2\) \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmax", "=", StyleBox[\(2 \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymax", "=", StyleBox["2", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", \(fPlot = Plot[Sin[x], {x, xmin, xmax}, PlotStyle \[Rule] {Thickness[0.005]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(pPlot[n_, c_] := Plot[\[Sum]\+\(k = 0\)\%n\(\(\((\(-1\))\)\^k\) x\^\(2\ k + \ 1\)\)\/\(\((2\ k + 1)\)!\), {x, xmin, xmax}, PlotStyle \[Rule] {Hue[c]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", RowBox[{"Animate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ "fPlot", ",", \(pPlot[k, k\/max]\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", \(PlotLabel \[Rule] "\" <> ToString[2 k + 1]\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ",", \({k, 0, max, 1}\)}], "]"}]}], "Input", AnimationDisplayTime->19.005], Cell["\<\ To show all the polynomials on the same set of axes simultaneously, evaluate \ the next cell. (This only works after the previous cell has been evaluated.)\ \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Show", "[", RowBox[{\(Append[Table[pPlot[n, n\/max], {n, 0, max}], fPlot]\), ",", \(PlotLabel \[Rule] "\"\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["cos(x)", "Section"], Cell[TextData[{ "The next cell creates the graphs to be animated. (2 ", StyleBox["max", FontColor->RGBColor[1, 0, 1]], ") is the highest degree polynomial to be used. ", StyleBox["xmin", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["xmax", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["ymin", FontColor->RGBColor[1, 0, 1]], ", and ", StyleBox["ymax", FontColor->RGBColor[1, 0, 1]], " give the bounds on the graph window. You can change the size of the \ displayed graphs by adjusting the value following the option ", StyleBox["ImageSize", FontColor->RGBColor[1, 0, 0]], " at the end of the cell." }], "Text"], 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"], Cell[BoxData[{\(Clear[x, xmin, xmax, ymin, ymax, pPlot, fPlot, n, k, max]\), "\n", RowBox[{ RowBox[{"max", "=", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmin", "=", StyleBox[\(\(-2\) \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmax", "=", StyleBox[\(2 \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymax", "=", StyleBox["2", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", \(fPlot = Plot[Cos[x], {x, xmin, xmax}, PlotStyle \[Rule] {Thickness[0.005]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(pPlot[n_, c_] := Plot[\[Sum]\+\(k = 0\)\%n\(\(\((\(-1\))\)\^k\) x\^\(2\ k\)\)\/\(\((2\ \ k)\)!\), {x, xmin, xmax}, PlotStyle \[Rule] {Hue[c]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", RowBox[{"Animate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ "fPlot", ",", \(pPlot[k, k\/max]\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", \(PlotLabel \[Rule] "\" <> ToString[2 k]\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ",", \({k, 0, max, 1}\)}], "]"}]}], "Input", AnimationDisplayTime->19.005], Cell["\<\ To show all the polynomials on the same set of axes simultaneously, evaluate \ the next cell. (This only works after the previous cell has been evaluated.)\ \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Show", "[", RowBox[{\(Append[Table[pPlot[n, n\/max], {n, 0, max}], fPlot]\), ",", \(PlotLabel \[Rule] "\"\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["ln(x)", "Section"], Cell[TextData[{ "The next cell creates the graphs to be animated. ", StyleBox["max", FontColor->RGBColor[1, 0, 1]], " is the highest degree polynomial to be used. ", StyleBox["xmin", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["xmax", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["ymin", FontColor->RGBColor[1, 0, 1]], ", and ", StyleBox["ymax", FontColor->RGBColor[1, 0, 1]], " give the bounds on the graph window. You can change the size of the \ displayed graphs by adjusting the value following the option ", StyleBox["ImageSize", FontColor->RGBColor[1, 0, 0]], " at the end of the cell. Note that for this function we are expanding \ around 1 rather than around 0." }], "Text"], 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"], Cell[BoxData[{\(Clear[x, xmin, xmax, ymin, ymax, pPlot, fPlot, n, k, max]\), "\n", RowBox[{ RowBox[{"max", "=", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmin", "=", StyleBox[".1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmax", "=", StyleBox["3", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymax", "=", StyleBox["2", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", \(fPlot = Plot[Log[x], {x, xmin, xmax}, PlotStyle \[Rule] {Thickness[0.005]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(pPlot[n_, c_] := Plot[\[Sum]\+\(k = 1\)\%n\(\(\((\(-1\))\)\^\(k + 1\)\) \((x - 1)\)\^k\ \)\/k, {x, xmin, xmax}, PlotStyle \[Rule] {Hue[c]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", RowBox[{"Animate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ "fPlot", ",", \(pPlot[k, k\/max]\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", \(PlotLabel \[Rule] "\" <> ToString[k]\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ",", \({k, 0, max, 1}\)}], "]"}]}], "Input", AnimationDisplayTime->19.005], Cell["\<\ To show all the polynomials on the same set of axes simultaneously, evaluate \ the next cell. (This only works after the previous cell has been evaluated.)\ \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Show", "[", RowBox[{\(Append[Table[pPlot[n, n\/max], {n, 0, max}], fPlot]\), ",", \(PlotLabel \[Rule] "\"\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ";"}]], "Input"], Cell["\<\ Did you notice a difference between this function and the ones in the earlier \ sections? Do the polynomials approach the function everywhere when the \ degree increases?\ \>", "Text"] }, Closed]], Cell[CellGroupData[{ Cell["Arbitrary functions.", "Section"], Cell[TextData[{ "The next cell creates the graphs to be animated. ", StyleBox["max", FontColor->RGBColor[1, 0, 1]], " is the highest \"degree\" polynomial to be used. (It may not be the \ actual degree of the polynomial, depending on whether or not the coefficient \ of ", Cell[BoxData[ FormBox[ SuperscriptBox[ RowBox[{"(", StyleBox[\(x - a\), FontSlant->"Plain"], StyleBox[")", FontSlant->"Plain"]}], "max"], TraditionalForm]]], " is zero.) ", StyleBox["xmin", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["xmax", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["ymin", FontColor->RGBColor[1, 0, 1]], ", and ", StyleBox["ymax", FontColor->RGBColor[1, 0, 1]], " give the bounds on the graph window. ", StyleBox["f(x)", FontColor->RGBColor[1, 0, 1]], " is the function whose Taylor polynomials you wish to produce, and ", StyleBox["a", FontColor->RGBColor[1, 0, 1]], " is the point around which those polynomials are expanded. You may have \ to change some (or all) of these values in magenta in order to produce nice \ graphs to animate. You can change the size of the displayed graphs by \ adjusting the value following the option ", StyleBox["ImageSize", FontColor->RGBColor[1, 0, 0]], " at the end of the cell." }], "Text"], 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"], Cell["The next cell creates the graphs to be animated.", "Text"], Cell[BoxData[{\(Clear[x, xmin, xmax, ymin, ymax, fPlot, pPlot, a, n, i, m, k, max]\), "\n", RowBox[{ RowBox[{"a", "=", StyleBox["0", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"max", "=", StyleBox["10", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmin", "=", StyleBox[\(\(-2\) \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmax", "=", StyleBox[\(2 \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymax", "=", StyleBox["2", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{\(f[x_]\), ":=", StyleBox[\(Sin[x]\), FontColor->RGBColor[1, 0, 1]]}], "\n", \(fPlot = Plot[f[x], {x, xmin, xmax}, PlotStyle \[Rule] {Thickness[0.005]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(pPlot[n_, c_] := Plot[Evaluate[\[Sum]\+\(k = 0\)\%n\(\((\((\[PartialD]\_{x, k}\ \ f[x])\) /. x \[Rule] a)\) \((x - a)\)\^k\)\/\(k!\)], {x, xmin, xmax}, PlotStyle \[Rule] {Hue[c]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", RowBox[{"Animate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{ "fPlot", ",", \(pPlot[k, k\/max]\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", \(PlotLabel \[Rule] "\" <> ToString[k]\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ",", \({k, 0, max, 1}\)}], "]"}]}], "Input", AnimationDisplayTime->19.005], Cell["\<\ To show all the polynomials on the same set of axes simultaneously, evaluate \ the next cell. (This only works after the previous cell has been evaluated.)\ \ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Show", "[", RowBox[{\(Append[Table[pPlot[n, n\/max], {n, 0, max}], fPlot]\), ",", \(PlotLabel \[Rule] "\"\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["500", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ";"}]], "Input"] }, Closed]], Cell[CellGroupData[{ Cell["Arbitrary functions with remainders.", "Section"], Cell[TextData[{ "The next cell creates the graphs to be animated. ", StyleBox["max", FontColor->RGBColor[1, 0, 1]], " is the highest \"degree\" polynomial to be used. (It may not be the \ actual degree of the polynomial, depending on whether or not the coefficient \ of ", Cell[BoxData[ FormBox[ SuperscriptBox[ RowBox[{"(", StyleBox[\(x - a\), FontSlant->"Plain"], StyleBox[")", FontSlant->"Plain"]}], "max"], TraditionalForm]]], " is zero.) ", StyleBox["xmin", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["xmax", FontColor->RGBColor[1, 0, 1]], ", ", StyleBox["ymin", FontColor->RGBColor[1, 0, 1]], ", and ", StyleBox["ymax", FontColor->RGBColor[1, 0, 1]], " give the bounds on the graph window. ", StyleBox["f(x)", FontColor->RGBColor[1, 0, 1]], " is the function whose Taylor polynomials (plotted in ", StyleBox["red", FontColor->RGBColor[1, 0, 0]], ") you wish to animate, and ", StyleBox["a", FontColor->RGBColor[1, 0, 1]], " is the point around which those polynomials are expanded. Finally, the \ remainder term (f(x) minus the Taylor polynomial) is in ", StyleBox["green", FontColor->RGBColor[0, 1, 0]], " on a second graph whose y bounds are given by ", StyleBox["rmin", FontColor->RGBColor[1, 0, 1]], " and ", StyleBox["rmax", FontColor->RGBColor[1, 0, 1]], ". You may have to change some (or all) of the values in ", StyleBox["magenta", FontColor->RGBColor[1, 0, 1]], " in order to produce nice graphs to animate. You can change the size of \ the displayed graphs by adjusting the value following the option ", StyleBox["ImageSize", FontColor->RGBColor[1, 0, 0]], " at the end of the cell." }], "Text"], 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"], Cell["The next cell creates the graphs to be animated.", "Text"], Cell[BoxData[{\(Clear[x, xmin, xmax, ymin, ymax, rmin, rmax, fPlot, pPlot, p, rPlot, a, n, i, m, k, max]\), "\n", RowBox[{ RowBox[{"a", "=", StyleBox["0", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"max", "=", StyleBox["20", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmin", "=", StyleBox[\(\(-2\) \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"xmax", "=", StyleBox[\(2 \[Pi]\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymin", "=", StyleBox[\(-2\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ymax", "=", StyleBox["2", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\n", RowBox[{ RowBox[{"rmin", "=", StyleBox[\(- .1\), FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rmax", "=", StyleBox[".1", FontColor->RGBColor[1, 0, 1]]}], ";"}], "\[IndentingNewLine]", RowBox[{\(f[x_]\), ":=", StyleBox[\(Sin[x]\), FontColor->RGBColor[1, 0, 1]]}], "\n", \(fPlot = Plot[f[x], {x, xmin, xmax}, PlotStyle \[Rule] {Thickness[0.005]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(p[n_, x_] = \[Sum]\+\(k = 0\)\%n\(\((\((\[PartialD]\_{x, k}\ f[x])\) /. x \ \[Rule] a)\) \((x - a)\)\^k\)\/\(k!\);\), "\[IndentingNewLine]", \(pPlot[n_, c_] := Plot[p[n, x], {x, xmin, xmax}, PlotStyle \[Rule] {Hue[c]}, PlotRange \[Rule] {ymin, ymax}, DisplayFunction \[Rule] Identity];\), "\n", \(rPlot[n_] := Plot[f[x] - p[n, x], {x, xmin, xmax}, PlotStyle \[Rule] RGBColor[0, 1, 0], PlotLabel -> "\", PlotRange \[Rule] {rmin, rmax}, DisplayFunction \[Rule] Identity];\), "\[IndentingNewLine]", RowBox[{"Animate", "[", RowBox[{ RowBox[{"Show", "[", RowBox[{\(Graphics[{Rectangle[{0, 0}, {1, 1}, Show[fPlot, pPlot[k, k\/max], PlotLabel \[Rule] "\" <> ToString[k]]], Rectangle[{1.2, 0}, {2.2, 1}, rPlot[k]]}]\), ",", \(DisplayFunction \[Rule] $DisplayFunction\), ",", RowBox[{"ImageSize", "\[Rule]", StyleBox["800", FontColor->RGBColor[1, 0, 1]]}]}], "]"}], ",", \({k, 0, max, 1}\)}], "]"}]}], "Input", AnimationDisplayTime->19.005] }, Closed]] }, Open ]] }, FrontEndVersion->"5.0 for Microsoft Windows", ScreenRectangle->{{0, 1280}, {0, 971}}, AutoGeneratedPackage->None, WindowToolbars->"EditBar", WindowSize->{827, 905}, WindowMargins->{{4, Automatic}, {Automatic, 0}} ] (******************************************************************* 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, 112, 3, 111, "Title"], Cell[1891, 58, 250, 4, 44, "SmallText"], Cell[2144, 64, 323, 5, 52, "Text"], Cell[CellGroupData[{ Cell[2492, 73, 116, 3, 73, "Section"], Cell[2611, 78, 296, 5, 71, "Text"], Cell[2910, 85, 93, 2, 30, "Input", InitializationCell->True], Cell[CellGroupData[{ Cell[3028, 91, 158, 4, 43, "Subsubsection"], Cell[3189, 97, 141, 3, 50, "Input", InitializationCell->True] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[3379, 106, 202, 6, 41, "Section"], Cell[3584, 114, 660, 21, 52, "Text"], Cell[4247, 137, 451, 11, 71, "Text"], Cell[4701, 150, 1658, 41, 301, "Input"], Cell[6362, 193, 182, 4, 52, "Text"], Cell[6547, 199, 394, 8, 62, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[6978, 212, 25, 0, 43, "Section"], Cell[7006, 214, 667, 21, 71, "Text"], Cell[7676, 237, 451, 11, 71, "Text"], Cell[8130, 250, 1721, 42, 301, "Input"], Cell[9854, 294, 182, 4, 52, "Text"], Cell[10039, 300, 394, 8, 62, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[10470, 313, 25, 0, 43, "Section"], Cell[10498, 315, 664, 21, 52, "Text"], Cell[11165, 338, 451, 11, 71, "Text"], Cell[11619, 351, 1709, 42, 301, "Input"], Cell[13331, 395, 182, 4, 52, "Text"], Cell[13516, 401, 394, 8, 62, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[13947, 414, 24, 0, 43, "Section"], Cell[13974, 416, 741, 22, 71, "Text"], Cell[14718, 440, 451, 11, 71, "Text"], Cell[15172, 453, 1669, 41, 301, "Input"], Cell[16844, 496, 182, 4, 52, "Text"], Cell[17029, 502, 394, 8, 62, "Input"], Cell[17426, 512, 195, 4, 52, "Text"] }, Closed]], Cell[CellGroupData[{ Cell[17658, 521, 39, 0, 43, "Section"], Cell[17700, 523, 1380, 40, 109, "Text"], Cell[19083, 565, 451, 11, 71, "Text"], Cell[19537, 578, 64, 0, 33, "Text"], Cell[19604, 580, 1952, 47, 341, "Input"], Cell[21559, 629, 182, 4, 52, "Text"], Cell[21744, 635, 394, 8, 62, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[22175, 648, 55, 0, 43, "Section"], Cell[22233, 650, 1810, 54, 128, "Text"], Cell[24046, 706, 451, 11, 71, "Text"], Cell[24500, 719, 64, 0, 33, "Text"], Cell[24567, 721, 2675, 62, 524, "Input"] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)