(* 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[ 36148, 1194] NotebookOptionsPosition[ 31810, 1055] NotebookOutlinePosition[ 32784, 1094] CellTagsIndexPosition[ 32688, 1088] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ M\[CapitalEAcute]TODOS DE RESOLUCI\[CapitalOAcute]N DE UNA ECUACI\ \[CapitalOAcute]N NO LINEAL.\ \>", "Title", CellChangeTimes->{3.506340363625*^9, 3.50634041165625*^9}, TextAlignment->Center, TextJustification->0, FontSize->18, Background->None], Cell[CellGroupData[{ Cell["M\[EAcute]todo de la bisecci\[OAcute]n", "Section", Background->None], Cell[TextData[{ StyleBox["Ejemplo . ", FontColor->GrayLevel[0]], "\nObtener, mediante el m\[EAcute]todo de la bisecci\[OAcute]n , una soluci\ \[OAcute]n aproximada de la ecuaci\[OAcute]n :\n", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SqrtBox[ RowBox[{ SuperscriptBox["x", "2"], "+", "1"}]], " ", "=", " ", RowBox[{"tan", "(", "x", ")"}]}], ",", " ", RowBox[{"0", " ", "<", " ", "x", " ", "<", " ", RowBox[{"\[Pi]", "/", "2"}]}]}], TraditionalForm]]], " \nEn cada iteraci\[OAcute]n se calcula tambi\[EAcute]n la longitud del \ intervalo. 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 0.001. " }], "Text"], Cell[TextData[{ StyleBox["Soluci\[OAcute]n:", FontColor->GrayLevel[0]], "\n En primer lugar realizamos la representaci\[OAcute]n gr\[AAcute]fica \ para obtener un intervalo [a,b] en el que la funci\[OAcute]n cambie de signo" }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"f", "[", "x_", "]"}], "=", RowBox[{ RowBox[{"-", SqrtBox[ RowBox[{ SuperscriptBox["x", "2"], "+", "1"}]]}], "+", RowBox[{"Tan", "[", "x", "]"}]}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"f", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", RowBox[{"\[Pi]", "/", "2"}]}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "1"}], "}"}]}]}], "]"}]], "Input"], Cell["Tomamos el intervalo [0.8,1]", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"a", "=", "0.8"}], ";", RowBox[{"b", "=", "1"}], ";", RowBox[{"c", "=", RowBox[{ RowBox[{"(", RowBox[{"a", "+", "b"}], ")"}], "/", "2"}]}], ";", RowBox[{"lon", "=", RowBox[{"Abs", "[", RowBox[{"b", "-", "a"}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"lon", ">", "0.001"}], "\[And]", RowBox[{ RowBox[{"Abs", "[", " ", RowBox[{"f", "[", "c", "]"}], "]"}], ">", ".001"}]}], ",", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"f", "[", "c", "]"}], "*", RowBox[{"f", "[", "a", "]"}]}], "<", "0"}], ",", RowBox[{"b", "=", "c"}], ",", RowBox[{"a", "=", "c"}]}], "]"}], ";", RowBox[{"c", "=", RowBox[{ RowBox[{"(", RowBox[{"a", "+", "b"}], ")"}], "/", "2"}]}], ";", RowBox[{"lon", "=", RowBox[{"Abs", "[", RowBox[{"b", "-", "a"}], "]"}]}], ";", RowBox[{"Print", "[", RowBox[{"c", ",", "\"\< \>\"", ",", "lon", ",", "\"\< \>\"", ",", RowBox[{"f", "[", "c", "]"}]}], "]"}]}]}], "]"}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Iteraci\[OAcute]n de punto fijo", "Section", Background->None], Cell[TextData[{ StyleBox["Ejemplo", FontColor->GrayLevel[0]], "\nLa funci\[OAcute]n : y = ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["x", "2"], " ", "-", " ", RowBox[{"3", "x"}], " ", "+", " ", SuperscriptBox["e", "x"], " ", "-", " ", "2"}], TraditionalForm]]], " tiene dos ra\[IAcute]ces, una positiva y la otra negativa. Obtener la m\ \[AAcute]s peque\[NTilde]a, con un error menor que 0.00001, mediante la \ iteraci\[OAcute]n de punto fijo, eligiendo una funci\[OAcute]n de iteraci\ \[OAcute]n g(x) que verifique las condiciones del teorema de punto fijo." }], "Text"], Cell[TextData[{ StyleBox["Soluci\[OAcute]n :", FontColor->GrayLevel[0]], "\nEn primer lugar representamos gr\[AAcute]ficamente la funci\[OAcute]n \ para obtener el intervalo de trabajo y la aproximaci\[OAcute]n inicial." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"f", "[", "x_", "]"}], "=", " ", RowBox[{ SuperscriptBox["x", "2"], "-", RowBox[{"3", " ", "x"}], "+", RowBox[{"Exp", "[", "x", "]"}], "-", "2"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"f", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "3"}], "}"}]}], "]"}]], "Input"], Cell["\<\ Interesa que \[VerticalSeparator]g'(x)\[RightBracketingBar] < 1. Una forma de \ obtener g(x) es la siguiente: f(x) = 0 \[LongRightArrow] - \[Alpha] f(x) = 0 \[LongRightArrow] x-\[Alpha] \ f(x) = x \[LongRightArrow] g(x) = x - \[Alpha] f(x) \[LongRightArrow] g'(x) = 1-\[Alpha]f'(x) \[VerticalSeparator]g'(x)\[RightBracketingBar] < 1 \[LongRightArrow] 0 < \ \[Alpha]f'(x) < 2.\ \>", "Text"], Cell[TextData[{ "En este caso f'(x) = 2x-3+", Cell[BoxData[ FormBox[ SuperscriptBox["e", "x"], TraditionalForm]]], ". Representando f'[x] en el intervalo [-1,0] se ve que est\[AAcute] \ comprendida entre -4.5 y -2, luego bastar\[AAcute] con ", "\[Alpha]=0.2." }], "Text"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{ RowBox[{"2", " ", "x"}], "+", RowBox[{"Exp", "[", "x", "]"}], "-", "3"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{ RowBox[{"-", ".3"}], "*", RowBox[{"(", RowBox[{ RowBox[{"2", " ", "x"}], "+", RowBox[{"Exp", "[", "x", "]"}], "-", "3"}], ")"}]}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}]}], "]"}]], "Input"], Cell["\<\ Probamos con g(x) = x+ 0.2*f(x) , y comprobamos las condiciones del teorema.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"g", "[", "x_", "]"}], "=", RowBox[{"x", "+", RowBox[{"0.3", "*", RowBox[{"f", "[", "x", "]"}]}]}]}], ";", RowBox[{"Plot", "[", RowBox[{ RowBox[{"g", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"-", "1"}], ",", "0"}], "}"}]}]}], "]"}]}]], "Input"], Cell["\<\ Se comprueba que \[ForAll] x \[Element] [-1,0] , g(x) (tambi\[EAcute]n) \ \[ForAll] x \[Element] [-1,0]. A continuaci\[OAcute]n representamos g'(x) en \ valor absoluto en dicho intervalo: \ \>", "Text"], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"g", "'"}], "[", "x", "]"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "1"}], ",", "0"}], "}"}], ",", RowBox[{"PlotRange", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}]}], "]"}]], "Input"], Cell[TextData[{ "Una vez comprobadas las dos condiciones del teorema construimos la sucesi\ \[OAcute]n de aproximaciones. Podemos partir de cualquier valor perteneciente \ al intervalo [0,1], por ejemplo, ", Cell[BoxData[ FormBox[ SubscriptBox["x", "0"], TraditionalForm]]], "= -0.5 y utilizar el comando For y el comando SetPrecision con una \ precision de 10 d\[IAcute]gitos." }], "Text"], Cell[BoxData[ RowBox[{"For", "[", RowBox[{ RowBox[{ RowBox[{"k", "=", "1"}], ";", RowBox[{ SubscriptBox["x", "0"], "=", RowBox[{"-", ".5"}]}], ";", RowBox[{"error", "=", "1"}]}], ",", RowBox[{"error", ">", ".00001"}], ",", RowBox[{"k", "++"}], ",", RowBox[{ RowBox[{ SubscriptBox["x", "k"], "=", RowBox[{"SetPrecision", "[", RowBox[{ RowBox[{"g", "[", SubscriptBox["x", RowBox[{"k", "-", "1"}]], "]"}], ",", "10"}], "]"}]}], ";", RowBox[{"error", "=", RowBox[{"Abs", "[", RowBox[{ SubscriptBox["x", "k"], "-", SubscriptBox["x", RowBox[{"k", "-", "1"}]]}], "]"}]}], ";", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "k", ",", "\"\< el valor aprox es: \>\"", ",", SubscriptBox["x", "k"]}], "]"}]}]}], "]"}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["M\[EAcute]todo de Newton-Raphson", "Section", Background->None], Cell[TextData[{ StyleBox["Ejemplo", FontColor->GrayLevel[0]], "\nHallar mediante el m\[EAcute]todo de Newton y con un error menor que ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "4"}]], TraditionalForm]]], " las raices positivas de la ec.:\n0.5 ", Cell[BoxData[ FormBox[ SuperscriptBox["e", RowBox[{"x", "/", "3"}]], TraditionalForm]]], "- sen(x) = 0." }], "Text"], Cell[TextData[{ StyleBox["Soluci\[OAcute]n", FontColor->GrayLevel[0]], " \nEn primer lugar representamos gr\[AAcute]ficamente la funci\[OAcute]n \ para determinar una buena aproximaci\[OAcute]n inicial." }], "Text"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"f", "[", "x_", "]"}], "=", RowBox[{ RowBox[{"0.5", "*", RowBox[{"Exp", "[", RowBox[{"x", "/", "3"}], "]"}]}], "-", RowBox[{"Sin", "[", "x", "]"}]}]}], ";", RowBox[{"Plot", "[", RowBox[{ RowBox[{"f", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "4"}], "}"}]}], "]"}]}]], "Input"], Cell["\<\ A la vista de la gr\[AAcute]fica, dos buenas aproximaciones son : 0.6 y 2. \ Utilizamos esta vez el comando While para realizar las iteraciones del m\ \[EAcute]todo de Newton-Raphson. Se utiliza como condici\[OAcute]n que la \ diferencia en valor absoluto entre las dos \[UAcute]ltimas iteraciones sea \ menor que eps y que el n\.ba de iteraciones sea inferior a nmax.\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"xv", "=", "0.6"}], ";", RowBox[{"error", "=", "1"}], ";", RowBox[{"eps", "=", SuperscriptBox["10", RowBox[{"-", "15"}]]}], ";", RowBox[{"nmax", "=", "50"}], ";", RowBox[{"n", "=", "1"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"While", "[", RowBox[{ RowBox[{ RowBox[{"error", ">", "eps"}], "&&", RowBox[{"n", "<", "nmax"}]}], ",", RowBox[{ RowBox[{"xn", "=", RowBox[{"SetPrecision", "[", RowBox[{ RowBox[{"xv", "-", RowBox[{ RowBox[{"f", "[", "xv", "]"}], "/", RowBox[{ RowBox[{"f", "'"}], "[", "xv", "]"}]}]}], ",", "15"}], "]"}]}], ";", RowBox[{"error", "=", RowBox[{"Abs", "[", RowBox[{"xn", "-", "xv"}], "]"}]}], ";", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "n", ",", "\"\< la sol.aprox.es \>\"", ",", "xn"}], "]"}], ";", RowBox[{"xv", "=", "xn"}], ";", RowBox[{"n", "++"}]}]}], "]"}]], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Los comandos Solve y FindRoot", "Section"], Cell[TextData[{ "Una expresi\[OAcute]n como x^2 + 2 x - 7 \[Equal] 0 representa en ", StyleBox["Mathematica", FontSlant->"Italic"], " una ecuaci\[OAcute]n.Podemos utilizar el comando Solve para obtener los \ valores de x que verifican la ecuaci\[OAcute]n:" }], "Text"], Cell["Solve[x^2 + 2x - 7 == 0, x]", "Input", CellTags->"S1.5.7"], Cell["Si se quiere el valor aproximado : ", "Text"], Cell["NSolve[x^2 + 2x - 7 == 0, x]", "Input", CellTags->"S1.5.7"], Cell["\<\ El resultado es una lista de reglas en las que se asigna a x los valores de \ las raices. Para extraer de la soluci\[OAcute]n el resultado : \ \>", "Text"], Cell["sol=NSolve[x^2 + 2x - 7 == 0, x];a=x/.sol[[1]]", "Input", CellTags->"S1.5.7"], Cell[TextData[{ "El comando Solve siempre intenta dar como resultado f\[OAcute]rmulas expl\ \[IAcute]citas para la soluci\[OAcute]n de una ecuaci\[OAcute]n. Sin embargo, \ si la ecuaci\[OAcute]n es un poco compleja esto resultar\[AAcute] imposible. \ Para ecuaciones algebr\[AAcute]icas de grado menor o igual que 4 ", StyleBox["Mathematica", FontSlant->"Italic"], " proporciona el reusltado exacto, pero puede que esto sea imposible para \ grados mayores. \n", StyleBox["Mathematica", "TI", FontSlant->"Italic"], StyleBox[" ", "TI"], "tambi\[EAcute]n puede resolver ecuaciones con funciones trascendentes . En \ muchos de estos casos da un mensaje indicando que en el resultado no est\ \[AAcute]n todas las soluciones, " }], "Text"], Cell["Solve[ Sin[x] == 1.5 , x ]", "Input", CellTags->"S1.5.7"], Cell["\<\ Se puede obtener una soluci\[OAcute]n num\[EAcute]rica de la ecuaci\[OAcute]n \ mediante el comando FindRoot. Este comando implementa una versi\[OAcute]n del \ m\[EAcute]todo de Newton-Raphson y necesita una aproximaci\[OAcute]n inicial. \ En la pr\[AAcute]ctica esta aproximaci\[OAcute]n se obtiene a partir de la \ representaci\[OAcute]n gr\[AAcute]fica.\ \>", "Text"], Cell["FindRoot[ Cos[x] == x, {x, 1} ]", "Input", CellTags->"S1.5.7"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Resoluci\[OAcute]n de sistemas no lineales. El m\[EAcute]todo de Newton. El \ comando FindRoot.\ \>", "Section"], Cell[TextData[{ "Sea el sistema ", Cell[BoxData[ FormBox[ TagBox[ StyleBox[ RowBox[{"{", StyleBox[GridBox[{ { RowBox[{ RowBox[{"f1", "(", RowBox[{"x", ",", "y"}], ")"}], " ", "=", " ", "0"}]}, { RowBox[{ RowBox[{"f2", "(", RowBox[{"x", ",", "y"}], ")"}], " ", "=", " ", "0"}]} }], ShowAutoStyles->True]}], ShowAutoStyles->False], #& ], TraditionalForm]]], " , y sea J(x,y) la matriz Jacobiana de f1 y f2 respecto a x e y. Sea ", Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["P", "k"], " ", RowBox[{"(", RowBox[{ SubscriptBox["x", "k"], ",", " ", SubscriptBox["y", "k"]}], ")"}]}], TraditionalForm]]], " la aproximaci\[OAcute]n de la soluci\[OAcute]n correspondiente a la etapa \ k. Los pasos correspondientes a la siguiente etapa son:\n1\.ba.- Evaluar F(", Cell[BoxData[ FormBox[ SubscriptBox["P", "k"], TraditionalForm]]], ") = ", Cell[BoxData[ FormBox[ RowBox[{"(", "\[NegativeThinSpace]", GridBox[{ { RowBox[{"f1", "(", SubscriptBox["P", "k"], ")"}]}, { RowBox[{"f2", "(", SubscriptBox["P", "k"], ")"}]} }], "\[NegativeThinSpace]", ")"}], TraditionalForm]]], ".\n2\.ba.- Calcular la matriz jacobiana en ", Cell[BoxData[ FormBox[ FormBox[ SubscriptBox["P", "k"], TraditionalForm], TraditionalForm]]], ", J(", Cell[BoxData[ FormBox[ FormBox[ SubscriptBox["P", "k"], TraditionalForm], TraditionalForm]]], ").\n3\.ba.- Resolver el sistema lineal : J(", Cell[BoxData[ FormBox[ FormBox[ SubscriptBox["P", "k"], TraditionalForm], TraditionalForm]]], ").\[CapitalDelta]p = - F( J(", Cell[BoxData[ FormBox[ FormBox[ SubscriptBox["P", "k"], TraditionalForm], TraditionalForm]]], ").)\n4\.ba.- Calcular la siguiente aproximaci\[OAcute]n : ", Cell[BoxData[ FormBox[ SubscriptBox["P", RowBox[{"k", "+", "1"}]], TraditionalForm]]], " = ", Cell[BoxData[ FormBox[ FormBox[ SubscriptBox["P", "k"], TraditionalForm], TraditionalForm]]], " + \[CapitalDelta]p .\n\n", StyleBox["Ejemplo:", FontWeight->"Bold", FontVariations->{"Underline"->True}], " \nSea el sistema : \n\t", Cell[BoxData[ FormBox[ TagBox[ StyleBox[ RowBox[{"{", StyleBox[GridBox[{ { RowBox[{ RowBox[{ SuperscriptBox["x", "2"], " ", "-", " ", "y"}], " ", "=", " ", "0.2"}]}, { RowBox[{ RowBox[{ SuperscriptBox["y", "2"], " ", "-", " ", "x"}], " ", "=", " ", "0.3"}]} }], ShowAutoStyles->True]}], ShowAutoStyles->False], #& ], TraditionalForm]]], " , \nRepresentar gr\[AAcute]ficamente para obtener la aproximaci\[OAcute]n \ inicial correspondiente a la raiz del primer cuadrante, y calcular 3 \ iteraciones del m\[EAcute]todo de Newton ." }], "Text", CellChangeTimes->{{3.5076240645*^9, 3.507624067171875*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x_", ",", "y_"}], "]"}], "=", RowBox[{ RowBox[{"x", "^", "2"}], "-", "y", "-", ".2"}]}], ";", RowBox[{ RowBox[{"g", "[", RowBox[{"x_", ",", "y_"}], "]"}], "=", RowBox[{ RowBox[{"y", "^", "2"}], "-", "x", "-", ".3"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"graf1", "=", RowBox[{"ImplicitPlot", "[", RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x", ",", "y"}], "]"}], "\[Equal]", "0"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"graf2", "=", RowBox[{"ImplicitPlot", "[", RowBox[{ RowBox[{ RowBox[{"g", "[", RowBox[{"x", ",", "y"}], "]"}], "\[Equal]", "0"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{"-", "2"}], ",", "2"}], "}"}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"graf1", ",", "graf2"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"jacob", "[", RowBox[{"x_", ",", "y_"}], "]"}], "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "x"], " ", RowBox[{"f", "[", RowBox[{"x", ",", "y"}], "]"}]}], ",", RowBox[{ SubscriptBox["\[PartialD]", "y"], " ", RowBox[{"f", "[", RowBox[{"x", ",", "y"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ SubscriptBox["\[PartialD]", "x"], " ", RowBox[{"g", "[", RowBox[{"x", ",", "y"}], "]"}]}], ",", RowBox[{ SubscriptBox["\[PartialD]", "y"], " ", RowBox[{"g", "[", RowBox[{"x", ",", "y"}], "]"}]}]}], "}"}]}], "}"}]}], ";", RowBox[{ RowBox[{"indep", "[", RowBox[{"x_", ",", "y_"}], "]"}], "=", RowBox[{"{", RowBox[{ RowBox[{"-", RowBox[{"f", "[", RowBox[{"x", ",", "y"}], "]"}]}], ",", RowBox[{"-", RowBox[{"g", "[", RowBox[{"x", ",", "y"}], "]"}]}]}], "}"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"Print", "[", RowBox[{ RowBox[{"MatrixForm", "[", RowBox[{"jacob", "[", RowBox[{"x", ",", "y"}], "]"}], "]"}], ",", "\"\< \>\"", ",", " ", RowBox[{"MatrixForm", "[", RowBox[{"indep", "[", RowBox[{"x", ",", "y"}], "]"}], "]"}]}], "]"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"x0", "=", "1.2"}], ";", RowBox[{"y0", "=", "1.2"}], ";", RowBox[{"itermax", "=", "3"}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MatrixForm", "[", RowBox[{"jacob", "[", RowBox[{"x0", ",", "y0"}], "]"}], "]"}], ",", "\"\< \>\"", ",", "\"\\"", ",", RowBox[{"MatrixForm", "[", RowBox[{"indep", "[", RowBox[{"x0", ",", "y0"}], "]"}], "]"}]}], "]"}], ";", RowBox[{"sol", "=", RowBox[{"LinearSolve", "[", RowBox[{ RowBox[{"jacob", "[", RowBox[{"x0", ",", "y0"}], "]"}], ",", RowBox[{"indep", "[", RowBox[{"x0", ",", "y0"}], "]"}]}], "]"}]}], ";", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"MatrixForm", "[", "sol", "]"}]}], "]"}], ";", RowBox[{"x0", "=", RowBox[{"x0", "+", RowBox[{"sol", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ";", RowBox[{"y0", "=", RowBox[{"y0", "+", RowBox[{"sol", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], ";", RowBox[{"Print", "[", RowBox[{ "\"\\"", ",", "k", ",", "\"\< x= \>\"", ",", "x0", ",", "\"\< y= \>\"", ",", "y0"}], "]"}]}], ",", RowBox[{"{", RowBox[{"k", ",", "itermax"}], "}"}]}], "]"}]], "Input"], Cell[CellGroupData[{ Cell["El comando FindRoot", "Subsection"], Cell["\<\ Como en el caso de una sola ec. no lineal, el comando FindRoot nos permite \ obtener una soluci\[OAcute]n num\[EAcute]rica (aproximada) de un sistema de \ ecuaciones no lineales partiendo de una aproximaci\[OAcute]n inicial. Una de \ sus ociones nos permite especificar el n\.ba m\[AAcute]ximo de iteraciones a \ realizar. Si se alcanza el n\.ba m\[AAcute]ximo de iteraciones sin haber \ obtenido la soluci\[OAcute]n el comando FindRoot nos devuelve la aproximaci\ \[OAcute]n calculada en la \[UAcute]ltima etapa que se puede utilizar como \ aproximaci\[OAcute]n inicial de un nuevo comando FindRoot. Es conveniente realizar una representaci\[OAcute]n gr\[AAcute]fica, cuando \ sea posible, para obtener una buena aproximaci\[OAcute]n inicial. El comando FindRoot puede resolver ec. no lineales en variable compleja. Para \ ello solo es preciso incluir la unidad imaginaria I en la \ aproximaci\[OAcute]n inicial. Por ejemplo:\ \>", "Text"], Cell["FindRoot[Sin[x] == 2, {x, 1}]", "Input", CellTags->"S3.9.6"], Cell["FindRoot[Sin[x] == 2, {x, I}]", "Input", CellTags->"S3.9.6"], Cell["\<\ Para resolver el sistema anterior utilizando el comando FindRoot:\ \>", "Text"], Cell[BoxData[ RowBox[{"FindRoot", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"f", "[", RowBox[{"x", ",", "y"}], "]"}], "\[Equal]", "0"}], ",", RowBox[{ RowBox[{"g", "[", RowBox[{"x", ",", "y"}], "]"}], "\[Equal]", "0"}]}], "}"}], ",", RowBox[{"{", RowBox[{"x", ",", "1.2"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "1.2"}], "}"}]}], "]"}]], "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Ejercicios", "Section", Background->None], Cell[TextData[{ "1\.ba.- Comprobar gr\[AAcute]ficamente que la funci\[OAcute]n f(x) = x- 0.2 \ sen(x) - 0,5 tiene una \[UAcute]nica raiz real en el intervalo [0.5 , 1]. \ Aplicar los m\[EAcute]todos de la bisecci\[OAcute]n, punto fijo y \ Newton-Raphson, contando en cada caso el n\[UAcute]mero de iteraciones que se \ han realizado , para determinar la raiz con una precisi\[OAcute]n de ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "4"}]], TraditionalForm]]], ". Establecer un n\.ba m\[AAcute]ximo de iteraciones a realizar igual a 50." }], "Text"], Cell["\ta) Bisecci\[OAcute]n", "Text"], Cell["\tb) Punto fijo", "Text"], Cell["\tc) Newton-Raphson", "Text"], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075642632760305`*^9}], Cell[TextData[{ "2\.ba.- Representar en una misma gr\[AAcute]fica las funciones f(x) = 2 \ cos(x) y g(x) = ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "x"], TraditionalForm]]], " para obtener aproximaciones iniciales de las raices de 2cos(x) - ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "x"], TraditionalForm]]], "= 0. \[DownQuestion]Cu\[AAcute]ntas ra\[IAcute]ces tiene?. \ \[DownQuestion]Cu\[AAcute]ntas son positivas?. Determinar las raices \ positivas con una precisi\[OAcute]n de ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "8"}]], TraditionalForm]]], " utilizando el m\[EAcute]todo de Newton-Raphson ." }], "Text", CellChangeTimes->{{3.5075642779010305`*^9, 3.5075642806354055`*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075642852291555`*^9}], Cell[TextData[{ "3\.ba.- Comprobar de forma gr\[AAcute]fica que la ecuaci\[OAcute]n .\n\t\t4 \ sen(x) = 1+x\ntiene tres raices reales : ", Cell[BoxData[ FormBox[ SubscriptBox["r", "1"], TraditionalForm]]], "<", Cell[BoxData[ FormBox[ SubscriptBox["r", "2"], TraditionalForm]]], "<", Cell[BoxData[ FormBox[ SubscriptBox["r", "3"], TraditionalForm]]], " . A continuaci\[OAcute]n determinar con una precisi\[OAcute]n de ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "6"}]], TraditionalForm]]], ",\n\ta) ", Cell[BoxData[ FormBox[ SubscriptBox["r", "1"], TraditionalForm]]], " utilizando el mdo de la secante.\n\tb) ", Cell[BoxData[ FormBox[ SubscriptBox["r", "2"], TraditionalForm]]], " \" \" \" \" \" bisecci\[OAcute]n.\n\tc) ", Cell[BoxData[ FormBox[ SubscriptBox["r", "3"], TraditionalForm]]], " \" \" \" \" Newton." }], "Text"], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075642980729055`*^9}], Cell[TextData[{ "4\.ba.- Encontrar una raiz aproximada de la ecuaci\[OAcute]n :\n\t\t", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["x", "3"], "-", "x", "-", "1"}], " ", "=", " ", "0"}], TraditionalForm]]], "\nen el intervalo [1 , 2] con una precisi\[OAcute]n de ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "10"}]], TraditionalForm]]], " primero por el m\[EAcute]todo de Newton y luego por el de la secante. \ Contar el n\.ba de iteraciones que se han realizado en ambos casos para \ comprobar cu\[AAcute]l de los dos m\[EAcute]todos tiene una convergencia m\ \[AAcute]s r\[AAcute]pida. " }], "Text"], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075643090260305`*^9}], Cell[TextData[{ "5 \.ba.- Sea f(x) = ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"8", "x"}], "-", RowBox[{"cos", "(", "x", ")"}], "-", RowBox[{"2", SuperscriptBox["x", "2"]}]}], TraditionalForm]]], ", representar gr\[AAcute]ficamente f (x) en el intervalo [0, \[Pi]/6]. \ Justificar que la expresi\[OAcute]n :\n\t", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{"g", "(", SubscriptBox["x", "n"], ")"}], " ", "=", " ", RowBox[{ FractionBox[ SubscriptBox["cosx", "n"], "8"], "+", FractionBox[ SuperscriptBox[ SubscriptBox["x", "n"], "2"], "4"]}]}], TraditionalForm]]], ", \npermitir\[AAcute] obtener una sucesi\[OAcute]n cuyo l\[IAcute]mite sea \ la raiz de la ecuaci\[OAcute]n en el intervalo [0, \[Pi]/6]. Hallar dicha \ raiz con una precisi\[OAcute]n de ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "4"}]], TraditionalForm]]], "." }], "Text", CellChangeTimes->{{3.5075643362135305`*^9, 3.5075644527447805`*^9}, { 3.5075645693697805`*^9, 3.5075646233229055`*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075646504322805`*^9}], Cell[TextData[{ "6\.ba.- Determinar la raiz cuadrada negativa de 0.5 con cuatro decimales y \ una precisi\[OAcute]n de ", Cell[BoxData[ FormBox[ SuperscriptBox["10", RowBox[{"-", "3"}]], TraditionalForm]]], "considerando la funci\[OAcute]n f(x) = ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["x", "2"], "-", "0.5"}], TraditionalForm]]], " y resolviendo la ec. x = ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["x", "2"], "+", "x", "-", "0.5"}], TraditionalForm]]], " mediante el m\[EAcute]todo de las aproximaciones sucesivas comenzando con ", Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["x", "0"], "=", " ", RowBox[{"-", "0.6"}]}], TraditionalForm]]], ". \[DownQuestion]Puede determinarse del mismo modo la raiz positiva?" }], "Text", CellChangeTimes->{{3.5075646355885305`*^9, 3.5075646468072805`*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075646516197805`*^9}], Cell[TextData[{ "7\.ba.- Hacer una representaci\[OAcute]n gr\[AAcute]fica de las funciones \ f(x) = 2cosx y g(x) = ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "x"], TraditionalForm]]], " para obtener estimaciones iniciales de las raices de la ec. 2cosx - ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "x"], TraditionalForm]]], "=0. \[DownQuestion]Cu\[AAcute]ntas raices tiene ? \ \[DownQuestion]Cu\[AAcute]ntas son positivas?. Determinar las raices \ positivas con una precisi\[OAcute]n \[VerticalSeparator]f(r)\ \[VerticalSeparator] < ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["10", RowBox[{"-", "3"}]], " "}], TraditionalForm]]], "utilizando el m\[EAcute]todo de la secante y el de Newton-Raphson.\n" }], "Text", CellChangeTimes->{{3.5075646546354055`*^9, 3.5075646642604055`*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075646703697805`*^9}], Cell[TextData[{ "8\.ba.- Resolver con un error relativo inferior al 0.05% la ec. f(x) = ", Cell[BoxData[ FormBox[ SuperscriptBox["e", RowBox[{"-", "x"}]], TraditionalForm]]], "-x = 0, mediante el m\[EAcute]todo de la secante tomando como valores \ iniciales ", Cell[BoxData[ FormBox[ RowBox[{ RowBox[{ SubscriptBox["x", RowBox[{"-", "1"}]], "=", "0"}], ",", " ", RowBox[{ RowBox[{"y", " ", SubscriptBox["x", "0"]}], "=", " ", "1"}], ","}], TraditionalForm]]], " y sabiendo que la soluci\[OAcute]n exacta es 0.56714329. Trabajar con \ redondeo a seis cifras decimales." }], "Text", CellChangeTimes->{{3.5075646747135305`*^9, 3.5075646895260305`*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075646929635305`*^9}], Cell[TextData[{ "\n9\.ba.- Resolver el siguiente sistema no lineal primero utilizando el m\ \[EAcute]todo de Newton y a continuaci\[OAcute]n con el comando FindRoot:\n3 \ x - cos(y.z) - 1/2 = 0\n", Cell[BoxData[{ FormBox[ RowBox[{ RowBox[{ SuperscriptBox["x", "2"], " ", "-", " ", RowBox[{"81", SuperscriptBox[ RowBox[{"(", RowBox[{"y", "+", "0.2"}], ")"}], "2"]}], " ", "+", " ", RowBox[{"sen", "(", "z", ")"}], " ", "+", " ", "1.06"}], " ", "=", " ", "0"}], TraditionalForm], "\[IndentingNewLine]", FormBox[ RowBox[{ RowBox[{ SuperscriptBox["e", RowBox[{"-", "xy"}]], " ", "+", " ", RowBox[{"20", " ", "z"}], " ", "+", " ", FractionBox[ RowBox[{ RowBox[{"10", "\[Pi]"}], "-", "3"}], "3"]}], " ", "=", " ", "0"}], TraditionalForm]}]], "\nTomar como aproximaci\[OAcute]n inicial ", Cell[BoxData[ FormBox[ SuperscriptBox["x1", RowBox[{"(", "0", ")"}]], TraditionalForm]]], "= 0.1, ", Cell[BoxData[ FormBox[ SuperscriptBox["x2", RowBox[{"(", "0", ")"}]], TraditionalForm]]], "= 0.1 y ", Cell[BoxData[ FormBox[ SuperscriptBox["x3", RowBox[{"(", "0", ")"}]], TraditionalForm]]], "= - 0.1" }], "Text", CellChangeTimes->{{3.507624120375*^9, 3.507624121140625*^9}}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"f1", "[", RowBox[{"x_", ",", "y_", ",", "z_"}], "]"}], "=", RowBox[{ RowBox[{"3", " ", "x"}], "-", RowBox[{"Cos", "[", RowBox[{"y", "*", "z"}], "]"}], "-", ".5"}]}], ";", RowBox[{ RowBox[{"f2", "[", RowBox[{"x_", ",", "y_", ",", "z_"}], "]"}], "=", RowBox[{ RowBox[{"x", "^", "2"}], "-", RowBox[{"81", " ", RowBox[{ RowBox[{"(", RowBox[{"y", "+", ".2"}], ")"}], "^", "2"}]}], "+", RowBox[{"Sin", "[", "z", "]"}], "+", "1.06"}]}], ";", RowBox[{ RowBox[{"f3", "[", RowBox[{"x_", ",", "y_", ",", "z_"}], "]"}], "=", RowBox[{ RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "x"}], "*", "y"}], "]"}], "+", RowBox[{"20", " ", "z"}], "+", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"10", " ", "Pi"}], "-", "3"}], ")"}], "/", "3"}]}]}], ";"}]], "Input"] }, Open ]] }, Open ]] }, WindowToolbars->"EditBar", WindowSize->{1672, 933}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, Magnification->1.5, FrontEndVersion->"8.0 for Microsoft Windows (32-bit) (November 7, 2010)", StyleDefinitions->"Report.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "S1.5.7"->{ Cell[11755, 402, 65, 1, 46, "Input", CellTags->"S1.5.7"], Cell[11877, 407, 66, 1, 46, "Input", CellTags->"S1.5.7"], Cell[12114, 415, 84, 1, 46, "Input", CellTags->"S1.5.7"], Cell[12947, 435, 64, 1, 46, "Input", CellTags->"S1.5.7"], Cell[13397, 446, 69, 1, 46, "Input", CellTags->"S1.5.7"]}, "S3.9.6"->{ Cell[21544, 720, 67, 1, 46, "Input", CellTags->"S3.9.6"], Cell[21614, 723, 67, 1, 46, "Input", CellTags->"S3.9.6"]} } *) (*CellTagsIndex CellTagsIndex->{ {"S1.5.7", 32209, 1069}, {"S3.9.6", 32538, 1080} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 261, 8, 71, "Title"], Cell[CellGroupData[{ Cell[853, 34, 76, 1, 98, "Section"], Cell[932, 37, 799, 19, 143, "Text"], Cell[1734, 58, 240, 5, 61, "Text"], Cell[1977, 65, 244, 9, 60, "Input"], Cell[2224, 76, 319, 10, 46, "Input"], Cell[2546, 88, 44, 0, 38, "Text"], Cell[2593, 90, 301, 10, 46, "Input"], Cell[2897, 102, 862, 26, 46, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3796, 133, 69, 1, 98, "Section"], Cell[3868, 136, 603, 14, 86, "Text"], Cell[4474, 152, 236, 5, 61, "Text"], Cell[4713, 159, 229, 7, 48, "Input"], Cell[4945, 168, 189, 6, 46, "Input"], Cell[5137, 176, 400, 8, 107, "Text"], Cell[5540, 186, 280, 8, 38, "Text"], Cell[5823, 196, 251, 8, 46, "Input"], Cell[6077, 206, 327, 11, 46, "Input"], Cell[6407, 219, 102, 2, 38, "Text"], Cell[6512, 223, 477, 16, 46, "Input"], Cell[6992, 241, 213, 4, 38, "Text"], Cell[7208, 247, 341, 11, 46, "Input"], Cell[7552, 260, 398, 9, 61, "Text"], Cell[7953, 271, 895, 29, 74, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[8885, 305, 70, 1, 98, "Section"], Cell[8958, 308, 408, 14, 88, "Text"], Cell[9369, 324, 219, 5, 61, "Text"], Cell[9591, 331, 391, 13, 46, "Input"], Cell[9985, 346, 392, 6, 61, "Text"], Cell[10380, 354, 259, 8, 48, "Input"], Cell[10642, 364, 749, 23, 74, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[11428, 392, 48, 0, 98, "Section"], Cell[11479, 394, 273, 6, 38, "Text"], Cell[11755, 402, 65, 1, 46, "Input", CellTags->"S1.5.7"], Cell[11823, 405, 51, 0, 38, "Text"], Cell[11877, 407, 66, 1, 46, "Input", CellTags->"S1.5.7"], Cell[11946, 410, 165, 3, 38, "Text"], Cell[12114, 415, 84, 1, 46, "Input", CellTags->"S1.5.7"], Cell[12201, 418, 743, 15, 84, "Text"], Cell[12947, 435, 64, 1, 46, "Input", CellTags->"S1.5.7"], Cell[13014, 438, 380, 6, 61, "Text"], Cell[13397, 446, 69, 1, 46, "Input", CellTags->"S1.5.7"] }, Open ]], Cell[CellGroupData[{ Cell[13503, 452, 122, 3, 98, "Section"], Cell[13628, 457, 3041, 109, 345, "Text"], Cell[16672, 568, 332, 11, 46, "Input"], Cell[17007, 581, 289, 9, 46, "Input"], Cell[17299, 592, 289, 9, 46, "Input"], Cell[17591, 603, 88, 2, 46, "Input"], Cell[17682, 607, 1106, 37, 49, "Input"], Cell[18791, 646, 303, 8, 46, "Input"], Cell[19097, 656, 145, 4, 46, "Input"], Cell[19245, 662, 1277, 36, 101, "Input"], Cell[CellGroupData[{ Cell[20547, 702, 41, 0, 57, "Subsection"], Cell[20591, 704, 950, 14, 130, "Text"], Cell[21544, 720, 67, 1, 46, "Input", CellTags->"S3.9.6"], Cell[21614, 723, 67, 1, 46, "Input", CellTags->"S3.9.6"], Cell[21684, 726, 89, 2, 38, "Text"], Cell[21776, 730, 431, 14, 46, "Input"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[22256, 750, 48, 1, 98, "Section"], Cell[22307, 753, 577, 11, 63, "Text"], Cell[22887, 766, 38, 0, 38, "Text"], Cell[22928, 768, 31, 0, 38, "Text"], Cell[22962, 770, 35, 0, 38, "Text"], Cell[23000, 772, 89, 1, 74, "Input"], Cell[23092, 775, 740, 19, 63, "Text"], Cell[23835, 796, 89, 1, 74, "Input"], Cell[23927, 799, 938, 32, 155, "Text"], Cell[24868, 833, 89, 1, 74, "Input"], Cell[24960, 836, 661, 17, 111, "Text"], Cell[25624, 855, 89, 1, 74, "Input"], Cell[25716, 858, 1066, 32, 108, "Text"], Cell[26785, 892, 89, 1, 74, "Input"], Cell[26877, 895, 866, 25, 63, "Text"], Cell[27746, 922, 89, 1, 74, "Input"], Cell[27838, 925, 826, 21, 86, "Text"], Cell[28667, 948, 89, 1, 74, "Input"], Cell[28759, 951, 704, 20, 61, "Text"], Cell[29466, 973, 89, 1, 74, "Input"], Cell[29558, 976, 1303, 42, 169, "Text"], Cell[30864, 1020, 918, 31, 74, "Input"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)