(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 9.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 157, 7] NotebookDataLength[ 5304, 147] NotebookOptionsPosition[ 5059, 134] NotebookOutlinePosition[ 5404, 149] CellTagsIndexPosition[ 5361, 146] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ RowBox[{"P2", " ", "metodos", " ", "de", " ", "resol", " ", RowBox[{"ec", ".", " ", "no"}], " ", "lineal", "\[IndentingNewLine]", "\t", "Biseccion", " ", RowBox[{"(", RowBox[{"Bolzano", "/", "segmentos"}], ")"}], " ", "\[IndentingNewLine]", " ", "Newton"}], "-", RowBox[{"Raphson", " ", RowBox[{"(", RowBox[{ RowBox[{"con", " ", "derivada"}], ",", " ", RowBox[{"un", " ", "punto"}]}], ")"}], "\[IndentingNewLine]", "\t", "Secante", " ", RowBox[{"(", RowBox[{ RowBox[{"sin", " ", "derivada"}], ",", " ", RowBox[{"2", " ", "puntos"}]}], ")"}]}]}], "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", "BISECCION", " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", "x_", "]"}], "=", RowBox[{ RowBox[{"-", SqrtBox[ RowBox[{ SuperscriptBox["x", "2"], "+", "1"}]]}], "+", RowBox[{"Tan", "[", "x", "]"}]}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Primero", " ", "hacer", " ", "un", " ", "plot", " ", "para", " ", "tomar", " ", "un", " ", "intervalo", " ", "inicial"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"Plot", "[", RowBox[{ RowBox[{"f", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", RowBox[{"\[Pi]", "/", "2"}]}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}]}]}], "]"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{"Tomamos", " ", "el", " ", RowBox[{"intervalo", "[", RowBox[{"0.8", ",", "1"}], "]"}], " ", "y", " ", "lo", " ", "definimos"}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"a", "=", "0.8"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"b", "=", "1"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"c", "=", RowBox[{ RowBox[{"(", RowBox[{"a", "+", "b"}], ")"}], "/", "2"}]}], ";", RowBox[{"lon", "=", RowBox[{"Abs", "[", RowBox[{"b", "-", "a"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "El", " ", "proceso", " ", "finalizar\[AAcute]", " ", "cuando", " ", "la", " ", "longitud", " ", "del", " ", "intervalo", " ", "sea", " ", "menor", " ", "que", " ", "0.001", " ", "o", " ", "el", " ", "valor", " ", "de", " ", "la", " ", "funci\[OAcute]n", " ", "en", " ", "el", " ", "resultado", " ", "de", " ", "la", " ", "\[UAcute]ltima", " ", "iteraci\[OAcute]n", " ", "sea", " ", "menor", " ", "que", " ", RowBox[{"0.001", "."}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Bucle", " ", "principal", " ", "para", " ", "las", " ", "iteraciones"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"lon", ">", "0.001"}], "&&", RowBox[{ RowBox[{"Abs", "[", " ", RowBox[{"f", "[", "c", "]"}], "]"}], ">", ".001"}]}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", "c", "]"}], "*", RowBox[{"f", "[", "a", "]"}]}], "<", "0"}], ",", RowBox[{"b", "=", "c"}], ",", RowBox[{"a", "=", "c"}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"c", "=", RowBox[{ RowBox[{"(", RowBox[{"a", "+", "b"}], ")"}], "/", "2"}]}], ";", "\[IndentingNewLine]", RowBox[{"lon", "=", RowBox[{"Abs", "[", RowBox[{"b", "-", "a"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"c", ",", "\"\< \>\"", ",", "lon", ",", "\"\< \>\"", ",", RowBox[{"f", "[", "c", "]"}]}], "]"}]}]}], "]"}]}]}]], "Input", CellChangeTimes->{{3.6560914214170065`*^9, 3.656091544949445*^9}, { 3.656091698981762*^9, 3.656091758934091*^9}, 3.656091792502247*^9, { 3.656091839304623*^9, 3.656091882577143*^9}, {3.656091988830253*^9, 3.6560920437835975`*^9}, {3.656092107014532*^9, 3.6560921129314733`*^9}, { 3.6560926920049686`*^9, 3.6560926935119815`*^9}}] }, WindowSize->{716, 521}, WindowMargins->{{125, Automatic}, {Automatic, 17}}, FrontEndVersion->"9.0 for Microsoft Windows (32-bit) (January 25, 2013)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[557, 20, 4498, 112, 602, "Input"] } ] *) (* End of internal cache information *)