(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 7278, 205] NotebookOptionsPosition[ 6798, 185] NotebookOutlinePosition[ 7143, 200] CellTagsIndexPosition[ 7100, 197] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ StyleBox[ RowBox[{"Taylor", " ", "Series", " "}], "Title"]], "Input", CellChangeTimes->{{3.4777804190625*^9, 3.477780421578125*^9}}, FontSize->24], Cell[BoxData[ StyleBox[ RowBox[{ "Goal", " ", "is", " ", "to", " ", "see", " ", "how", " ", "well", " ", "Taylor", " ", "Series", " ", "approximate", " ", "functions"}], "Subtitle"]], "Input", CellChangeTimes->{{3.477780428171875*^9, 3.4777804358125*^9}}], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{"For", " ", "definiteness"}], ",", " ", RowBox[{"will", " ", "do", " ", RowBox[{"Cos", "[", "x", "]"}]}]}], "Subtitle"]], "Input", CellChangeTimes->{{3.47778102046875*^9, 3.477781026015625*^9}}], Cell[BoxData[{ StyleBox[ RowBox[{ RowBox[{ RowBox[{"coeff", "[", RowBox[{"x0_", ",", "n_"}], "]"}], " ", ":=", " ", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"n", ",", "4"}], "]"}], " ", "\[Equal]", " ", "0"}], ",", " ", RowBox[{"Cos", "[", "x0", "]"}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"n", ",", "4"}], "]"}], " ", "\[Equal]", " ", "1"}], ",", " ", RowBox[{"-", " ", RowBox[{"Sin", "[", "x0", "]"}]}], ",", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Mod", "[", RowBox[{"n", ",", "4"}], "]"}], " ", "\[Equal]", " ", "2"}], ",", " ", RowBox[{"-", " ", RowBox[{"Cos", "[", "x0", "]"}]}], ",", " ", RowBox[{"Sin", "[", "x0", "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}]}], "]"}]}], ";"}], "Subtitle"], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{"approx", "[", RowBox[{"x_", ",", "x0_", ",", "n_"}], "]"}], " ", ":=", " ", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"coeff", "[", RowBox[{"x0", ",", " ", "nn"}], "]"}], RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"x", "-", "x0"}], ")"}], "^", "nn"}], "/", RowBox[{"nn", "!"}]}]}], ",", RowBox[{"{", RowBox[{"nn", ",", "0", ",", "n"}], "}"}]}], "]"}]}], "Subtitle"]}], "Input", CellChangeTimes->{{3.477780473375*^9, 3.477780490078125*^9}, { 3.47778053959375*^9, 3.47778069221875*^9}, {3.477780795546875*^9, 3.4777807989375*^9}, {3.477780870375*^9, 3.477780872171875*^9}}], Cell[CellGroupData[{ Cell[BoxData[ StyleBox[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"Plot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Cos", "[", "x", "]"}], ",", " ", RowBox[{"approx", "[", RowBox[{"x", ",", "x0", ",", "n"}], "]"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"x", ",", RowBox[{"x0", " ", "-", " ", RowBox[{"2", " ", "Pi", " ", "c"}]}], ",", " ", RowBox[{"x0", " ", "+", " ", RowBox[{"2", " ", "Pi", " ", "c"}]}]}], "}"}], ",", " ", RowBox[{"Epilog", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{ RowBox[{"PointSize", "[", ".025", "]"}], ",", " ", RowBox[{"Point", "[", RowBox[{"{", RowBox[{"x0", ",", RowBox[{"Cos", "[", "x0", "]"}]}], "}"}], "]"}]}], "}"}]}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"x0", ",", "0", ",", " ", RowBox[{"20", " ", RowBox[{"Pi", "/", "2"}]}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"n", ",", "1", ",", "40"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"c", ",", "4", ",", ".01"}], "}"}]}], "]"}], "Subtitle"]], "Input", CellChangeTimes->{{3.4777806946875*^9, 3.477780771140625*^9}, 3.4777808249375*^9, {3.4777809795625*^9, 3.4777809883125*^9}, { 3.477782481359375*^9, 3.47778248209375*^9}}], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`c$$ = 0.85, $CellContext`n$$ = 1, $CellContext`x0$$ = 12.75486617357456, Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{ Hold[$CellContext`x0$$], 0, 10 Pi}, { Hold[$CellContext`n$$], 1, 40}, { Hold[$CellContext`c$$], 4, 0.01}}, Typeset`size$$ = { 603., {185., 189.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`x0$16316$$ = 0, $CellContext`n$16317$$ = 0, $CellContext`c$16318$$ = 0}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`c$$ = 4, $CellContext`n$$ = 1, $CellContext`x0$$ = 0}, "ControllerVariables" :> { Hold[$CellContext`x0$$, $CellContext`x0$16316$$, 0], Hold[$CellContext`n$$, $CellContext`n$16317$$, 0], Hold[$CellContext`c$$, $CellContext`c$16318$$, 0]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> Plot[{ Cos[$CellContext`x], $CellContext`approx[$CellContext`x, $CellContext`x0$$, \ $CellContext`n$$]}, {$CellContext`x, $CellContext`x0$$ - 2 Pi $CellContext`c$$, $CellContext`x0$$ + 2 Pi $CellContext`c$$}, Epilog -> { PointSize[0.025], Point[{$CellContext`x0$$, Cos[$CellContext`x0$$]}]}], "Specifications" :> {{$CellContext`x0$$, 0, 10 Pi}, {$CellContext`n$$, 1, 40}, {$CellContext`c$$, 4, 0.01}}, "Options" :> {}, "DefaultOptions" :> {}], ImageSizeCache->{648., {256., 261.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellChangeTimes->{{3.477780771859375*^9, 3.4777808256875*^9}, 3.477780873484375*^9, 3.477780988984375*^9, 3.47778248334375*^9}] }, Open ]] }, WindowSize->{786, 823}, WindowMargins->{{18, Automatic}, {14, Automatic}}, FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (February 18, 2009)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[545, 20, 165, 4, 58, "Input"], Cell[713, 26, 268, 6, 82, "Input"], Cell[984, 34, 251, 6, 44, "Input"], Cell[1238, 42, 1767, 49, 230, "Input"], Cell[CellGroupData[{ Cell[3030, 95, 1371, 37, 156, "Input"], Cell[4404, 134, 2378, 48, 534, "Output"] }, Open ]] } ] *) (* End of internal cache information *)