(* 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[ 8078, 208] NotebookOptionsPosition[ 7210, 176] NotebookOutlinePosition[ 7611, 193] CellTagsIndexPosition[ 7568, 190] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{"Newton", "'"}], "s", " ", "Method", " ", "to", " ", "Compute", " ", RowBox[{"Sqrt", "[", "3", "]"}]}], "Subtitle"]], "Input", CellChangeTimes->{{3.4324620347175646`*^9, 3.432462041294292*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"iter", "[", "x_", "]"}], " ", ":=", " ", RowBox[{ RowBox[{"(", RowBox[{"1", "/", "2"}], ")"}], " ", RowBox[{"(", RowBox[{"x", " ", "+", " ", RowBox[{"(", RowBox[{"3", "/", "x"}], ")"}]}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", "2"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ "Print", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"i", " ", "=", " ", "1"}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", "4"}], ",", RowBox[{"i", "++"}], ",", " ", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"iter", "[", "temp", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", "temp", "]"}], ";"}], "}"}]}], "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", "2"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ "Print", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", " ", "=", " ", "1"}], ",", " ", RowBox[{"i", " ", "\[LessEqual]", " ", "4"}], ",", RowBox[{"i", "++"}], ",", " ", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"temp", " ", "=", " ", RowBox[{"iter", "[", "temp", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"SetAccuracy", "[", RowBox[{ RowBox[{"N", "[", RowBox[{ RowBox[{"1.0", " ", "temp"}], ",", "25"}], "]"}], ",", "25"}], "]"}], "]"}], ";"}], " ", "}"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"SetAccuracy", "[", RowBox[{ RowBox[{"Sqrt", "[", "3.", "]"}], ",", "25"}], "]"}], "]"}], ";"}]}], "Input", CellChangeTimes->{{3.4324615619577837`*^9, 3.432461654479206*^9}, { 3.432461740350663*^9, 3.432461864949134*^9}, {3.432461919694653*^9, 3.4324620019364595`*^9}, {3.4324620564905853`*^9, 3.432462063569234*^9}}], Cell[CellGroupData[{ Cell[BoxData["\<\"First four iterates, first guess is x0 = 2.\"\>"], "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644617543`*^9}], Cell[BoxData[ FractionBox["7", "4"]], "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.432462064463708*^9}], Cell[BoxData[ FractionBox["97", "56"]], "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644666367`*^9}], Cell[BoxData[ FractionBox["18817", "10864"]], "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644676137`*^9}], Cell[BoxData[ FractionBox["708158977", "408855776"]], "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.43246206446859*^9}], Cell[BoxData["\<\"Numerical approximations to first four iterates.\"\>"], \ "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.432462064470543*^9}], Cell[BoxData["1.75`25.24303804868629"], "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644715195`*^9}], Cell[BoxData["1.73214285714285720629845855000894516706`25.238583707260045"], \ "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644734726`*^9}], Cell[BoxData["1.73205081001472760426906916109146550298`25.2385606279731"], \ "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644871435`*^9}], Cell[BoxData["1.73205080756887719317660412343684583902`25.23856062735983"], \ "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644930024`*^9}], Cell[BoxData["1.73205080756887719317660412343684583902`25.23856062735983"], \ "Print", CellChangeTimes->{{3.432461644118541*^9, 3.432461655065106*^9}, { 3.432461747593364*^9, 3.4324617967035017`*^9}, {3.4324618533707733`*^9, 3.432461865491091*^9}, {3.4324619240127363`*^9, 3.432461959740918*^9}, { 3.4324619903278275`*^9, 3.432462028734549*^9}, 3.4324620644988613`*^9}] }, Open ]] }, Open ]], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.444347566587261*^9}] }, WindowSize->{685, 632}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, FrontEndVersion->"6.0 for Microsoft Windows (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 249, 6, 44, "Input"], Cell[CellGroupData[{ Cell[842, 31, 2201, 61, 252, "Input"], Cell[CellGroupData[{ Cell[3068, 96, 371, 4, 23, "Print"], Cell[3442, 102, 339, 5, 38, "Print"], Cell[3784, 109, 343, 5, 38, "Print"], Cell[4130, 116, 349, 5, 38, "Print"], Cell[4482, 123, 354, 5, 38, "Print"], Cell[4839, 130, 376, 5, 23, "Print"], Cell[5218, 137, 342, 4, 23, "Print"], Cell[5563, 143, 381, 5, 23, "Print"], Cell[5947, 150, 379, 5, 23, "Print"], Cell[6329, 157, 380, 5, 23, "Print"], Cell[6712, 164, 380, 5, 23, "Print"] }, Open ]] }, Open ]], Cell[7119, 173, 87, 1, 52, "Input"] } ] *) (* End of internal cache information *)