(* 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[ 10195, 311] NotebookOptionsPosition[ 9081, 272] NotebookOutlinePosition[ 9425, 287] CellTagsIndexPosition[ 9382, 284] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ RowBox[{"Newton", "'"}], "s", " ", "Method"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x_", ",", " ", "a_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{"x", "^", "2"}], " ", "-", " ", "a"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"nextterm", "[", RowBox[{"old_", ",", " ", "a_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"old", "^", "2"}], " ", "+", " ", "a"}], ")"}], " ", "/", " ", RowBox[{"(", RowBox[{"2", " ", "*", " ", "old"}], ")"}]}]}], ";"}]}]}]], "Input", FontSize->24], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"nextterm", "[", RowBox[{"2", ",", "2"}], "]"}]], "Input", FontSize->24], Cell[BoxData[ FractionBox["3", "2"]], "Output", FontSize->24] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"previous", " ", "=", " ", "2"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"num", "=", "3"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", " ", RowBox[{"Sqrt", "[", "num", "]"}], ",", "\"\< = \>\"", ",", " ", RowBox[{"SetAccuracy", "[", RowBox[{ RowBox[{"Sqrt", "[", "num", "]"}], ",", "40"}], "]"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", "previous", ",", " ", "\"\< = \>\"", ",", " ", RowBox[{"SetAccuracy", "[", RowBox[{"previous", ",", " ", "15"}], "]"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"j", " ", "=", " ", "1"}], ",", " ", RowBox[{"j", " ", "\[LessEqual]", " ", "5"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", "\"\< \>\"", "]"}], ";", "\[IndentingNewLine]", RowBox[{"previous", " ", "=", " ", RowBox[{"nextterm", "[", RowBox[{"previous", ",", " ", "num"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", " ", "j", ",", " ", "\"\<: \>\"", ",", " ", "previous", ",", " ", "\"\< = \>\"", ",", " ", RowBox[{"SetAccuracy", "[", RowBox[{"previous", ",", "15"}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", " ", RowBox[{"Sqrt", "[", "num", "]"}], ",", " ", "\"\< = \>\"", ",", " ", RowBox[{"SetAccuracy", "[", RowBox[{ RowBox[{"Abs", "[", RowBox[{"previous", "-", RowBox[{"Sqrt", "[", "num", "]"}]}], "]"}], ",", "40"}], "]"}]}], "]"}], ";"}], "\[IndentingNewLine]", "}"}]}], "]"}], ";"}]}], "Input", FontSize->24], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"We are finding \"\>", "\[InvisibleSpace]", SqrtBox["3"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.732050807568877293527446341505872366942805253810380628056`40.\ 77815125038365"}], SequenceForm[ "We are finding ", 3^Rational[1, 2], " = ", 1.732050807568877293527446341505872366942805253810380628056`40.\ 77815125038365], Editable->False]], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Initial Guess: Term 0: \"\>", "\[InvisibleSpace]", "2", "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "2.`15.301029995663981"}], SequenceForm["Initial Guess: Term 0: ", 2, " = ", 2.`15.301029995663981], Editable->False]], "Print", FontSize->24], Cell[BoxData["\<\" \"\>"], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Term \"\>", "\[InvisibleSpace]", "1", "\[InvisibleSpace]", "\<\": \"\>", "\[InvisibleSpace]", FractionBox["7", "4"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.75`15.243038048686294"}], SequenceForm["Term ", 1, ": ", Rational[7, 4], " = ", 1.75`15.243038048686294], Editable->False]], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Difference to \"\>", "\[InvisibleSpace]", SqrtBox["3"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "0.017949192431122706472553658494127633057194746189619371944`37.\ 77393358826751"}], SequenceForm[ "Difference to ", 3^Rational[1, 2], " = ", 0.017949192431122706472553658494127633057194746189619371944`37.\ 77393358826751], Editable->False]], "Print", FontSize->24], Cell[BoxData["\<\" \"\>"], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Term \"\>", "\[InvisibleSpace]", "2", "\[InvisibleSpace]", "\<\": \"\>", "\[InvisibleSpace]", FractionBox["97", "56"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.7321428571428571428571428571`15.238583707260045"}], SequenceForm["Term ", 2, ": ", Rational[97, 56], " = ", 1.7321428571428571428571428571`15.238583707260045], Editable->False]], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Difference to \"\>", "\[InvisibleSpace]", SqrtBox["3"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "0.000092049573979849329696515636984775914337603332476514801`35.\ 483910457522555"}], SequenceForm[ "Difference to ", 3^Rational[1, 2], " = ", 0.000092049573979849329696515636984775914337603332476514801`35.\ 483910457522555], Editable->False]], "Print", FontSize->24], Cell[BoxData["\<\" \"\>"], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Term \"\>", "\[InvisibleSpace]", "3", "\[InvisibleSpace]", "\<\": \"\>", "\[InvisibleSpace]", FractionBox["18817", "10864"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.732050810014727540500736377`15.238560627973103"}], SequenceForm["Term ", 3, ": ", Rational[18817, 10864], " = ", 1.732050810014727540500736377`15.238560627973103], Editable->False]], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Difference to \"\>", "\[InvisibleSpace]", SqrtBox["3"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "2.445850246973290035519164451908446587132181963991`30.908318537458886*^-\ 9"}], SequenceForm[ "Difference to ", 3^Rational[1, 2], " = ", 2.445850246973290035519164451908446587132181963991`30.908318537458886*^-9], Editable->False]], "Print", FontSize->24], Cell[BoxData["\<\" \"\>"], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Term \"\>", "\[InvisibleSpace]", "4", "\[InvisibleSpace]", "\<\": \"\>", "\[InvisibleSpace]", FractionBox["708158977", "408855776"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.7320508075688772952543539461`15.238560627359831"}], SequenceForm["Term ", 4, ": ", Rational[708158977, 408855776], " = ", 1.7320508075688772952543539461`15.238560627359831], Editable->False]], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Difference to \"\>", "\[InvisibleSpace]", SqrtBox["3"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.726907604566299547292301455309463138075`21.757157776618502*^-18"}], SequenceForm[ "Difference to ", 3^Rational[1, 2], " = ", 1.726907604566299547292301455309463138075`21.757157776618502*^-18], Editable->False]], "Print", FontSize->24], Cell[BoxData["\<\" \"\>"], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Term \"\>", "\[InvisibleSpace]", "5", "\[InvisibleSpace]", "\<\": \"\>", "\[InvisibleSpace]", FractionBox["1002978273411373057", "579069776145402304"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "1.7320508075688772935274463415`15.238560627359831"}], SequenceForm["Term ", 5, ": ", Rational[1002978273411373057, 579069776145402304], " = ", 1.7320508075688772935274463415`15.238560627359831], Editable->False]], "Print", FontSize->24], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"Difference to \"\>", "\[InvisibleSpace]", SqrtBox["3"], "\[InvisibleSpace]", "\<\" = \"\>", "\[InvisibleSpace]", "8.60889836971576042545`3.454836255551001*^-37"}], SequenceForm[ "Difference to ", 3^Rational[1, 2], " = ", 8.60889836971576042545`3.454836255551001*^-37], Editable->False]], "Print", FontSize->24] }, Open ]] }, Open ]] }, WindowSize->{1057, 785}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, 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, 735, 24, 111, "Input"], Cell[CellGroupData[{ Cell[1305, 48, 99, 3, 42, "Input"], Cell[1407, 53, 63, 2, 64, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[1507, 60, 2018, 50, 519, "Input"], Cell[CellGroupData[{ Cell[3550, 114, 448, 11, 40, "Print"], Cell[4001, 127, 317, 7, 35, "Print"], Cell[4321, 136, 50, 1, 35, "Print"], Cell[4374, 139, 394, 9, 57, "Print"], Cell[4771, 150, 446, 11, 40, "Print"], Cell[5220, 163, 50, 1, 35, "Print"], Cell[5273, 166, 450, 9, 57, "Print"], Cell[5726, 177, 448, 11, 40, "Print"], Cell[6177, 190, 50, 1, 35, "Print"], Cell[6230, 193, 464, 10, 57, "Print"], Cell[6697, 205, 436, 10, 40, "Print"], Cell[7136, 217, 50, 1, 35, "Print"], Cell[7189, 220, 482, 10, 57, "Print"], Cell[7674, 232, 418, 9, 40, "Print"], Cell[8095, 243, 50, 1, 35, "Print"], Cell[8148, 246, 524, 11, 57, "Print"], Cell[8675, 259, 378, 9, 40, "Print"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)