(* 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[ 14619, 449] NotebookOptionsPosition[ 13197, 401] NotebookOutlinePosition[ 13587, 418] CellTagsIndexPosition[ 13544, 415] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["APROXIMACI\[CapitalOAcute]N NUM\[CapitalEAcute]RICA.", "Title", CellChangeTimes->{{3.506339900453125*^9, 3.50633990246875*^9}}, TextAlignment->Center, TextJustification->0, FontSize->18, Background->None], Cell[CellGroupData[{ Cell[" El comando Fit", "Section"], Cell[TextData[{ "El comando Fit permite obtener la funci\[OAcute]n de aproximaci\[OAcute]n \ que mejor se ajusta, seg\[UAcute]n el criterio de m\[IAcute]nimos cuadrados, \ y en el caso lineal, a un conjunto de datos. Dicha funci\[OAcute]n de \ aproximaci\[OAcute]n se calcula como combinaci\[OAcute]n lineal de un \ conjunto de funciones. Si dichas funciones son : { 1, x, ", Cell[BoxData[ FormBox[ RowBox[{ SuperscriptBox["x", "2"], ",", " ", "..", " "}], TraditionalForm]]], "}, el ajuste es de tipo polin\[OAcute]mico, pero se pueden utilizar tambi\ \[EAcute]n otro tipo de funciones como exponenciales, trigon\[OAcute]m\ \[EAcute]tricas, etc..\n \n La forma b\[AAcute]sica de este comando es la \ siguiente:\n Fit[datos, funciones, variables}\n \n Ejemplo : Calcular la \ recta y par\[AAcute]bola que mejor se ajustan al siguiente conjunto de datos \ que vienen dados en la siguiente tabla : ", Cell[BoxData[ TagBox[GridBox[{ {"\<\"\\!\\(x\\_i\\)\"\>", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, {"\<\"\\!\\(f\\_i\\)\"\>", "2", "3", "5", "7", "11", "13", "17", "19", "23", "29"} }, 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\)", "\!\(f\_i\)"}, None}]& ]]], "\n Representar gr\[AAcute]ficamente el conjunto de puntos junto con cada \ una de las dos aproximaciones obtenidas. Calcular los errores \ cuadr\[AAcute]ticos medios cometidos en cada ajuste." }], "Text"], Cell["\<\ 1\.ba.- C\[AAcute]lculo de la recta y la par\[AAcute]bola\ \>", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"datos", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", "7"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "11"}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", "13"}], "}"}], ",", RowBox[{"{", RowBox[{"7", ",", "17"}], "}"}], ",", RowBox[{"{", RowBox[{"8", ",", "19"}], "}"}], ",", RowBox[{"{", RowBox[{"9", ",", "23"}], "}"}], ",", RowBox[{"{", RowBox[{"10", ",", "29"}], "}"}]}], "}"}]}], ";"}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"p1", "[", "x_", "]"}], "=", RowBox[{"Fit", "[", RowBox[{"datos", ",", RowBox[{"{", RowBox[{"1", ",", "x"}], "}"}], ",", "x"}], "]"}]}], ";", RowBox[{ RowBox[{"p2", "[", "x_", "]"}], "=", RowBox[{"Fit", "[", RowBox[{"datos", ",", RowBox[{"{", RowBox[{"1", ",", "x", ",", RowBox[{"x", "^", "2"}]}], "}"}], ",", "x"}], "]"}]}], ";"}]], "Input"], Cell["2\.ba.- Gr\[AAcute]ficas", "Text"], Cell[BoxData[ RowBox[{"puntos", "=", RowBox[{"ListPlot", "[", RowBox[{"datos", ",", RowBox[{"PlotStyle", "->", RowBox[{"PointSize", "[", "0.02", "]"}]}], ",", RowBox[{"AxesOrigin", "\[Rule]", RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"recta", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"p1", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "10"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"RGBColor", "[", RowBox[{"1", ",", "0", ",", "0"}], "]"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"recta", ",", "puntos"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"parabola", "=", RowBox[{"Plot", "[", RowBox[{ RowBox[{"p2", "[", "x", "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "10"}], "}"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"RGBColor", "[", RowBox[{"1", ",", "0", ",", "0"}], "]"}]}]}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"parabola", ",", "puntos"}], "]"}]], "Input"], Cell["3\.ba.- Errores", "Text"], Cell[BoxData[ RowBox[{"e1", "=", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"i", "=", "1"}], "10"], SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"datos", "[", RowBox[{"[", RowBox[{"i", ",", "2"}], "]"}], "]"}], "-", RowBox[{"p1", "[", RowBox[{"datos", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ")"}], "2"]}]}]], "Input"], Cell[BoxData[ SqrtBox[ RowBox[{"e1", "/", "10"}]]], "Input"], Cell[BoxData[ RowBox[{"e2", "=", RowBox[{ UnderoverscriptBox["\[Sum]", RowBox[{"i", "=", "1"}], "10"], SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"datos", "[", RowBox[{"[", RowBox[{"i", ",", "2"}], "]"}], "]"}], "-", RowBox[{"p2", "[", RowBox[{"datos", "[", RowBox[{"[", RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ")"}], "2"]}]}]], "Input"], Cell[BoxData[ SqrtBox[ RowBox[{"e2", "/", "10"}]]], "Input"], Cell[CellGroupData[{ Cell["Ejercicios", "Subsection"], Cell[TextData[{ "1\.ba.- Hallar el polinomio que mejor se ajuste a los datos de la siguiente \ tabla utilizando la t\[EAcute]cnica de m\[IAcute]nimos cuadrados:\n", Cell[BoxData[ TagBox[GridBox[{ {"\<\"\\!\\(x\\_i\\)\"\>", "1", "2", "3", "4", "5", "6", "7"}, {"\<\"\\!\\(f\\_i\\)\"\>", "4", "7", "9", "10", "9", "7", "4"} }, 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\)", "\!\(f\_i\)"}, None}]& ]]] }], "Text"], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075657871354055`*^9}], Cell[TextData[{ "2\.ba.- Ajustar los datos de la tabla siguiente mediante una \ par\[AAcute]bola mediante la t\[EAcute]cnica de m\[IAcute]nimos cuadrados. \ Determinar el error m\[IAcute]nimo cuadr\[AAcute]tico.\n", Cell[BoxData[ TagBox[GridBox[{ {"\<\"\\!\\(x\\_i\\)\"\>", "0.`", "0.25`", "0.5`", "0.75`", "1.`"}, {"\<\"\\!\\(f\\_i\\)\"\>", "1.`", "1.284`", "1.6487`", "2.117`", "2.7183`"} }, 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\)", "\!\(f\_i\)"}, None}]& ]]] }], "Text"], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075657889791555`*^9}], Cell[TextData[{ "3\.ba.- Dada la tabla :\n", Cell[BoxData[ TagBox[GridBox[{ {"\<\"\\!\\(x\\_i\\)\"\>", "1.`", "1.25`", "1.5`", "1.75`", "2.`"}, {"\<\"\\!\\(f\\_i\\)\"\>", "5.1`", "5.79`", "6.53`", "7.45`", "8.46`"} }, 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\)", "\!\(f\_i\)"}, None}]& ]]], "\nutilizar la t\[EAcute]cnica de m\[IAcute]nimos cuadrados para obtener el \ mejor ajuste de estos valores. Realizar en primer lugar la representaci\ \[OAcute]n gr\[AAcute]fica de los puntos. A partir de la misma se observa que \ las funciones que mejor se pueden aproximar son:\na) Una recta\nb) Una \ exponencial.\n\tb1) Linealizando los datos.\n\tb2) Utilizando el comando Fit \ y la exponencial obtenida en el apdo anterior.\t\nCalcular los errores cuadr\ \[AAcute]ticos medios en ambos casos para decidir cu\[AAcute]l es el mejor \ ajuste." }], "Text", CellChangeTimes->{{3.5075657997604055`*^9, 3.5075658009791555`*^9}}, TextAlignment->Left, TextJustification->0], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075658034322805`*^9}], Cell[TextData[{ "4\.ba.- Cuando el crecimiento de una poblaci\[OAcute]n est\[AAcute] acotado \ por un valor constante L sigue una curva log\[IAcute]stica de la forma :\n\ y(x) = ", Cell[BoxData[ FormBox[ FractionBox["L", RowBox[{"1", "+", SuperscriptBox["Be", "Ax"]}]], TraditionalForm]]], " . Realizando el cambio de variable adecuado (L/y -1 = B ", Cell[BoxData[ FormBox[ SuperscriptBox["e", "Ax"], TraditionalForm]]], " ) encontrar la curva log\[IAcute]stica correspondiente a L = 800 millones, \ para los datos de la tabla :\n", Cell[BoxData[ TagBox[GridBox[{ {"\<\"A\[NTilde]o\"\>", "1850", "1900", "1950", "2000"}, {"\<\"\\!\\(x\\_i\\)\"\>", RowBox[{"-", "10"}], RowBox[{"-", "5"}], "0", "5"}, {"\<\"\\!\\(y\\_i\\)\"\>", "5.3`", "23.2`", "76.1`", "152.3`"} }, 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 -> {{"A\[NTilde]o", "\!\(x\_i\)", "\!\(y\_i\)"}, None}]& ]]], "\nEstimar la poblaci\[OAcute]n del a\[NTilde]o 2050." }], "Text", CellChangeTimes->{{3.506339795109375*^9, 3.506339826734375*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075658067135305`*^9}], Cell[TextData[{ "5\.ba.- Realizar un ajuste de la forma f(x) = A cos(x) + B sen(x) para los \ datos de la siguiente tabla:\n\n", Cell[BoxData[ TagBox[GridBox[{ { SubscriptBox["x", "k"], SubscriptBox["y", "k"]}, { RowBox[{"-", StyleBox["3.`", StyleBoxAutoDelete->True, PrintPrecision->2]}], RowBox[{"-", StyleBox["0.138500000000000023`", StyleBoxAutoDelete->True, PrintPrecision->4]}]}, { RowBox[{"-", StyleBox["1.5`", StyleBoxAutoDelete->True, PrintPrecision->2]}], RowBox[{"-", StyleBox["2.15870000000000006`", StyleBoxAutoDelete->True, PrintPrecision->5]}]}, {"0.`", StyleBox["0.833000000000000007`", StyleBoxAutoDelete->True, PrintPrecision->4]}, { StyleBox["1.5`", StyleBoxAutoDelete->True, PrintPrecision->2], StyleBox["2.27740000000000009`", StyleBoxAutoDelete->True, PrintPrecision->5]}, { StyleBox["3.`", StyleBoxAutoDelete->True, PrintPrecision->2], RowBox[{"-", StyleBox["0.511000000000000031`", StyleBoxAutoDelete->True, PrintPrecision->4]}]} }, 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[#]& ]]], "\nCalcular el error cometido y representar gr\[AAcute]ficamente los puntos \ dados y la funci\[OAcute]n de ajuste." }], "Text"], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5075658095729055`*^9}] }, Open ]] }, Open ]] }, Open ]] }, WindowToolbars->"EditBar", WindowSize->{1672, 933}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, Magnification->1.5, FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (February 18, 2009)", StyleDefinitions->"Report.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 216, 5, 71, "Title"], Cell[CellGroupData[{ Cell[808, 31, 34, 0, 98, "Section"], Cell[845, 33, 1835, 37, 310, "Text"], Cell[2683, 72, 81, 2, 38, "Text"], Cell[2767, 76, 737, 24, 74, "Input"], Cell[3507, 102, 446, 14, 46, "Input"], Cell[3956, 118, 40, 0, 38, "Text"], Cell[3999, 120, 296, 8, 46, "Input"], Cell[4298, 130, 325, 9, 46, "Input"], Cell[4626, 141, 89, 2, 46, "Input"], Cell[4718, 145, 328, 9, 46, "Input"], Cell[5049, 156, 92, 2, 46, "Input"], Cell[5144, 160, 31, 0, 38, "Text"], Cell[5178, 162, 436, 15, 84, "Input"], Cell[5617, 179, 63, 2, 53, "Input"], Cell[5683, 183, 436, 15, 84, "Input"], Cell[6122, 200, 63, 2, 53, "Input"], Cell[CellGroupData[{ Cell[6210, 206, 32, 0, 57, "Subsection"], Cell[6245, 208, 843, 19, 98, "Text"], Cell[7091, 229, 89, 1, 74, "Input"], Cell[7183, 232, 919, 21, 98, "Text"], Cell[8105, 255, 89, 1, 74, "Input"], Cell[8197, 258, 1400, 29, 259, "Text"], Cell[9600, 289, 89, 1, 74, "Input"], Cell[9692, 292, 1471, 37, 179, "Text"], Cell[11166, 331, 89, 1, 74, "Input"], Cell[11258, 334, 1807, 59, 205, "Text"], Cell[13068, 395, 89, 1, 74, "Input"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)