(* 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[ 14966, 507] NotebookOptionsPosition[ 12100, 412] NotebookOutlinePosition[ 13095, 449] CellTagsIndexPosition[ 13025, 444] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[" INTEGRACI\[CapitalOAcute]N NUM\[CapitalEAcute]RICA.", "Title", CellChangeTimes->{3.506345825515625*^9}, TextAlignment->Center, TextJustification->0, FontSize->18, Background->None], Cell[CellGroupData[{ Cell["1.- El paquete NumericalMath`NewtonCotes`", "Section", TextAlignment->Left, TextJustification->0], Cell[TextData[{ StyleBox["Cuando se trata de integrar una funci\[OAcute]n que viene dada en \ forma de tabla en abscisas igualmente espaciadas la mejor soluci\[OAcute]n es \ utilizar las f\[OAcute]rmulas de cuadratura de Newton-Cotes.\n\ B\[AAcute]sicamente la utilizaci\[OAcute]n de las f\[OAcute]rmulas de \ Newton-Cotes permite obtener un valor aproximado de la integral de f(x) en el \ intervalo [a,b], como una combinaci\[OAcute]n lineal de los valores del \ integrando en abscisas igualmente espaciadas:", FontVariations->{"CompatibilityType"->0}], "\n", Cell[BoxData[ FormBox[ RowBox[{ SubsuperscriptBox["\[Integral]", "a", "b"], "f", RowBox[{"(", "x", ")"}], "\[DifferentialD]", "x", "=", UnderoverscriptBox["\[Sum]", RowBox[{"i", "=", "1"}], "n", LimitsPositioning->False], SubscriptBox["w", "i"], "f", RowBox[{"(", SubscriptBox["x", "i"], ")"}]}], TraditionalForm]]], "\nLos extremos del intervalo pueden estar incluidos, en este caso se dice \ que la f\[OAcute]rmula es cerrada, o no, y entonces se dice que la \ f\[OAcute]rmula es abierta. Aunque no las utilizaremos, cabe se\[NTilde]alar \ que las f\[OAcute]rmulas abiertas que proporciona este paquete tienen la \ primera abscisa a una distancia de h/2 del extremo inferior del intervalo.\n\ Existen n grados de libertad, los n pesos, y como la integraci\[OAcute]n y \ la suma son operaciones lineales se puede esperar que el resultado obtenido \ sea exacto para polinomios de grado menor que n. ", StyleBox["Mathematica", FontSlant->"Italic"], " nos permite obtener tambi\[EAcute]n la expresi\[OAcute]n del \ t\[EAcute]rmino de error. \nEn primer lugar debemos cargar el paquete:\n\ <"S5.89.1"], Cell[BoxData[ RowBox[{ RowBox[{"General", "::", "\<\"newpkg\"\>"}], ":", " ", "\<\"\\!\\(\\\"NumericalMath`NewtonCotes`\\\"\\) is now available as \ the \\!\\(\\\"Numerical Differential Equation Analysis Package\\\"\\). See \ the Compatibility Guide for updating information.\"\>"}]], "Message", "MSG", CellChangeTimes->{3.4271771224375*^9}, CellTags->"S5.89.1"] }, Open ]], Cell["er1=NewtonCotesError[2, f, 1, 2]", "Input", CellTags->"S5.89.1"], Cell["er2=NewtonCotesError[3, f, 1, 2]", "Input", CellTags->"S5.89.1"], Cell["er3=NewtonCotesError[4, f, 1, 2]", "Input", CellTags->"S5.89.1"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"f", "[", "x_", "]"}], "=", RowBox[{"1", "/", RowBox[{"x", "^", "2"}]}]}], ";"}]], "Input"], Cell["El valor exacto de la integral es :", "Text"], Cell[BoxData[ RowBox[{"exact", "=", RowBox[{ RowBox[{ SubsuperscriptBox["\[Integral]", "1", "2"], RowBox[{ FractionBox["1", SuperscriptBox["x", "2"]], RowBox[{"\[DifferentialD]", "x"}]}]}], "//", "N"}]}]], "Input"], Cell["a)", "Text"], Cell["lista1=NewtonCotesWeights[2, 1, 2]", "Input", CellTags->"S5.89.1"], Cell[BoxData[ RowBox[{ RowBox[{"abs1", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"lista1", "[", RowBox[{"[", RowBox[{"k", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "2"}], "}"}]}], "]"}]}], ";", RowBox[{"pesos1", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"lista1", "[", RowBox[{"[", RowBox[{"k", ",", "2"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "2"}], "}"}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"aprox1", "=", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"k", "=", "1"}], "2"], RowBox[{ RowBox[{"f", "[", RowBox[{"abs1", "[", RowBox[{"[", "k", "]"}], "]"}], "]"}], "*", RowBox[{"pesos1", "[", RowBox[{"[", "k", "]"}], "]"}]}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"f", "''"}], "[", "x", "]"}]], "Input"], Cell["\<\ La derivada segunda ser\[AAcute] m\[AAcute]xima en x=1\ \>", "Text"], Cell[BoxData[ RowBox[{"cota1", "=", RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"er1", "[", RowBox[{"[", "1", "]"}], "]"}], "*", RowBox[{ RowBox[{"f", "''"}], "[", "1", "]"}]}], "]"}], "//", "N"}]}]], "Input"], Cell[BoxData[ RowBox[{"error1", "=", RowBox[{"Abs", "[", RowBox[{"exact", "-", "aprox1"}], "]"}]}]], "Input"], Cell["b)", "Text"], Cell["lista2=NewtonCotesWeights[3, 1, 2]", "Input", CellTags->"S5.89.1"], Cell[BoxData[ RowBox[{ RowBox[{"abs2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"lista2", "[", RowBox[{"[", RowBox[{"k", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "3"}], "}"}]}], "]"}]}], ";", RowBox[{"pesos2", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"lista2", "[", RowBox[{"[", RowBox[{"k", ",", "2"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "3"}], "}"}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"aprox2", "=", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"k", "=", "1"}], "3"], RowBox[{ RowBox[{"f", "[", RowBox[{"abs2", "[", RowBox[{"[", "k", "]"}], "]"}], "]"}], "*", RowBox[{"pesos2", "[", RowBox[{"[", "k", "]"}], "]"}]}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"f", "''''"}], "[", "x", "]"}]], "Input"], Cell["\<\ La derivada cuarta ser\[AAcute] m\[AAcute]xima en x=1\ \>", "Text"], Cell[BoxData[ RowBox[{"cota2", "=", RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"er2", "[", RowBox[{"[", "1", "]"}], "]"}], "*", RowBox[{ RowBox[{"f", "''''"}], "[", "1", "]"}]}], "]"}], "//", "N"}]}]], "Input"], Cell[BoxData[ RowBox[{"error2", "=", RowBox[{"Abs", "[", RowBox[{"exact", "-", "aprox2"}], "]"}]}]], "Input"], Cell["c)", "Text"], Cell["lista3=NewtonCotesWeights[4, 1, 2]", "Input", CellTags->"S5.89.1"], Cell[BoxData[ RowBox[{ RowBox[{"abs3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"lista3", "[", RowBox[{"[", RowBox[{"k", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "4"}], "}"}]}], "]"}]}], ";", RowBox[{"pesos3", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"lista3", "[", RowBox[{"[", RowBox[{"k", ",", "2"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"k", ",", "4"}], "}"}]}], "]"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{"aprox3", "=", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"k", "=", "1"}], "4"], RowBox[{ RowBox[{"f", "[", RowBox[{"abs3", "[", RowBox[{"[", "k", "]"}], "]"}], "]"}], "*", RowBox[{"pesos3", "[", RowBox[{"[", "k", "]"}], "]"}]}]}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"f", "''''"}], "[", "x", "]"}]], "Input"], Cell["\<\ La derivada cuarta ser\[AAcute] m\[AAcute]xima en x=1\ \>", "Text"], Cell[BoxData[ RowBox[{"cota3", "=", RowBox[{ RowBox[{"Abs", "[", RowBox[{ RowBox[{"er3", "[", RowBox[{"[", "1", "]"}], "]"}], "*", RowBox[{ RowBox[{"f", "''''"}], "[", "1", "]"}]}], "]"}], "//", "N"}]}]], "Input"], Cell[BoxData[ RowBox[{"error3", "=", RowBox[{"Abs", "[", RowBox[{"exact", "-", "aprox3"}], "]"}]}]], "Input"], Cell[CellGroupData[{ Cell["Ejercicios", "Subsection"], Cell[TextData[{ "1\.ba.- Utilizando la segunda f\[OAcute]rmula de Simpson y la \ f\[OAcute]rmula de Newton-Cotes de cinco puntos calcular \n", Cell[BoxData[ FormBox[ RowBox[{ SubsuperscriptBox["\[Integral]", "1", "3"], RowBox[{ RowBox[{"(", RowBox[{ SuperscriptBox["x", "3"], "-", RowBox[{"2", SuperscriptBox["x", "2"]}], "+", RowBox[{"7", "x"}], "-", "5"}], ")"}], RowBox[{"\[DifferentialD]", "x"}]}]}], TraditionalForm]]], "\nObtener una cota del error cometido" }], "Text"], Cell[TextData[{ "2\.ba.- Calcular : ", Cell[BoxData[ FormBox[ RowBox[{ SubsuperscriptBox["\[Integral]", "2", "3"], RowBox[{ FractionBox["1", RowBox[{"5", "-", "x"}]], RowBox[{"\[DifferentialD]", "x"}]}]}], TraditionalForm]]], " con un error menor que ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["10", RowBox[{"-", "6"}]], " "}], TraditionalForm]]], "y utilizando la primera regla de Simpson. \[DownQuestion]Cuantas veces es \ necsario componer la f\[OAcute]rmula?" }], "Text"], Cell["1\.ba- Una vez h=0.5", "Text"], Cell["2\.ba.- Dos veces. h=0.25", "Text"], Cell["2\.ba.- Tres veces. h=0.3333", "Text"], Cell[TextData[{ "3\.ba.- Se dispone de los valores de la funci\[OAcute]n en abscisas \ igualmente espaciadas dados en la siguiente tabla :\n", Cell[BoxData[ TagBox[GridBox[{ {"\"\<\\!\\(x\\_i\\)\>\"", "0.`", "0.1`", "0.3`", "0.5`", "0.7`", "0.95`", "1.2`"}, {"\"\<\\!\\(y\\_i\\)\>\"", "10.`", "6.84`", "4.`", "4.2`", "5.51`", "5.77`", "1.`"} }, GridBoxAlignment->{ "Columns" -> {{Left}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[2.0999999999999996`]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], TableForm[#, TableHeadings -> {{"\!\(x\_i\)", "\!\(y\_i\)"}, None}]& ]]], "\n\nObtener el valor aproximado de ", Cell[BoxData[ FormBox[ RowBox[{ SubsuperscriptBox["\[Integral]", "0", "1.2"], RowBox[{ RowBox[{"f", "(", "x", ")"}], RowBox[{"\[DifferentialD]", "x"}], " "}]}], TraditionalForm]]], "utilizando una combinaci\[OAcute]n adecuada de la f\[OAcute]rmula del \ trapecio, y primera y segunda f\[OAcute]rmulas de Simpson. " }], "Text"], Cell[TextData[{ "4\.ba.- Se desea obtener ", Cell[BoxData[ FormBox[ RowBox[{ SubsuperscriptBox["\[Integral]", "0", "\[Pi]"], RowBox[{ FractionBox["1", RowBox[{ RowBox[{"sen", "(", "x", ")"}], "+", "1"}]], RowBox[{"\[DifferentialD]", "x"}]}]}], TraditionalForm]]], ". Calcular los valores aproximados dados por :\na) La primera \ f\[OAcute]rmula de Simpson con 9 nodos.\nb) La segunda f\[OAcute]rmula de \ Simpson con 4 nodos." }], "Text"] }, Open ]] }, Open ]] }, Open ]] }, WindowToolbars->"EditBar", WindowSize->{1672, 933}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, FrontEndVersion->"8.0 for Microsoft Windows (32-bit) (November 7, 2010)", StyleDefinitions->FrontEnd`FileName[{"Report"}, "StandardReport.nb", CharacterEncoding -> "WindowsANSI"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{ "S5.89.1"->{ Cell[3547, 94, 67, 1, 40, "Input", CellTags->"S5.89.1"], Cell[3617, 97, 370, 7, 21, "Message", CellTags->"S5.89.1"], Cell[4002, 107, 71, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4076, 110, 71, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4150, 113, 71, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4699, 137, 73, 1, 40, "Input", CellTags->"S5.89.1"], Cell[6153, 196, 73, 1, 40, "Input", CellTags->"S5.89.1"], Cell[7610, 255, 73, 1, 40, "Input", CellTags->"S5.89.1"]} } *) (*CellTagsIndex CellTagsIndex->{ {"S5.89.1", 12496, 424} } *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 193, 5, 59, "Title"], Cell[CellGroupData[{ Cell[785, 31, 105, 2, 73, "Section"], Cell[893, 35, 2072, 38, 242, "Text"], Cell[2968, 75, 500, 13, 112, "Text"], Cell[3471, 90, 51, 0, 29, "Text"], Cell[CellGroupData[{ Cell[3547, 94, 67, 1, 40, "Input", CellTags->"S5.89.1"], Cell[3617, 97, 370, 7, 21, "Message", CellTags->"S5.89.1"] }, Open ]], Cell[4002, 107, 71, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4076, 110, 71, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4150, 113, 71, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4224, 116, 146, 5, 40, "Input"], Cell[4373, 123, 51, 0, 29, "Text"], Cell[4427, 125, 248, 8, 56, "Input"], Cell[4678, 135, 18, 0, 29, "Text"], Cell[4699, 137, 73, 1, 40, "Input", CellTags->"S5.89.1"], Cell[4775, 140, 512, 17, 40, "Input"], Cell[5290, 159, 312, 10, 64, "Input"], Cell[5605, 171, 73, 2, 40, "Input"], Cell[5681, 175, 78, 2, 29, "Text"], Cell[5762, 179, 247, 8, 40, "Input"], Cell[6012, 189, 117, 3, 40, "Input"], Cell[6132, 194, 18, 0, 29, "Text"], Cell[6153, 196, 73, 1, 40, "Input", CellTags->"S5.89.1"], Cell[6229, 199, 512, 17, 40, "Input"], Cell[6744, 218, 312, 10, 64, "Input"], Cell[7059, 230, 75, 2, 40, "Input"], Cell[7137, 234, 77, 2, 29, "Text"], Cell[7217, 238, 249, 8, 40, "Input"], Cell[7469, 248, 117, 3, 40, "Input"], Cell[7589, 253, 18, 0, 29, "Text"], Cell[7610, 255, 73, 1, 40, "Input", CellTags->"S5.89.1"], Cell[7686, 258, 512, 17, 40, "Input"], Cell[8201, 277, 312, 10, 64, "Input"], Cell[8516, 289, 75, 2, 40, "Input"], Cell[8594, 293, 77, 2, 29, "Text"], Cell[8674, 297, 249, 8, 40, "Input"], Cell[8926, 307, 117, 3, 40, "Input"], Cell[CellGroupData[{ Cell[9068, 314, 32, 0, 24, "Subsection"], Cell[9103, 316, 543, 16, 65, "Text"], Cell[9649, 334, 534, 18, 39, "Text"], Cell[10186, 354, 36, 0, 29, "Text"], Cell[10225, 356, 41, 0, 29, "Text"], Cell[10269, 358, 44, 0, 29, "Text"], Cell[10316, 360, 1261, 31, 95, "Text"], Cell[11580, 393, 480, 14, 77, "Text"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)