(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.0' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 36654, 1018]*) (*NotebookOutlinePosition[ 37298, 1040]*) (* CellTagsIndexPosition[ 37254, 1036]*) (*WindowFrame->Normal*) Notebook[{ Cell[BoxData[ StyleBox[\(\( (*\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Numerik\ - \ Aufgabe\ \ 5\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ S\ S\ 2005\ \ \ *) \)\(\ \)\), "Subtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(\(Off[General::spell]\)\(\ \)\); \ \ \ \ \ \ Off[ General::spell1]\ \ ; \ \ \ \ \ Off[General::luc];\)], "Input"], Cell[BoxData[ \( (*\ \ \ \ \ \ Rechengenauigkeit\ gen\ \(festlegen\ \ !\)\ \ Voreingestellt\ ist\ gen\ = \ 16\ \ \ \ *) \)], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ RowBox[{ StyleBox["(*", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], RowBox[{ RowBox[{ RowBox[{ StyleBox["Rechengenauigkeit", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["vorgeben", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[ RowBox[{" ", StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]]}]], StyleBox["ipl", "Subsubtitle", FontColor->RGBColor[1, 0, 0]]}], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["=", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["1", "Subsubtitle", FontColor->RGBColor[1, 0, 0]]}], StyleBox[",", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["2", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[",", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["3", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[",", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[\(4\ \ oder\ 5\), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]}], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["*)", "Subsubtitle", FontColor->RGBColor[1, 0, 0]]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ StyleBox[\( (*\ \ \ ipl1, \ ipl2, \ ... , \ ipl5\ \ ist\ f\[UDoubleDot]r\ die\ \ Gesamtgraphik\ erforderlich, \ wenn\ das\ Programm\ \[IndentingNewLine]ipl\ = \ 1, \ 2, \ 3, \ 4\ , \ 5\ \ mal\ gelaufen\ ist, \ werden\ verschiedene\ Zahlen\ eingesetzt\ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[{ RowBox[{\(ipl = \ 1;\), " ", "\[IndentingNewLine]", RowBox[{ StyleBox["(*", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox[\(Nummern \(\(\ \)\(\ \)\) der\ \ auszugebenden\ Kurven\ festlegen\), "Subsubsection", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], StyleBox["*)", "Subsubtitle", FontColor->RGBColor[1, 0, 0]]}]}], "\n", \(If\ [\ ipl\ == \ 1, \ {\ ipl1\ = \ 1; \ ipl2\ = \ 1; \ \ ipl3\ = \ 1; \ \ ipl4\ = \ 1, ipl5\ = \ 1\ }];\), "\n", \(If\ [\ ipl\ == \ 2, \ {\ ipl1\ = \ 1; \ ipl2\ = \ 2; \ \ ipl3\ = \ 1; \ \ ipl4\ = \ 1, ipl5\ = \ 1\ }];\), "\n", \(If\ [\ ipl\ == \ 3, \ {\ ipl1\ = \ 1; \ ipl2\ = \ 2; \ \ ipl3\ = \ 3; \ \ ipl4\ = \ 1, ipl5\ = \ 1\ }];\), "\n", \(If\ [\ ipl\ == \ 4, \ {\ ipl1\ = \ 1; \ ipl2\ = \ 2; \ \ ipl3\ = \ 3; \ \ ipl4\ = \ 4, ipl5\ = \ 1\ }];\), "\n", \(If\ [\ ipl\ == \ 5, \ {\ ipl1\ = \ 1; \ ipl2\ = \ 2; \ \ ipl3\ = \ 3; \ \ ipl4\ = \ 4, ipl5\ = \ 5\ }];\)}], "Input"], Cell[BoxData[ RowBox[{" ", RowBox[{ RowBox[{ RowBox[{"listgen", "=", " ", RowBox[{"{", " ", RowBox[{"8", StyleBox[",", Background->None], StyleBox["12", Background->None], StyleBox[",", Background->None], StyleBox["16", Background->None], StyleBox[",", Background->None], "24", StyleBox[" ", Background->None], StyleBox[",", Background->None], "32"}], StyleBox["}", Background->None]}]}], StyleBox[";", Background->None]}], StyleBox[ RowBox[{ StyleBox[" ", Background->RGBColor[1, 1, 0]], " "}]], "\[IndentingNewLine]", " ", \($MaxPrecision = \(gen = \ listgen[\([ipl]\)]\);\), "\[IndentingNewLine]", " ", \($MinPrecision = gen;\)}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ StyleBox["(*", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], RowBox[{ StyleBox["Approximation", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], RowBox[{ StyleBox["(", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[\(Methode\ der\ kleinsten\ Quadrate\ nach\ Gau\[SZ]\), "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[ RowBox[{ StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section"]}]]}]}], StyleBox["*)", "Section", FontColor->RGBColor[1, 0, 0]]}], "\n", RowBox[{ StyleBox["(*", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], RowBox[{ StyleBox["Approximationsfunktionen", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], RowBox[{ StyleBox["(", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[\(Polynome\ vom\ Grade\ \ m\), "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[")", "Section", FontColor->RGBColor[1, 0, 0]]}]}], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox["*)", "Section", FontColor->RGBColor[1, 0, 0]]}], "\n", RowBox[{ StyleBox["(*", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], RowBox[{ StyleBox[\(f\[UDoubleDot]r\ n\), "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox["+", "Subsection", FontColor->RGBColor[1, 0, 0]], RowBox[{ StyleBox["1", "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox["vorgegene", "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox["Knotenpunkte", "Subsection", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox["mit", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox["Hilfe", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox["der", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox["Normalgleichungen", "Section", FontColor->RGBColor[1, 0, 0]]}]}], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0]], StyleBox["*)", "Section", FontColor->RGBColor[1, 0, 0]]}]}]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ StyleBox[\( (*\ \ \ \ \ \ \ Anzahl\ \ der\ \ St\[UDoubleDot]tzpunkte\ \ \ 0, \ \(\(.\)\(\ \)\(.\)\)\ , \ n\ \ \ \ angeben\ \ \ *) \), "Subsubsection", FontColor->RGBColor[1, 0, 1]]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ \(\(n = 20;\)\)], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ \ \ Funktion\ f\[UDoubleDot]r\ \ die\ \ St\[UDoubleDot]tzwerte\ \ definieren\ \ \ \ \ \ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[{ \(SeedRandom[1243]\), "\[IndentingNewLine]", \(f5[x_] := \(\(0.01 x\^5\)\(-\)\(0.525 x\^4\)\(+\)\(10.41 x\^3\)\(-\)\(96.47 x\^2\)\(+\)\(411.17 x\)\(-\)\(530.26\)\(+\)\(10* Random[]\)\(-\)\(5\)\(\ \)\)\)}], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ \ \ St\[UDoubleDot]tzstellen\ \ xp[ j]\ \ und\ \ St\[UDoubleDot]tzwerte\ \ yp[ j]\ , \ \ \ \ j\ = \ \ 0, \ \(\(.\)\(\ \)\(.\)\(\ \)\(.\)\)\ , n\ \ \ erzeugen\ \ \ \ \ \ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(Do[{xp[j] = SetPrecision[j, gen], \ yp[j] = f5[j]}, {j, 0, n}]\)], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ Graphische\ Darstellung\ der\ Knotenpunkte\ \ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[{ \(<< Graphics`Colors`\), "\n", \(\(liste1 = {Red, HotPink, Green, Apricot, Brown, DarkGreen, Cobalt, Brick, Orange, Magenta, IndianRed, ForestGreen, Red, HotPink, Green, Apricot, Brown, DarkGreen, Cobalt, Brick, Orange};\)\)}], "Input"], Cell[BoxData[ \(linienplot = ListPlot[Table[{xp[j], yp[j]}, {j, 0, n}], PlotJoined\ -> \ True, \t PlotRange -> {{0, 21}, {\(-210\), 210}}, \n\tPlotStyle -> Blue, AspectRatio -> 0.6, AxesLabel -> {"\<> x\>", "\< ^ y\>"}]\)], "Input"], Cell[BoxData[ \(punktplot = ListPlot[Table[{xp[j], yp[j]}, {j, 0, n}], PlotJoined\ -> \ False, \t PlotRange -> {{0, 21}, {\(-210\), 210}}, \n\tPlotStyle -> Blue, Prolog\ -> \ AbsolutePointSize[5], AspectRatio -> 0.6, AxesLabel -> {"\<> x\>", "\< ^ y\>"}]\)], "Input"], Cell[BoxData[ \(Show[linienplot, punktplot, Prolog\ -> \ AbsolutePointSize[5]]\)], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ \ Erstellen \(\(\ \)\(\ \)\) der\ \ St\[UDoubleDot]tzmatrizen\ \ A\ \ \ f\[UDoubleDot]r\ \ k = \ \ 1, \ \(\(.\)\(\ \)\(.\)\(\ \)\(.\)\)\ , \ m\ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(m\ = \ 20;\)\)], "Input"], Cell[BoxData[ \(\(\(Do[{A[j, 0] = SetPrecision[1, gen], Do[A[j, i] = SetPrecision[xp[j]^i, gen], {i, 1, m}]}, {j, 0, n}]\n \(Do[Amat[k]\ = \ Table[A[j, i], {j, 0, n}, {i, 0, k}], {k, 1, m}];\)\)\(\ \)\)\)], "Input"], Cell[BoxData[ RowBox[{ StyleBox["(*", "Subsubsection", FontColor->RGBColor[1, 0, 1]], " ", StyleBox[\(Amat[5]\ // \ MatrixForm\ \ , \(\(\ \)\(\ \)\) Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ \(\(Do[ATmat[k] = Transpose[Amat[k]], {k, 1, m}];\)\)], "Input"], Cell[BoxData[ RowBox[{" ", RowBox[{ StyleBox["(*", FontColor->RGBColor[1, 0, 1]], " ", StyleBox[\(ATmat[5]\ // \ MatrixForm\ , \ \ Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ StyleBox[\( (*\(\(\ \ \)\(\ \)\) Erstellen\ \ \ der\ \ rechten\ Seite\ \ y\ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(\(yvek = \ Table[SetPrecision[yp[j], gen], {j, 0, n}];\)\(\ \)\)\)], "Input"], Cell[BoxData[ RowBox[{ StyleBox["(*", FontColor->RGBColor[1, 0, 1]], StyleBox[ RowBox[{" ", StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]], StyleBox[\(yvek\ // \ MatrixForm\ \ \ , \(\(\ \)\(\ \)\) Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ StyleBox[\( (*\ \ \ Berechnen \(\(\ \)\(\ \)\) der\ \ Normalgleichungen\ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ StyleBox[\( (*\ \ \ Erstellen \(\(\ \)\(\ \)\) der\ \ Normalmatrix\ \ Nmat\ \ \ f\[UDoubleDot]r\ \ k = \ 1, \ \(\(.\)\(\ \)\(.\)\(\ \)\(.\)\)\ , \ m\ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(Do[Nmat[k]\ = \ SetPrecision[ATmat[k] . Amat[k], gen], {k, 1, m}]\)], "Input"], Cell[BoxData[ RowBox[{" ", RowBox[{ StyleBox["(*", FontColor->RGBColor[1, 0, 1]], " ", StyleBox[\(Nmat[5]\ // \ MatrixForm\ \ , \(\(\ \)\(\ \)\) Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ StyleBox[\( (*\(\(\ \ \)\(\ \)\) Erstellen \(\(\ \)\(\ \)\) der\ \ rechten\ Seite\ \ b\ \ \ f\[UDoubleDot]r\ \ k\ = \ 1, \ \(\(.\)\(\ \)\(.\)\(\ \)\(.\)\)\ , \ m\ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(Do[bvek[k]\ = SetPrecision[ATmat[k] . yvek, gen], {k, 1, m}]\)], "Input"], Cell[BoxData[ RowBox[{" ", RowBox[{ StyleBox["(*", FontColor->RGBColor[1, 0, 1]], " ", StyleBox[\(bvek[5]\ // \ MatrixForm\ \ \ \ , \(\(\ \)\(\ \)\) Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ StyleBox[\( (*\ \ \ \ L\[ODoubleDot]\ sen\ \ der\ \ Normalgleichungen\ \ mit\ \ Hilfe\ \ der\ \ internen\ \ Inversen\ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(Do[ Ninv[k] = SetPrecision[Inverse[Nmat[k]], gen], {k, 1, m}];\)\)], "Input"], Cell[BoxData[ RowBox[{" ", RowBox[{ StyleBox["(*", FontColor->RGBColor[1, 0, 0]], " ", StyleBox[\(Ninv[5]\ // \ MatrixForm\ , \ \ Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ \(Do[cvek[k] = SetPrecision[Ninv[k] . bvek[k], gen], {k, 1, m}]\)], "Input"], Cell[BoxData[ RowBox[{ StyleBox["(*", FontColor->RGBColor[1, 0, 0]], " ", StyleBox[\(cvek[9]\ // \ MatrixForm\ \ \ , \ \ \ Kontrollausgabe\), "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox[" ", "Subsubsection", FontColor->RGBColor[1, 0, 1]], StyleBox["*)", "Subsubsection", FontColor->RGBColor[1, 0, 1]]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ \(poly[kk_, xx_] := \[Sum]\+\(i = 1\)\%kk\( cvek[kk]\)[\([i + 1]\)]*xx^i + \(cvek[ kk]\)[\([1]\)]\)], "Input"], Cell[BoxData[ RowBox[{"Do", "[", RowBox[{ RowBox[{"{", RowBox[{\(Dquad[ipl, k] = \[Sum]\+\(j = 0\)\%n\((yp[j] - poly[k, xp[j]])\)^2\), ",", \(Print["\", k, "\<, Abweichungsquadrate: \>", ScientificForm[Dquad[ipl, k]], "\< Gauss\>"]\), ",", RowBox[{\(Kurv[k]\), "=", RowBox[{ StyleBox["Plot", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], "[", " ", \(poly[k, xx], {xx, 0, 21}, PlotRange -> {{0, 21}, {\(-210\), 210}}, AspectRatio \[Rule] 0.6, \[IndentingNewLine]PlotPoints \[Rule] 40, AxesLabel \[Rule] {\ "\<-> X\>", "\< ^ Y\>"}, \ PlotStyle \[Rule] liste1[\([k]\)]\), "]"}]}]}], "}"}], ",", \({k, 1, m}\)}], "]"}]], "Input"], Cell[BoxData[ \(Do[{Print["\", k, "\<, Abweichungsquadrate: \>", ScientificForm[Dquad[ipl, k]], "\< Gauss\>"], Show[Kurv[k], linienplot, punktplot, Prolog\ -> \ AbsolutePointSize[5]]}, {k, 1, 20}]\)], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ \ \ \ \ \ \ L\[ODoubleDot]\ sen\ \ der\ \ Normalgleichungen\ \ mit\ \ Hilfe\ \ der\ \ Cholesky - Zerlegung\ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ RowBox[{ StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]], StyleBox[\( (*\ \ \ \ \ \ Cholesky - Zerlegung\ der\ Matrix\ A\ = \ Nmat\ [l]\ \((\ verketteter\ Algorithmus\ )\)\ \ \ \ \ \ \ *) \), "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]], "\[IndentingNewLine]", StyleBox[ RowBox[{" ", StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]], " \ "}]], RowBox[{ StyleBox["(*", "Section", FontColor->RGBColor[1, 0, 0]], " ", StyleBox[\(f\[UDoubleDot]r\ l\ = \ 1, \ \(\(.\)\(\ \)\(.\)\(\ \)\(.\)\)\ , \ m\), "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]], StyleBox[ RowBox[{" ", StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]]}]], StyleBox["*)", "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]]}], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]]}]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ RowBox[{ StyleBox[\( (*\ \ \ \ \ \ \ \ \ \ \ Cholesky\ - \ Zerlegung\ \ der\ \ Matrix\ \ A\ \ = \ \ Nmat\ \ \ \((\ erste\ k - Schleife\ )\)\ \ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], "\n", RowBox[{ StyleBox["(*", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox[ RowBox[{ StyleBox[" ", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]], StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]]}]], RowBox[{ StyleBox[\(Vorw\[ADoubleDot]rtsrechnung\ \((\ erste\ i - Schleife\ \ \ )\)\), "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]], StyleBox[",", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox[ RowBox[{ StyleBox[" ", "Section", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None]}]], StyleBox[\(R\[UDoubleDot]ckw\[ADoubleDot]rtsrechnung\ \((\ zweite\ i - Schleife\ )\)\), "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None]}], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None], StyleBox["*)", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->None]}], StyleBox[" ", "Subsubtitle", FontColor->RGBColor[1, 0, 0], Background->RGBColor[0, 1, 0]]}]], "Input", Background->RGBColor[1, 1, 0]], Cell[BoxData[ RowBox[{"Do", "[", RowBox[{ RowBox[{"{", RowBox[{\(nl = l + 1\), ",", "\n", " \t", \(Do[ Do[\ Achol[i, j] = \(Nmat[l]\)[\([i, j]\)], {i, 1, nl}], {j, 1, nl}]\), ",", "\n", "\t\t", \(Do[{Do[{sumAjiAjk = SetPrecision[0. , gen], Do[sumAjiAjk = sumAjiAjk + Achol[j, i]*Achol[j, k], {j, 1, i - 1}], \n\t\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \tAchol[ i, k] = \((Achol[i, k] - sumAjiAjk)\)/ Achol[i, i]}, {i, 1, k - 1}], sumAjk2 = SetPrecision[0. , gen], \n\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Do[ sumAjk2 = sumAjk2 + Achol[j, k]*Achol[j, k], {j, 1, k - 1}], \[IndentingNewLine]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ AkkminsumAjk2 = SetPrecision[Achol[k, k] - sumAjk2, gen], Achol[k, k] = SetPrecision[Sqrt[AkkminsumAjk2], gen]}, \[IndentingNewLine]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ {k, 1, nl}]\), ",", "\t\t", "\n", "\t", \(Do[{sumAb = SetPrecision[0. , gen], zwb[i] = SetPrecision[\(bvek[l]\)[\([i]\)], gen], \ Do[sumAb = sumAb + Achol[j, i]*zwb[j], {j, 1, i - 1}], zwb[i] = SetPrecision[\((zwb[i] - sumAb)\)/Achol[i, i], gen]}, {i, 1, nl}]\), ",", "\n", "\t ", \(Do[{sumAX = SetPrecision[0. , gen], Do[sumAX = sumAX + Achol[i, j]*zwc[j], {j, i + 1, nl}], \n\t\ \ zwc[i] = SetPrecision[\((zwb[i] - sumAX)\)/Achol[i, i], gen]}, {i, nl, 1, \(-1\)}]\), " ", ",", " ", \(cvec[l] = Table[zwc[i], {i, 1, nl}]\), ",", "\[IndentingNewLine]", StyleBox[ RowBox[{" ", StyleBox[" ", Background->RGBColor[1, 1, 0]], StyleBox[" ", FontColor->RGBColor[1, 0, 0], Background->RGBColor[1, 1, 0]]}]], StyleBox[\( (*\ \ \(Print[\ "\", l, "\< \>", AkkminsumAjk2, "\< \>", Achol[nl, nl]]\)\(,\)\ \ *) \), FontColor->RGBColor[1, 0, 0], Background->RGBColor[1, 1, 0]], "\[IndentingNewLine]", " ", \(If[ AkkminsumAjk2\ \[LessEqual] \ 0, {\ Print["\< Die Matrix ist bei der Ordnung n = \>", nl, "\< nicht mehr positiv definit !!! \>"]}]\)}], "}"}], ",", " ", "\n", " ", \({l, 1, m}\)}], "]"}]], "Input"], Cell[BoxData[ \(\(\(\ \)\(polychol[kk_, xx_] := \[Sum]\+\(i = 1\)\%kk\( cvec[kk]\)[\([i + 1]\)]*xx^i + \(cvec[ kk]\)[\([1]\)]\)\)\)], "Input"], Cell[BoxData[ RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{"{", RowBox[{\(Dquadchol[ipl, k] = \[Sum]\+\(j = 0\)\%n\((yp[j] - polychol[k, xp[j]])\)^2\), ",", \(Print["\", k, "\<, Abweichungsquadrate: \>", ScientificForm[Dquadchol[ipl, k]], "\< Cholesky\>"]\), ",", RowBox[{\(Kurvchol[k]\), "=", RowBox[{ StyleBox["Plot", "Subsubtitle", FontColor->RGBColor[1, 0, 0]], "[", " ", \(polychol[k, xx], {xx, 0, 21}, PlotRange -> {{0, 21}, {\(-210\), 210}}, AspectRatio \[Rule] 0.6, \[IndentingNewLine]PlotPoints \[Rule] 40, AxesLabel \[Rule] {\ "\<-> X\>", "\< ^ Y\>"}, \ PlotStyle \[Rule] liste1[\([k]\)]\), "]"}]}]}], "}"}], ",", \({k, 1, m}\)}], "]"}], " "}]], "Input"], Cell[BoxData[ \(Do[{Print["\", k, "\<, Abweichungsquadrate: \>", ScientificForm[Dquadchol[ipl, k]], \ "\< Cholesky\>"], Show[Kurvchol[k], linienplot, punktplot, Prolog\ -> \ AbsolutePointSize[5]]}, {k, 1, m}]\)], "Input", AnimationDisplayTime->3.02875], Cell[BoxData[ StyleBox[\( (*\ \ Graphische\ Darstellung\ der\ Abweichungsquadrate\ \ y\ \ = \ log \((Dquad \((k)\))\)\ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(liste2 = {Red, HotPink, Green, DarkGreen, Cobalt, Blue, Brick, Brown, Orange, Magenta, Apricot, IndianRed, ForestGreen, };\)\)], "Input"], Cell[BoxData[{ \(Print["\< Logarithmus der Abweichungsquadrate bei Gau\ \[SZ]\>"]\), "\[IndentingNewLine]", \(quadlinien[ipl] = ListPlot[Table[{k, Log[10, Dquad[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ True, \tPlotRange -> {{0, 21}, {\(-1\), 11}}, \n\t PlotStyle \[Rule] liste2[\([2 ipl - 1]\)], AspectRatio -> 0.7, PlotLabel \[Rule] "\< \>", AxesLabel -> {"\<> k\>", "\< ^ y\>"}]\)}], "Input"], Cell[BoxData[{ \(\(Print["\< Logarithmus der Abweichungsquadrate bei \ Gau\[SZ]\>"];\)\), "\[IndentingNewLine]", \(\(quadpunkte[ipl] = ListPlot[Table[{k, Log[10, Dquad[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ False, \t PlotRange -> {{0, 21}, {\(-1\), 11}}, \n\t PlotStyle \[Rule] liste2[\([2 ipl - 1]\)], Prolog\ -> \ AbsolutePointSize[5], AspectRatio -> 0.7, PlotLabel \[Rule] "\< \>", AxesLabel -> {"\<> k\>", "\< ^ y\>"}];\)\)}], "Input"], Cell[BoxData[{ \(\(Print["\< Logarithmus der Abweichungsquadrate bei \ Cholesky\>"];\)\), "\[IndentingNewLine]", \(\(quadlinienchol[ipl] = ListPlot[Table[{k, Log[10, Dquadchol[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ True, \tPlotRange -> {{0, 21}, {\(-1\), 11}}, \n\t PlotStyle \[Rule] liste2[\([2*ipl]\)], AspectRatio -> 0.7, PlotLabel \[Rule] "\< \>", AxesLabel -> {"\<> k\>", "\< ^ y\>"}];\)\)}], "Input"], Cell[BoxData[ \(\(quadpunktechol[ipl] = ListPlot[Table[{k, Log[10, Dquadchol[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ False, \t PlotRange -> {{0, 21}, {\(-1\), 11}}, \n\t PlotStyle \[Rule] liste2[\([2 ipl]\)], Prolog\ -> \ AbsolutePointSize[5], AspectRatio -> 0.7, PlotLabel \[Rule] "\", AxesLabel -> {"\<> k\>", "\< ^ y\>"}];\)\)], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ \ Gesamtgraphik : \ wenn\ das\ Programm\ ipl\ = \ 1, \ 2, \ 3, \ 4, \ 5\ \ mal\ gelaufen\ ist, \ \[IndentingNewLine]\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ m\[UDoubleDot]ssen\ ipl1, ipl2, \ ... , ipl5\ \ verschiedene\ Zahlen\ enthalten\ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(Show[quadlinien[ipl1], quadpunkte[ipl1], quadlinienchol[ipl1], quadpunktechol[ipl1], quadlinien[ipl2], quadpunkte[ipl2], quadlinienchol[ipl2], quadpunktechol[ipl2], quadlinien[ipl3], quadpunkte[ipl3], quadlinienchol[ipl3], quadpunktechol[ipl3], quadlinien[ipl4], quadpunkte[ipl4], quadlinienchol[ipl4], quadpunktechol[ipl4], \[IndentingNewLine]quadlinien[ipl5], quadpunkte[ipl5], quadlinienchol[ipl5], quadpunktechol[ipl5], \[IndentingNewLine]Prolog\ -> \ AbsolutePointSize[5]];\)\)], "Input"], Cell[BoxData[ StyleBox[\( (*\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nur\ \ \ f\[UDoubleDot]r\ \ \ \ \ \ ipl\ \ = \ 5\ \ \ \ \ \ \(interessant\ \ \ !\)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ *) \), "Subsubtitle", FontColor->RGBColor[1, 0, 0]]], "Input", Background->RGBColor[0, 1, 0]], Cell[BoxData[ \(\(If[ ipl \[Equal] \ 5, {Print["\< Logarithmus der Abweichungsquadrate \ bei Gau\[SZ]\>"]; \[IndentingNewLine]quadlinien[ipl] = ListPlot[Table[{k, Log[10, Dquad[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ True, \t PlotRange -> {{0, 21}, {\(-21\), 7}}, \n\t PlotStyle \[Rule] liste2[\([2*ipl - 1]\)], AspectRatio -> 0.7, PlotLabel \[Rule] "\< \>", AxesLabel -> {"\<> k\>", "\< ^ y\>"}]}];\)\)], "Input"], Cell[BoxData[ \(\(If[ ipl \[Equal] \ 5, {Print["\< Logarithmus der Abweichungsquadrate \ bei Cholesky\>"]; quadpunkte[ipl] = ListPlot[Table[{k, Log[10, Dquad[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ False, PlotRange -> {{0, 21}, {\(-21\), 7}}, \[IndentingNewLine]PlotStyle \[Rule] liste2[\([2*ipl - 1]\)], Prolog\ -> \ AbsolutePointSize[5], AspectRatio -> 0.7, PlotLabel \[Rule] "\< \>", AxesLabel -> {"\<> k\>", "\< ^ y\>"}]}];\)\)], "Input"], Cell[BoxData[ \(\(If[ ipl \[Equal] \ 5, {Print["\< Logarithmus der Abweichungsquadrate \ bei Cholesky\>"]; \[IndentingNewLine]quadlinienchol[pil] = ListPlot[Table[{k, Log[10, Dquadchol[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ True, PlotRange -> {{0, 21}, {\(-21\), 7}}, \n PlotStyle \[Rule] liste2[\([2*ipl]\)], AspectRatio -> 0.7, PlotLabel \[Rule] "\< \>", AxesLabel -> {"\<> k\>", "\< ^ y\>"}]}];\)\)], "Input"], Cell[BoxData[ \(\(If[ipl \[Equal] \ 5, quadpunktechol[ipl] = ListPlot[Table[{k, Log[10, Dquadchol[ipl, k]]}, {k, 1, m}], PlotJoined\ -> \ False, \t PlotRange -> {{0, 21}, {\(-21\), 7}}, \n\t PlotStyle \[Rule] liste2[\([2*ipl]\)], Prolog\ -> \ AbsolutePointSize[5], AspectRatio -> 0.7, PlotLabel \[Rule] "\", AxesLabel -> {"\<> k\>", "\< ^ y\>"}]];\)\)], "Input"], Cell[BoxData[ \(\(If[ipl \[Equal] \ 5, Show[quadlinien[ipl5], quadpunkte[ipl5], quadlinienchol[ipl5], quadpunktechol[ipl5], Prolog\ -> \ AbsolutePointSize[5]]];\)\)], "Input"] }, FrontEndVersion->"5.0 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 685}}, WindowSize->{1014, 651}, WindowMargins->{{0, Automatic}, {Automatic, 0}} ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1754, 51, 323, 7, 59, "Input"], Cell[2080, 60, 141, 2, 30, "Input"], Cell[2224, 64, 171, 3, 46, "Input"], Cell[2398, 69, 2262, 73, 46, "Input"], Cell[4663, 144, 419, 8, 73, "Input"], Cell[5085, 154, 1398, 33, 150, "Input"], Cell[6486, 189, 1085, 31, 70, "Input"], Cell[7574, 222, 4313, 132, 97, "Input"], Cell[11890, 356, 263, 6, 45, "Input"], Cell[12156, 364, 44, 1, 30, "Input"], Cell[12203, 367, 235, 5, 49, "Input"], Cell[12441, 374, 275, 5, 50, "Input"], Cell[12719, 381, 350, 7, 49, "Input"], Cell[13072, 390, 104, 2, 30, "Input"], Cell[13179, 394, 200, 5, 49, "Input"], Cell[13382, 401, 293, 5, 70, "Input"], Cell[13678, 408, 262, 4, 50, "Input"], Cell[13943, 414, 307, 5, 50, "Input"], Cell[14253, 421, 103, 2, 30, "Input"], Cell[14359, 425, 300, 6, 49, "Input"], Cell[14662, 433, 48, 1, 30, "Input"], Cell[14713, 436, 244, 4, 50, "Input"], Cell[14960, 442, 496, 15, 46, "Input"], Cell[15459, 459, 82, 1, 30, "Input"], Cell[15544, 462, 493, 14, 46, "Input"], Cell[16040, 478, 216, 5, 49, "Input"], Cell[16259, 485, 108, 2, 30, "Input"], Cell[16370, 489, 601, 19, 46, "Input"], Cell[16974, 510, 213, 5, 49, "Input"], Cell[17190, 517, 299, 6, 49, "Input"], Cell[17492, 525, 108, 2, 30, "Input"], Cell[17603, 529, 516, 15, 46, "Input"], Cell[18122, 546, 313, 6, 49, "Input"], Cell[18438, 554, 103, 2, 30, "Input"], Cell[18544, 558, 520, 15, 46, "Input"], Cell[19067, 575, 247, 7, 49, "Input"], Cell[19317, 584, 118, 3, 30, "Input"], Cell[19438, 589, 489, 14, 46, "Input"], Cell[19930, 605, 103, 2, 30, "Input"], Cell[20036, 609, 450, 13, 46, "Input"], Cell[20489, 624, 149, 3, 51, "Input"], Cell[20641, 629, 953, 21, 114, "Input"], Cell[21597, 652, 289, 5, 50, "Input"], Cell[21889, 659, 264, 7, 49, "Input"], Cell[22156, 668, 1535, 42, 71, "Input"], Cell[23694, 712, 2411, 72, 66, "Input"], Cell[26108, 786, 2752, 54, 290, "Input"], Cell[28863, 842, 167, 3, 51, "Input"], Cell[29033, 847, 1079, 24, 114, "Input"], Cell[30115, 873, 334, 6, 50, "Input"], Cell[30452, 881, 233, 5, 49, "Input"], Cell[30688, 888, 170, 2, 30, "Input"], Cell[30861, 892, 465, 8, 70, "Input"], Cell[31329, 902, 544, 10, 70, "Input"], Cell[31876, 914, 488, 8, 90, "Input"], Cell[32367, 924, 454, 8, 90, "Input"], Cell[32824, 934, 439, 8, 73, "Input"], Cell[33266, 944, 590, 9, 110, "Input"], Cell[33859, 955, 388, 7, 49, "Input"], Cell[34250, 964, 543, 10, 70, "Input"], Cell[34796, 976, 608, 12, 90, "Input"], Cell[35407, 990, 528, 9, 90, "Input"], Cell[35938, 1001, 498, 9, 90, "Input"], Cell[36439, 1012, 211, 4, 30, "Input"] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)