(* 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[ 88623, 2292] NotebookOptionsPosition[ 83324, 2131] NotebookOutlinePosition[ 83703, 2147] CellTagsIndexPosition[ 83660, 2144] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"SetDirectory", "[", "\"\\"", "]"}]], "Input", CellChangeTimes->{ 3.6354940287861185`*^9, 3.635494073534405*^9, {3.6354941121292562`*^9, 3.6354941152387953`*^9}, 3.6354974933777275`*^9, 3.6659828997287407`*^9, { 3.6660061986053753`*^9, 3.6660062185118065`*^9}, {3.666327481132902*^9, 3.6663274833729053`*^9}, {3.666507623165536*^9, 3.666507624931184*^9}, 3.667216880725457*^9, {3.6689310468092213`*^9, 3.6689310483692236`*^9}, { 3.669529150401106*^9, 3.6695291524010935`*^9}, {3.6695332057232366`*^9, 3.669533209683242*^9}, 3.728818994303891*^9}], Cell[BoxData["\<\"C:\\\\Users\\\\Marica\\\\Dropbox\\\\Kagrujevac\\\\\ Mathematica\"\>"], "Output", CellChangeTimes->{3.728834467342665*^9, 3.7288353951950893`*^9, 3.7289068626365595`*^9, 3.729193731324342*^9, 3.7292539446271963`*^9}] }, Open ]], Cell[BoxData[ RowBox[{"<<", "Eigenvalues.m"}]], "Input", CellChangeTimes->{{3.6672168170840826`*^9, 3.667216823787284*^9}, { 3.7288190010378246`*^9, 3.7288190101440506`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", "Esercizio"}]}]}]}]}]}]}], " ", "1"}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"A", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"5", ",", "6", ",", "10", ",", "12"}], "}"}], ",", RowBox[{"{", RowBox[{"7", ",", "8", ",", "14", ",", "16"}], "}"}], ",", RowBox[{"{", RowBox[{"15", ",", "18", ",", "20", ",", "24"}], "}"}], ",", RowBox[{"{", RowBox[{"21", ",", "24", ",", "28", ",", "32"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"%", "//", "MatrixForm"}], "\n", RowBox[{ RowBox[{"n", "=", "4"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"itmax", "=", "200"}], ";", RowBox[{"toll", "=", RowBox[{"2", " ", "$MachineEpsilon"}]}], ";"}], " "}]}], "Input", CellChangeTimes->{{3.729193528532745*^9, 3.7291935317764006`*^9}, 3.7291936350049996`*^9, {3.7291937596296434`*^9, 3.72919376104543*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"5", "6", "10", "12"}, {"7", "8", "14", "16"}, {"15", "18", "20", "24"}, {"21", "24", "28", "32"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{{3.7291937380703063`*^9, 3.7291937622005014`*^9}, 3.729194510315336*^9, 3.729253961054888*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", "Approximation"}]}]}], " ", "of", " ", "the", " ", "subdominant", " ", "eigenpair", " ", "by", " ", "Hotelling", " ", "Deflation"}]], "Input", CellChangeTimes->{{3.7288324870522375`*^9, 3.728832494937882*^9}, { 3.7288325876445293`*^9, 3.728832611463897*^9}, {3.7288340494033356`*^9, 3.7288340508000827`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"PowerMethod", "[", RowBox[{"A", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728819337043078*^9, 3.7288193428324795`*^9}, { 3.7288195724195585`*^9, 3.7288195769907*^9}, {3.728822542373357*^9, 3.72882254908121*^9}, {3.728824208554889*^9, 3.7288242358375196`*^9}, { 3.728834161708107*^9, 3.728834164760227*^9}, {3.7288343417876434`*^9, 3.7288343425416517`*^9}, {3.7289310147282906`*^9, 3.728931031682395*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"70.65660577509668`", ",", RowBox[{"{", RowBox[{ "0.3366707522687819`", ",", "0.45742710775633816`", ",", "0.7360096211178622`", ",", "1.`"}], "}"}], ",", "15"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.7292541230501966`*^9, 3.729254123147716*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam2", ",", "y", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethodImprove", "[", RowBox[{ RowBox[{"Transpose", "[", "A", "]"}], ",", "lam", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.728835055818223*^9, 3.728835056929206*^9}, 3.728835842664621*^9, {3.7289316612783213`*^9, 3.728931664584118*^9}}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)\[NoBreak] may contain significant numerical errors. \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/General/luc\\\", \ ButtonNote -> \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.729193777194399*^9, 3.729194516585046*^9, 3.729254422864296*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({\\(\\(-65.65660577509668`\\)\ \\), 7.`, 15.`, 21.`}\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 2 \ \[RightSkeleton]\\)\\), 25.919075750452386`}\\)\\), \\(\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)\\), \\(\\({0.`, 0.`, 0.`, 3.552713678800501`*^-15}\\)\\)}\ \\)\[NoBreak] may contain significant numerical errors. \\!\\(\\*ButtonBox[\\\ \"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.729193777194399*^9, 3.729194516585046*^9, 3.729254423435503*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({\\(\\(-65.65660577509668`\\)\ \\), 7.`, 15.`, 21.`}\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 2 \ \[RightSkeleton]\\)\\), 25.919075750452386`}\\)\\), \\(\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)\\), \\(\\({0.`, 0.`, 0.`, 3.552713678800501`*^-15}\\)\\)}\ \\)\[NoBreak] may contain significant numerical errors. \\!\\(\\*ButtonBox[\\\ \"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.729193777194399*^9, 3.729194516585046*^9, 3.7292544234685917`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"70.65660577509668`", ",", RowBox[{"{", RowBox[{ "0.5891738164703684`", ",", "0.6861406616345072`", ",", "0.8586778913041727`", ",", "1.`"}], "}"}], ",", "3"}], "}"}]], "Output", CellChangeTimes->{3.729194516659216*^9, 3.7292544234700985`*^9}] }, Open ]], Cell[BoxData[ RowBox[{"{", RowBox[{"70.65660577509668`", ",", RowBox[{"{", RowBox[{ "0.5891738164703684`", ",", "0.6861406616345072`", ",", "0.8586778913041727`", ",", "1.`"}], "}"}], ",", "3"}], "}"}]], "Input", CellChangeTimes->{{3.7291937825937366`*^9, 3.729193783982458*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"nor", "=", RowBox[{"y", ".", "x"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"nor", ">", "0"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{"x", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";"}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{ RowBox[{"-", "x"}], "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\n", RowBox[{ RowBox[{"T", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"x", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{"y", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A2", "=", RowBox[{"A", "-", RowBox[{"lam", " ", "T"}]}]}], ";"}], "\n", RowBox[{"A2", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.728834238724948*^9, 3.7288342395681915`*^9}, { 3.728834285404443*^9, 3.7288343639496293`*^9}, {3.728928866961447*^9, 3.7289289530384026`*^9}, 3.728933054184631*^9, 3.7291937978212748`*^9}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ { RowBox[{"-", "1.5363282165517775`"}], RowBox[{"-", "1.6120839755455991`"}], "0.47377807200479793`", "0.905942467522209`"}, { RowBox[{"-", "1.8807646381365348`"}], RowBox[{"-", "2.3423702043245793`"}], "1.056932878775907`", "0.9267493057658989`"}, {"0.7106671080071969`", "1.35891370128331`", RowBox[{"-", "0.8256611085445869`"}], RowBox[{"-", "0.25317027426228833`"}]}, {"1.5853993181638657`", "1.3901239586488536`", RowBox[{"-", "0.29536531997267446`"}], RowBox[{"-", "0.9522462456757239`"}]} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{ 3.7291938020194454`*^9, 3.729194521512124*^9, {3.7292544069361844`*^9, 3.729254429114393*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"PowerMethod", "[", RowBox[{"A2", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728819337043078*^9, 3.7288193428324795`*^9}, { 3.7288195724195585`*^9, 3.7288195769907*^9}, {3.728822542373357*^9, 3.72882254908121*^9}, {3.728824208554889*^9, 3.7288242358375196`*^9}, { 3.728834161708107*^9, 3.728834164760227*^9}, {3.7288343417876434`*^9, 3.7288343425416517`*^9}, {3.7289310147282906`*^9, 3.728931031682395*^9}, 3.728931806131711*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "4.896269035971499`"}], ",", RowBox[{"{", RowBox[{"0.7360096211178623`", ",", "1.`", ",", RowBox[{"-", "0.5050061284031732`"}], ",", RowBox[{"-", "0.686140661634508`"}]}], "}"}], ",", "23"}], "}"}]], "Output", CellChangeTimes->{3.7291945251718607`*^9, 3.7292544930317574`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "4.8962690359715`"}], ",", RowBox[{"{", RowBox[{"0.7360096211178624`", ",", "1.`", ",", RowBox[{"-", "0.5050061284031732`"}], ",", RowBox[{"-", "0.6861406616345082`"}]}], "}"}], ",", "21"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.7291938142720127`*^9, 3.729193814294097*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", "Approximation"}]}]}], " ", "of", " ", "the", " ", "next", " ", "least", " ", "dominant", " ", "eigenpair", " ", "by", " ", "HouseHolder", " ", "Deflation"}]], "Input", CellChangeTimes->{{3.7288327843009777`*^9, 3.7288328207636557`*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethod", "[", RowBox[{"A", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.7288241902161283`*^9, 3.7288242031846294`*^9}, { 3.728824239105164*^9, 3.728824240024612*^9}, 3.7288256800643606`*^9, { 3.728827747279608*^9, 3.7288277481619277`*^9}, 3.7288277953635*^9, { 3.728828162713482*^9, 3.728828182935279*^9}, 3.7288282323430004`*^9, { 3.728835147158221*^9, 3.7288351489239187`*^9}, {3.728924098188189*^9, 3.7289240995036893`*^9}, {3.728931655085847*^9, 3.728931658651363*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"0.05661183347431365`", ",", RowBox[{"{", RowBox[{"1.`", ",", RowBox[{"-", "0.8586778913041725`"}], ",", RowBox[{"-", "0.6861406616345072`"}], ",", "0.5891738164703685`"}], "}"}], ",", "15"}], "}"}]], "Output", CellChangeTimes->{3.729193845478179*^9, 3.7291945325294333`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam2", ",", "y", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethodImprove", "[", RowBox[{ RowBox[{"Transpose", "[", "A", "]"}], ",", "lam", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728835055818223*^9, 3.728835056929206*^9}, 3.728835842664621*^9, {3.7289316612783213`*^9, 3.728931664584118*^9}, 3.7289331501418915`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({4.943388166525686`, 7.`, \ 15.`, 21.`}\\)\\), \\(\\({6.`, 7.943388166525686`, 18.`, 24.`}\\)\\), \ \\(\\({10.`, 14.`, 19.943388166525686`, 28.`}\\)\\), \\(\\({12.`, 16.`, 24.`, \ 31.943388166525686`}\\)\\)}\\)\[NoBreak] may contain significant numerical \ errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7291938594908485`*^9, 3.7291945369251285`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({12.`, 16.`, 24.`, \ 31.943388166525686`}\\)\\), \\(\\({0.`, 0.6666666666666679`, \ \\(\\(-0.056611833474313755`\\)\\), 1.380509861228596`}\\)\\), \\(\\({0.`, \ 0.`, 5.995192650466015`, 8.14553570829744`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 8.881784197001252`*^-16}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7291938594908485`*^9, 3.729194536959244*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({12.`, 16.`, 24.`, \ 31.943388166525686`}\\)\\), \\(\\({0.`, 0.6666666666666679`, \ \\(\\(-0.056611833474313755`\\)\\), 1.380509861228596`}\\)\\), \\(\\({0.`, \ 0.`, 5.995192650466015`, 8.14553570829744`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 8.881784197001252`*^-16}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7291938594908485`*^9, 3.729194536991304*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({12.`, 16.`, 24.`, \ 31.943388166525686`}\\)\\), \\(\\({0.`, 0.6666666666666679`, \ \\(\\(-0.056611833474313755`\\)\\), 1.380509861228596`}\\)\\), \\(\\({0.`, \ 0.`, 5.995192650466015`, 8.14553570829744`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 8.881784197001252`*^-16}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7291938594908485`*^9, 3.7291945370194044`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"General", "::", "stop"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Further output of \ \[NoBreak]\\!\\(\\*StyleBox[\\(LinearSolve :: luc\\), \\\"MessageName\\\"]\\)\ \[NoBreak] will be suppressed during this calculation. \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/General/stop\\\", \ ButtonNote -> \\\"General::stop\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7291938594908485`*^9, 3.729194537040446*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"0.05661183347431379`", ",", RowBox[{"{", RowBox[{"1.`", ",", RowBox[{"-", "0.7360096211178621`"}], ",", RowBox[{"-", "0.4574271077563383`"}], ",", "0.33667075226878207`"}], "}"}], ",", "4"}], "}"}]], "Output", CellChangeTimes->{3.7291938596101484`*^9, 3.7291945370424414`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"nor", "=", RowBox[{"y", ".", "x"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"nor", ">", "0"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{"x", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";"}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{ RowBox[{"-", "x"}], "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\n", RowBox[{ RowBox[{"T", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"x", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{"y", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A2", "=", RowBox[{"A", "-", RowBox[{"lam", " ", "T"}]}]}], ";"}], "\n", RowBox[{"A2", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.728834238724948*^9, 3.7288342395681915`*^9}, { 3.728834285404443*^9, 3.7288343639496293`*^9}, {3.728928866961447*^9, 3.7289289530384026`*^9}, 3.72893316251581*^9, 3.7291938689745717`*^9}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"4.973597839061181`", "6.0194322444692725`", "10.012077064116761`", "11.991111164615207`"}, {"7.022670951880818`", "7.983313961295818`", "13.989629692051075`", "16.007632646424366`"}, {"15.018115596175141`", "17.98666674692281`", "19.991713435236324`", "24.006098991392083`"}, {"20.984444538076612`", "24.011448969636547`", "28.007115489957428`", "31.994762930932364`"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{3.729193872052765*^9, 3.7291945407272425`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "t", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethod", "[", RowBox[{"A2", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.7288241902161283`*^9, 3.7288242031846294`*^9}, { 3.728824239105164*^9, 3.728824240024612*^9}, 3.7288256800643606`*^9, { 3.728827747279608*^9, 3.7288277481619277`*^9}, 3.7288277953635*^9, { 3.728828162713482*^9, 3.728828182935279*^9}, 3.7288282323430004`*^9, 3.7288351169267945`*^9, {3.728931668892578*^9, 3.728931672379856*^9}}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({4.973597839061181`, \ 6.0194322444692725`, 10.012077064116761`, 11.991111164615207`}\\)\\), \ \\(\\({7.022670951880818`, 7.983313961295818`, 13.989629692051075`, \ 16.007632646424366`}\\)\\), \\(\\({15.018115596175141`, 17.98666674692281`, \ 19.991713435236324`, 24.006098991392083`}\\)\\), \\(\\({20.984444538076612`, \ 24.011448969636547`, 28.007115489957428`, 31.994762930932364`}\\)\\)}\\)\ \[NoBreak] may contain significant numerical errors. \\!\\(\\*ButtonBox[\\\"\ \[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.72919387798454*^9, 3.7291945467953873`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({20.984444538076612`, \ 24.011448969636547`, 28.007115489957428`, 31.994762930932364`}\\)\\), \ \\(\\({0.`, 0.802189187684327`, \\(\\(-0.05237670879379408`\\)\\), \ 1.108135345173821`}\\)\\), \\(\\({0.`, 0.`, 4.613326284941917`, \ 5.372592367476852`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 3.552713678800501`*^-15}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.72919387798454*^9, 3.7291945468294773`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({20.984444538076612`, \ 24.011448969636547`, 28.007115489957428`, 31.994762930932364`}\\)\\), \ \\(\\({0.`, 0.802189187684327`, \\(\\(-0.05237670879379408`\\)\\), \ 1.108135345173821`}\\)\\), \\(\\({0.`, 0.`, 4.613326284941917`, \ 5.372592367476852`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 3.552713678800501`*^-15}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.72919387798454*^9, 3.7291945468605604`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({20.984444538076612`, \ 24.011448969636547`, 28.007115489957428`, 31.994762930932364`}\\)\\), \ \\(\\({0.`, 0.802189187684327`, \\(\\(-0.05237670879379408`\\)\\), \ 1.108135345173821`}\\)\\), \\(\\({0.`, 0.`, 4.613326284941917`, \ 5.372592367476852`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 3.552713678800501`*^-15}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.72919387798454*^9, 3.729194546892662*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"General", "::", "stop"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Further output of \ \[NoBreak]\\!\\(\\*StyleBox[\\(LinearSolve :: luc\\), \\\"MessageName\\\"]\\)\ \[NoBreak] will be suppressed during this calculation. \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/General/stop\\\", \ ButtonNote -> \\\"General::stop\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.72919387798454*^9, 3.729194546908687*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"9.76193473407968`*^-16", ",", RowBox[{"{", RowBox[{"1.`", ",", RowBox[{"-", "0.8586778913041726`"}], ",", RowBox[{"-", "0.6861406616345102`"}], ",", "0.589173816470371`"}], "}"}], ",", "4"}], "}"}]], "Output", CellChangeTimes->{3.729193878104863*^9, 3.729194546910693*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", "Esercizio"}]}]}]}]}]}]}], " ", "2"}]], "Input", CellChangeTimes->{{3.7289241684641485`*^9, 3.728924174874202*^9}, { 3.7291933253093214`*^9, 3.729193325825695*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"A", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"4", ",", "3", ",", "2", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "4", ",", "3", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "3", ",", "4", ",", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3", ",", "4"}], "}"}]}], "}"}]}], ";"}], "\n", RowBox[{"%", "//", "MatrixForm"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"n", "=", "4"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"itmax", "=", "200"}], ";", RowBox[{"toll", "=", RowBox[{"2", " ", "$MachineEpsilon"}]}], ";"}], " "}]}], "Input", CellChangeTimes->{{3.7288192178763666`*^9, 3.7288192973574996`*^9}, { 3.7291939868100567`*^9, 3.7291940141748567`*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"4", "3", "2", "1"}, {"3", "4", "3", "2"}, {"2", "3", "4", "3"}, {"1", "2", "3", "4"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{ 3.7288344716942677`*^9, 3.7288354023371058`*^9, 3.7289068878606553`*^9, { 3.7291939768445597`*^9, 3.729194016558226*^9}}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", "Approximation"}]}]}], " ", "of", " ", "the", " ", "subdominant", " ", "eigenpair", " ", "by", " ", "Hotelling", " ", "Deflation"}]], "Input", CellChangeTimes->{{3.7288324870522375`*^9, 3.728832494937882*^9}, { 3.7288325876445293`*^9, 3.728832611463897*^9}, {3.7288340494033356`*^9, 3.7288340508000827`*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"PowerMethod", "[", RowBox[{"A", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728819337043078*^9, 3.7288193428324795`*^9}, { 3.7288195724195585`*^9, 3.7288195769907*^9}, {3.728822542373357*^9, 3.72882254908121*^9}, {3.728824208554889*^9, 3.7288242358375196`*^9}, { 3.728834161708107*^9, 3.728834164760227*^9}, {3.7288343417876434`*^9, 3.7288343425416517`*^9}, {3.7289310147282906`*^9, 3.728931031682395*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"11.099019513592788`", ",", RowBox[{"{", RowBox[{ "0.8198039027185572`", ",", "1.0000000000000002`", ",", "1.`", ",", "0.8198039027185569`"}], "}"}], ",", "29"}], "}"}]], "Output", CellChangeTimes->{{3.728906878704328*^9, 3.72890689165077*^9}, 3.7289223440610137`*^9, 3.7289227010192842`*^9, 3.728922876596382*^9, 3.728923123623565*^9, 3.7291940214923573`*^9}] }, Open ]], Cell[BoxData[ RowBox[{"{", RowBox[{"11.099019513592783`", ",", RowBox[{"{", RowBox[{ "0.8198039027185569`", ",", "1.0000000000000002`", ",", "1.`", ",", "0.8198039027185571`"}], "}"}], ",", "30"}], "}"}]], "Input", CellChangeTimes->{{3.728906695335063*^9, 3.728906695643857*^9}, 3.7289227034507513`*^9, {3.72892290275397*^9, 3.728922903994297*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"-", " ", "Symmetric"}]}], " ", RowBox[{"Matrix", ":", " ", RowBox[{ "left", " ", "and", " ", "right", " ", "eigenvectors", " ", "coalesce"}]}]}]], "Input", CellChangeTimes->{{3.7289224450877542`*^9, 3.7289224494162965`*^9}, { 3.728923134565673*^9, 3.7289231711019*^9}, {3.728923204500235*^9, 3.7289232055550585`*^9}, {3.7289243182335896`*^9, 3.728924318580539*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"nor", "=", RowBox[{"Sqrt", "[", RowBox[{"x", ".", "x"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"x", "=", RowBox[{"x", "/", "nor"}]}], ";"}], "\n", RowBox[{ RowBox[{"T", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"x", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{"x", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A2", "=", RowBox[{"A", "-", RowBox[{"lam", " ", "T"}]}]}], ";"}], "\n", RowBox[{"A2", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.728834238724948*^9, 3.7288342395681915`*^9}, { 3.728834285404443*^9, 3.7288343639496293`*^9}, 3.728922462019801*^9, 3.7289228530387096`*^9, {3.728922992389433*^9, 3.728923000377698*^9}, { 3.7289230512309732`*^9, 3.7289230628027906`*^9}, {3.728923225062662*^9, 3.7289232277036896`*^9}, 3.729194036887279*^9}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"1.769419324309078`", "0.27912898646361706`", RowBox[{"-", "0.720871013536382`"}], RowBox[{"-", "1.2305806756909212`"}]}, {"0.27912898646361706`", "0.6810709188945254`", RowBox[{"-", "0.31892908110547413`"}], RowBox[{"-", "0.7208710135363812`"}]}, { RowBox[{"-", "0.720871013536382`"}], RowBox[{"-", "0.31892908110547413`"}], "0.6810709188945263`", "0.2791289864636193`"}, { RowBox[{"-", "1.2305806756909212`"}], RowBox[{"-", "0.7208710135363812`"}], "0.2791289864636193`", "1.7694193243090797`"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{3.728834553228183*^9, 3.7289069526350946`*^9, 3.728922473279786*^9, 3.728922750222196*^9, 3.7289229590748043`*^9, 3.7289232344907455`*^9, 3.7291940411415987`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam2", ",", "x2", ",", "k"}], "}"}], "=", RowBox[{"PowerMethod", "[", RowBox[{"A2", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728819337043078*^9, 3.7288193428324795`*^9}, { 3.7288195724195585`*^9, 3.7288195769907*^9}, {3.728822542373357*^9, 3.72882254908121*^9}, {3.728824208554889*^9, 3.7288242358375196`*^9}, { 3.728834161708107*^9, 3.728834164760227*^9}, 3.7288342755947104`*^9, { 3.728834436172742*^9, 3.7288344606839523`*^9}, {3.728931024656677*^9, 3.7289310285009065`*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"3.4142135623730954`", ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.9999999999999992`"}], ",", RowBox[{"-", "0.4142135623730943`"}], ",", "0.4142135623730953`", ",", "0.9999999999999999`"}], "}"}], ",", "29"}], "}"}]], "Output", CellChangeTimes->{3.729194054398919*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"3.4142135623730945`", ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.9999999999999994`"}], ",", RowBox[{"-", "0.4142135623730946`"}], ",", "0.4142135623730951`", ",", "1.`"}], "}"}], ",", "29"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.7289232641566668`*^9, 3.7289232641777463`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", "Approximation"}]}]}], " ", "of", " ", "the", " ", "next", " ", "least", " ", "dominant", " ", "eigenpair", " ", "by", " ", "Hotelling", " ", "Deflation", " "}]], "Input", CellChangeTimes->{{3.7288327843009777`*^9, 3.7288328207636557`*^9}, { 3.7289311039506545`*^9, 3.7289311348979588`*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethod", "[", RowBox[{"A", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.7288241902161283`*^9, 3.7288242031846294`*^9}, { 3.728824239105164*^9, 3.728824240024612*^9}, 3.7288256800643606`*^9, { 3.728827747279608*^9, 3.7288277481619277`*^9}, 3.7288277953635*^9, { 3.728828162713482*^9, 3.728828182935279*^9}, 3.7288282323430004`*^9, { 3.728835147158221*^9, 3.7288351489239187`*^9}, {3.728924098188189*^9, 3.7289240995036893`*^9}, {3.7289310404617243`*^9, 3.7289310440332527`*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"0.5857864376269049`", ",", RowBox[{"{", RowBox[{"0.4142135623730965`", ",", RowBox[{"-", "1.0000000000000016`"}], ",", "1.`", ",", RowBox[{"-", "0.4142135623730947`"}]}], "}"}], ",", "77"}], "}"}]], "Output", CellChangeTimes->{3.7289244927889705`*^9, 3.7289265985781918`*^9, 3.72892691614318*^9, 3.7289271894012737`*^9, 3.7289273151849866`*^9, 3.7289274016088033`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"0.5857864376269044`", ",", RowBox[{"{", RowBox[{"0.41421356237309775`", ",", RowBox[{"-", "1.000000000000003`"}], ",", "1.`", ",", RowBox[{"-", "0.4142135623730939`"}]}], "}"}], ",", "78"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.7289241030200443`*^9, 3.7289241030421257`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"-", " ", "Symmetric"}]}], " ", RowBox[{"Matrix", ":", " ", RowBox[{ "left", " ", "and", " ", "right", " ", "eigenvectors", " ", "coalesce"}]}]}]], "Input", CellChangeTimes->{{3.7289224450877542`*^9, 3.7289224494162965`*^9}, { 3.728923134565673*^9, 3.7289231711019*^9}, {3.728923204500235*^9, 3.7289232055550585`*^9}, {3.728924312244684*^9, 3.7289243126547475`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"nor", "=", RowBox[{"Sqrt", "[", RowBox[{"x", ".", "x"}], "]"}]}], ";"}], "\n", RowBox[{ RowBox[{"x", "=", RowBox[{"x", "/", "nor"}]}], ";"}]}], "Input", CellChangeTimes->{{3.728834238724948*^9, 3.7288342395681915`*^9}, { 3.728834285404443*^9, 3.7288343639496293`*^9}, {3.728924229604824*^9, 3.72892425152414*^9}, 3.728926594915448*^9, {3.728926869889577*^9, 3.728926898149313*^9}, {3.7289282364917336`*^9, 3.728928249139347*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"T", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"x", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{"y", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A2", "=", RowBox[{"A", "-", RowBox[{"lam", " ", "T"}]}]}], ";"}], "\n", RowBox[{"A2", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.7288343984774585`*^9, 3.7288344229967165`*^9}, { 3.728834535358612*^9, 3.728834552444067*^9}, {3.7289242389757547`*^9, 3.728924241337044*^9}, {3.7289269017629185`*^9, 3.7289269022842884`*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"3.957106781186547`", "3.1035533905932744`", "1.896446609406726`", "1.0428932188134525`"}, {"3.1035533905932744`", "3.7499999999999996`", "3.25`", "1.8964466094067267`"}, {"1.896446609406726`", "3.25`", "3.750000000000001`", "3.103553390593273`"}, {"1.0428932188134525`", "1.8964466094067267`", "3.103553390593273`", "3.957106781186548`"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{3.728835160220972*^9, 3.7288354329735966`*^9, 3.728835869535359*^9, 3.7289242576143217`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "t", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethod", "[", RowBox[{"A2", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.7288241902161283`*^9, 3.7288242031846294`*^9}, { 3.728824239105164*^9, 3.728824240024612*^9}, 3.7288256800643606`*^9, { 3.728827747279608*^9, 3.7288277481619277`*^9}, 3.7288277953635*^9, { 3.728828162713482*^9, 3.728828182935279*^9}, 3.7288282323430004`*^9, 3.7288351169267945`*^9, {3.7289245490055265`*^9, 3.7289245640355387`*^9}, { 3.728931053724019*^9, 3.728931057328621*^9}}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.957106781186547`, \ 3.1035533905932744`, 1.896446609406726`, 1.0428932188134525`}\\)\\), \ \\(\\({3.1035533905932744`, 3.7499999999999996`, 3.25`, \ 1.8964466094067267`}\\)\\), \\(\\({\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)}\\)\\), \\(\\({1.0428932188134525`, 1.8964466094067267`, \ 3.103553390593273`, 3.957106781186548`}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7288351671855063`*^9, 3.7288353189903564`*^9, 3.728835437700198*^9, 3.7288358742729955`*^9, 3.7289242707362304`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.957106781186547`, \ 3.1035533905932744`, 1.896446609406726`, 1.0428932188134525`}\\)\\), \ \\(\\({0.`, 1.762619539941119`, 2.841126436256582`, \ 2.6037459761976995`}\\)\\), \\(\\({0.`, 0.`, 0.8653251852258406`, \ 2.08907979803524`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 2.3314683517128287`*^-15}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7288351671855063`*^9, 3.7288353189903564`*^9, 3.728835437700198*^9, 3.7288358742729955`*^9, 3.7289242707522917`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.957106781186547`, \ 3.1035533905932744`, 1.896446609406726`, 1.0428932188134525`}\\)\\), \ \\(\\({0.`, 1.762619539941119`, 2.841126436256582`, \ 2.6037459761976995`}\\)\\), \\(\\({0.`, 0.`, 0.8653251852258406`, \ 2.08907979803524`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 2.3314683517128287`*^-15}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7288351671855063`*^9, 3.7288353189903564`*^9, 3.728835437700198*^9, 3.7288358742729955`*^9, 3.728924270754278*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.957106781186547`, \ 3.1035533905932744`, 1.896446609406726`, 1.0428932188134525`}\\)\\), \ \\(\\({0.`, 1.762619539941119`, 2.841126436256582`, \ 2.6037459761976995`}\\)\\), \\(\\({0.`, 0.`, 0.8653251852258406`, \ 2.08907979803524`}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 2.3314683517128287`*^-15}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7288351671855063`*^9, 3.7288353189903564`*^9, 3.728835437700198*^9, 3.7288358742729955`*^9, 3.728924270756283*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"General", "::", "stop"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Further output of \ \[NoBreak]\\!\\(\\*StyleBox[\\(LinearSolve :: luc\\), \\\"MessageName\\\"]\\)\ \[NoBreak] will be suppressed during this calculation. \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/General/stop\\\", \ ButtonNote -> \\\"General::stop\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7288351671855063`*^9, 3.7288353189903564`*^9, 3.728835437700198*^9, 3.7288358742729955`*^9, 3.728924270757305*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"4.121492704044899`*^-16", ",", RowBox[{"{", RowBox[{"0.4142135623730968`", ",", RowBox[{"-", "1.000000000000002`"}], ",", "1.`", ",", RowBox[{"-", "0.41421356237309426`"}]}], "}"}], ",", "5"}], "}"}]], "Output", CellChangeTimes->{3.728835167300823*^9, 3.7288353191026545`*^9, 3.7288354378034444`*^9, 3.7288358744073467`*^9, 3.7289242707592907`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", RowBox[{"--", "Esercizio"}]}]}]}]}]}]}]}]}], " ", "3"}]], "Input", CellChangeTimes->{{3.728924150656789*^9, 3.7289241837377987`*^9}, { 3.7291933314877577`*^9, 3.7291933320793324`*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"A", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"944", "/", "281"}], ",", RowBox[{"5664", "/", "263"}], ",", RowBox[{ RowBox[{"-", "4349"}], "/", "367"}], ",", RowBox[{ RowBox[{"-", "5920"}], "/", "119"}], ",", RowBox[{ RowBox[{"-", " ", "3196"}], "/", "661"}]}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0", ",", "0", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1", ",", "0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "0", ",", "0", ",", "1", ",", "0"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"%", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.7288192178763666`*^9, 3.7288192973574996`*^9}, { 3.7289312486616116`*^9, 3.7289314532749767`*^9}, {3.7289321661731777`*^9, 3.728932223254033*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ { FractionBox["944", "281"], FractionBox["5664", "263"], RowBox[{"-", FractionBox["4349", "367"]}], RowBox[{"-", FractionBox["5920", "119"]}], RowBox[{"-", FractionBox["3196", "661"]}]}, {"1", "0", "0", "0", "0"}, {"0", "1", "0", "0", "0"}, {"0", "0", "1", "0", "0"}, {"0", "0", "0", "1", "0"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{{3.728931398779008*^9, 3.728931414246127*^9}, 3.728931454676687*^9, 3.7289315120683765`*^9, 3.728932229316161*^9}] }, Open ]], Cell[BoxData[{ RowBox[{ RowBox[{"n", "=", "5"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"itmax", "=", "200"}], ";", RowBox[{"toll", "=", RowBox[{"2", " ", "$MachineEpsilon"}]}], ";"}], " "}]}], "Input", CellChangeTimes->{{3.728819346357831*^9, 3.7288194902699924`*^9}, { 3.7288195561713395`*^9, 3.7288195662471457`*^9}, {3.728819632262392*^9, 3.7288196408659945`*^9}, {3.7288202055482817`*^9, 3.728820209228072*^9}, { 3.7288207977978535`*^9, 3.728820809477954*^9}, {3.728821579888439*^9, 3.7288216346782*^9}, {3.728822360750187*^9, 3.7288223674189215`*^9}, { 3.7288224070372944`*^9, 3.728822407524591*^9}, 3.7288242321867604`*^9, 3.7288245948977013`*^9, {3.728931523116761*^9, 3.7289315236772795`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", "Approximation"}]}]}], " ", "of", " ", "the", " ", "subdominant", " ", "eigenpair", " ", "by", " ", "Hotelling", " ", "Deflation"}]], "Input", CellChangeTimes->{{3.7288324870522375`*^9, 3.728832494937882*^9}, { 3.7288325876445293`*^9, 3.728832611463897*^9}, {3.7288340494033356`*^9, 3.7288340508000827`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"PowerMethod", "[", RowBox[{"A", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728819337043078*^9, 3.7288193428324795`*^9}, { 3.7288195724195585`*^9, 3.7288195769907*^9}, {3.728822542373357*^9, 3.72882254908121*^9}, {3.728824208554889*^9, 3.7288242358375196`*^9}, { 3.728834161708107*^9, 3.728834164760227*^9}, {3.7288343417876434`*^9, 3.7288343425416517`*^9}, {3.7289310147282906`*^9, 3.728931031682395*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"6.2831852957963195`", ",", RowBox[{"{", RowBox[{ "1.`", ",", "0.15915494338023684`", ",", "0.025330296002366387`", ",", "0.004031441826061264`", ",", "0.0006416238955674984`"}], "}"}], ",", "50"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.728932965995013*^9, 3.7289329660190706`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam2", ",", "y", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethodImprove", "[", RowBox[{ RowBox[{"Transpose", "[", "A", "]"}], ",", "lam", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.728835055818223*^9, 3.728835056929206*^9}, 3.728835842664621*^9, {3.7289316612783213`*^9, 3.728931664584118*^9}}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({\\(\\(-2.923754690814113`\\)\ \\), 1.`, 0.`, 0.`, 0.`}\\)\\), \\(\\({21.5361216730038`, \ \\(\\(-6.2831852957963195`\\)\\), 1.`, 0.`, 0.`}\\)\\), \ \\(\\({\\(\\(-11.850136239782016`\\)\\), 0.`, \\(\\(-\\(\\(\[LeftSkeleton] 19 \ \[RightSkeleton]\\)\\)\\)\\), 1.`, 0.`}\\)\\), \ \\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, \\(\\(-6.2831852957963195`\ \\)\\), 1.`}\\)\\), \\(\\({\\(\\(-4.835098335854766`\\)\\), 0.`, 0.`, 0.`, \ \\(\\(-6.2831852957963195`\\)\\)}\\)\\)}\\)\[NoBreak] may contain significant \ numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728931752772775*^9, 3.728932279171795*^9, 3.728933033877587*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \ \[NoBreak]\\!\\({\\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, \ \\(\\(-6.2831852957963195`\\)\\), 1.`}\\)\\), \\(\\({0.`, \ \\(\\(-6.2831852957963195`\\)\\), 1.`, \\(\\(-2.7200232634951775`\\)\\), \ 0.43290514849450207`}\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 3 \ \[RightSkeleton]\\)\\), \\(\\(-\\(\\(\[LeftSkeleton] 20 \ \[RightSkeleton]\\)\\)\\)\\)}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 0.6106754110373409`, \\(\\(-6.380377306263671`\\)\\)}\\)\\), \\(\\({0.`, 0.`, \ 0.`, 0.`, \\(\\(-1.0495077029659683`*^-15\\)\\)}\\)\\)}\\)\[NoBreak] may \ contain significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\ \\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728931752772775*^9, 3.728932279171795*^9, 3.728933033909684*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \ \[NoBreak]\\!\\({\\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, \ \\(\\(-6.2831852957963195`\\)\\), 1.`}\\)\\), \\(\\({0.`, \ \\(\\(-6.2831852957963195`\\)\\), 1.`, \\(\\(-2.7200232634951775`\\)\\), \ 0.43290514849450207`}\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 3 \ \[RightSkeleton]\\)\\), \\(\\(-\\(\\(\[LeftSkeleton] 20 \ \[RightSkeleton]\\)\\)\\)\\)}\\)\\), \\(\\({0.`, 0.`, 0.`, \ 0.6106754110373409`, \\(\\(-6.380377306263671`\\)\\)}\\)\\), \\(\\({0.`, 0.`, \ 0.`, 0.`, \\(\\(-1.0495077029659683`*^-15\\)\\)}\\)\\)}\\)\[NoBreak] may \ contain significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\ \\\", ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728931752772775*^9, 3.728932279171795*^9, 3.7289330339397697`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{"6.28318529579632`", ",", RowBox[{"{", RowBox[{ RowBox[{"-", "0.12437658497187688`"}], ",", RowBox[{"-", "0.36364662373896534`"}], ",", "0.3937301480843929`", ",", "1.`", ",", "0.09571148879202422`"}], "}"}], ",", "3"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.728933038401621*^9, 3.728933038420704*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"nor", "=", RowBox[{"y", ".", "x"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"nor", ">", "0"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{"x", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";"}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{ RowBox[{"-", "x"}], "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "Input", CellChangeTimes->{{3.728834238724948*^9, 3.7288342395681915`*^9}, { 3.728834285404443*^9, 3.7288343639496293`*^9}, {3.728928866961447*^9, 3.7289289530384026`*^9}, 3.728933054184631*^9}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"T", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"x", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{"y", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A2", "=", RowBox[{"A", "-", RowBox[{"lam", " ", "T"}]}]}], ";"}], "\n", RowBox[{"A2", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.7288343984774585`*^9, 3.7288344229967165`*^9}, { 3.728834535358612*^9, 3.728834552444067*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ { RowBox[{"-", "1.2870821435180106`"}], "7.950858228648709`", "2.8590001539907863`", RowBox[{"-", "12.389478766059625`"}], RowBox[{"-", "1.2594683010645835`"}]}, {"0.26048452659689936`", RowBox[{"-", "2.162161834291936`"}], "2.341031769923091`", "5.945777282519169`", "0.5690791957357056`"}, { RowBox[{"-", "0.11769754329827949`"}], "0.655881255684358`", "0.3725867787934451`", "0.9462998467508366`", "0.09057176717618691`"}, { RowBox[{"-", "0.018732145839630655`"}], RowBox[{"-", "0.05476819926763424`"}], "1.0592990276830956`", "0.15060829853035626`", "0.01441494447677403`"}, { RowBox[{"-", "0.002981313610496753`"}], RowBox[{"-", "0.008716629653477845`"}], "0.009437733393406169`", "1.0239700552251927`", "0.002294209672030226`"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{3.7289317718514867`*^9, 3.7289322872011566`*^9, 3.7289330670247946`*^9}] }, Open ]], Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"PowerMethod", "[", RowBox[{"A2", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728819337043078*^9, 3.7288193428324795`*^9}, { 3.7288195724195585`*^9, 3.7288195769907*^9}, {3.728822542373357*^9, 3.72882254908121*^9}, {3.728824208554889*^9, 3.7288242358375196`*^9}, { 3.728834161708107*^9, 3.728834164760227*^9}, {3.7288343417876434`*^9, 3.7288343425416517`*^9}, {3.7289310147282906`*^9, 3.728931031682395*^9}, 3.728931806131711*^9}], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "3.1415918306351904`"}], ",", RowBox[{"{", RowBox[{"1.`", ",", RowBox[{"-", "0.3183099695665471`"}], ",", "0.10132123672545612`", ",", RowBox[{"-", "0.03225155977852483`"}], ",", "0.010265993011575918`"}], "}"}], ",", "62"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.7289330803582416`*^9, 3.728933080378294*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"--", RowBox[{"--", RowBox[{"--", "Approximation"}]}]}], " ", "of", " ", "the", " ", "next", " ", "least", " ", "dominant", " ", "eigenpair", " ", "by", " ", "HouseHolder", " ", "Deflation"}]], "Input", CellChangeTimes->{{3.7288327843009777`*^9, 3.7288328207636557`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "x", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethod", "[", RowBox[{"A", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.7288241902161283`*^9, 3.7288242031846294`*^9}, { 3.728824239105164*^9, 3.728824240024612*^9}, 3.7288256800643606`*^9, { 3.728827747279608*^9, 3.7288277481619277`*^9}, 3.7288277953635*^9, { 3.728828162713482*^9, 3.728828182935279*^9}, 3.7288282323430004`*^9, { 3.728835147158221*^9, 3.7288351489239187`*^9}, {3.728924098188189*^9, 3.7289240995036893`*^9}, {3.728931655085847*^9, 3.728931658651363*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.09999999916353217`"}], ",", RowBox[{"{", RowBox[{"0.00009999999665414478`", ",", RowBox[{"-", "0.000999999974905956`"}], ",", "0.00999999983270643`", ",", RowBox[{"-", "0.09999999916353217`"}], ",", "1.`"}], "}"}], ",", "17"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.728933128478258*^9, 3.7289331284953094`*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam2", ",", "y", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethodImprove", "[", RowBox[{ RowBox[{"Transpose", "[", "A", "]"}], ",", "lam", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.728835055818223*^9, 3.728835056929206*^9}, 3.728835842664621*^9, {3.7289316612783213`*^9, 3.728931664584118*^9}, 3.7289331501418915`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.4594306041457386`, 1.`, \ 0.`, 0.`, 0.`}\\)\\), \\(\\({21.5361216730038`, 0.09999999916353217`, 1.`, \ 0.`, 0.`}\\)\\), \\(\\({\\(\\(-11.850136239782016`\\)\\), 0.`, \\(\\(\ \[LeftSkeleton] 20 \[RightSkeleton]\\)\\), 1.`, 0.`}\\)\\), \ \\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, 0.09999999916353217`, 1.`}\ \\)\\), \\(\\({\\(\\(-4.835098335854766`\\)\\), 0.`, 0.`, 0.`, \ 0.09999999916353217`}\\)\\)}\\)\[NoBreak] may contain significant numerical \ errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7289323303760185`*^9, 3.7289331540172024`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \ \[NoBreak]\\!\\({\\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, \ 0.09999999916353217`, 1.`}\\)\\), \\(\\({0.`, 1.`, 0.`, \ 0.0069539229467877875`, 0.06953923004955116`}\\)\\), \\(\\({0.`, \\(\\(\ \[LeftSkeleton] 3 \[RightSkeleton]\\)\\), 0.4259512255477143`}\\)\\), \ \\(\\({0.`, 0.`, 0.`, 0.9719201128033075`, \\(\\(-0.28079887431571676`\\)\\)}\ \\)\\), \\(\\({0.`, 0.`, 0.`, 0.`, \ \\(\\(-1.9081958235744878`*^-17\\)\\)}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7289323303760185`*^9, 3.7289331540653353`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \ \[NoBreak]\\!\\({\\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, \ 0.09999999916353217`, 1.`}\\)\\), \\(\\({0.`, 1.`, 0.`, \ 0.0069539229467877875`, 0.06953923004955116`}\\)\\), \\(\\({0.`, \\(\\(\ \[LeftSkeleton] 3 \[RightSkeleton]\\)\\), 0.4259512255477143`}\\)\\), \ \\(\\({0.`, 0.`, 0.`, 0.9719201128033075`, \\(\\(-0.28079887431571676`\\)\\)}\ \\)\\), \\(\\({0.`, 0.`, 0.`, 0.`, \ \\(\\(-1.9081958235744878`*^-17\\)\\)}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7289323303760185`*^9, 3.728933154077362*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \ \[NoBreak]\\!\\({\\(\\({\\(\\(-49.747899159663866`\\)\\), 0.`, 0.`, \ 0.09999999916353217`, 1.`}\\)\\), \\(\\({0.`, 1.`, 0.`, \ 0.0069539229467877875`, 0.06953923004955116`}\\)\\), \\(\\({0.`, \\(\\(\ \[LeftSkeleton] 3 \[RightSkeleton]\\)\\), 0.4259512255477143`}\\)\\), \ \\(\\({0.`, 0.`, 0.`, 0.9719201128033075`, \\(\\(-0.28079887431571676`\\)\\)}\ \\)\\), \\(\\({0.`, 0.`, 0.`, 0.`, \ \\(\\(-1.9081958235744878`*^-17\\)\\)}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7289323303760185`*^9, 3.728933154104432*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"General", "::", "stop"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Further output of \ \[NoBreak]\\!\\(\\*StyleBox[\\(LinearSolve :: luc\\), \\\"MessageName\\\"]\\)\ \[NoBreak] will be suppressed during this calculation. \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/General/stop\\\", \ ButtonNote -> \\\"General::stop\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.7289323303760185`*^9, 3.728933154119474*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "0.09999999916353218`"}], ",", RowBox[{"{", RowBox[{"0.020682102455286226`", ",", RowBox[{"-", "0.07154829819189489`"}], ",", RowBox[{"-", "0.4382574451712332`"}], ",", "0.28891147597080696`", ",", "1.`"}], "}"}], ",", "4"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.728933158225396*^9, 3.7289331582444468`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"nor", "=", RowBox[{"y", ".", "x"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"nor", ">", "0"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{"x", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", "nor", "]"}]}]}], ";"}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"x", "=", RowBox[{ RowBox[{"-", "x"}], "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";", "\n", " ", RowBox[{"y", "=", RowBox[{"y", "/", RowBox[{"Sqrt", "[", RowBox[{"-", "nor"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "Input", CellChangeTimes->{{3.728834238724948*^9, 3.7288342395681915`*^9}, { 3.728834285404443*^9, 3.7288343639496293`*^9}, {3.728928866961447*^9, 3.7289289530384026`*^9}, 3.72893316251581*^9}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"T", "=", RowBox[{"Table", "[", RowBox[{"0", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", "n"}], "}"}], ",", RowBox[{"{", RowBox[{"j", ",", "1", ",", "n"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"For", " ", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", " ", "n"}], ",", " ", RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", RowBox[{ RowBox[{ RowBox[{"T", "[", RowBox[{"[", RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", RowBox[{ RowBox[{"x", "[", RowBox[{"[", "i", "]"}], "]"}], " ", RowBox[{"y", "[", RowBox[{"[", "j", "]"}], "]"}]}]}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A2", "=", RowBox[{"A", "-", RowBox[{"lam", " ", "T"}]}]}], ";"}], "\n", RowBox[{"A2", "//", "MatrixForm"}]}], "Input", CellChangeTimes->{{3.7288343984774585`*^9, 3.7288344229967165`*^9}, { 3.728834535358612*^9, 3.728834552444067*^9}}], Cell[BoxData[ TagBox[ RowBox[{"(", "\[NoBreak]", GridBox[{ {"3.3594308189054978`", "21.536120932951018`", RowBox[{"-", "11.850140772854777`"}], RowBox[{"-", "49.74789617133644`"}], RowBox[{"-", "4.835087992453162`"}]}, {"0.9999978607670651`", "7.4005278842936795`*^-6", "0.00004533072799006742`", RowBox[{"-", "0.000029883274487954317`"}], RowBox[{"-", "0.00010343401689925902`"}]}, {"0.000021392329527662967`", "0.999925994720538`", RowBox[{"-", "0.00045330728369244786`"}], "0.0002988327473791857`", "0.0010343401776445225`"}, { RowBox[{"-", "0.0002139232970660293`"}], "0.000740052800809982`", "1.0045330728748423`", RowBox[{"-", "0.0029883274987882557`"}], RowBox[{"-", "0.010343401862964457`"}]}, {"0.002139232988554289`", RowBox[{"-", "0.007400528070002858`"}], RowBox[{"-", "0.04533072912759874`"}], "1.0298832752378466`", "0.10343401949483687`"} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}}], "\[NoBreak]", ")"}], Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]], "Output", CellChangeTimes->{3.728932339175428*^9, 3.728933170177194*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"t", "=", RowBox[{"RandomReal", "[", RowBox[{"1", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"t", "=", RowBox[{"t", "/", RowBox[{"Norm", "[", RowBox[{"t", ",", "Infinity"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{"lam", ",", "t", ",", "k"}], "}"}], "=", RowBox[{"InversePowerMethod", "[", RowBox[{"A2", ",", "itmax", ",", " ", "toll", ",", "t"}], "]"}]}]}], "Input", CellChangeTimes->{{3.7288241902161283`*^9, 3.7288242031846294`*^9}, { 3.728824239105164*^9, 3.728824240024612*^9}, 3.7288256800643606`*^9, { 3.728827747279608*^9, 3.7288277481619277`*^9}, 3.7288277953635*^9, { 3.728828162713482*^9, 3.728828182935279*^9}, 3.7288282323430004`*^9, 3.7288351169267945`*^9, {3.728931668892578*^9, 3.728931672379856*^9}}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LUDecomposition", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LUDecomposition\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.3594308189054978`, \ 21.536120932951018`, \\(\\(-11.850140772854777`\\)\\), \ \\(\\(-49.74789617133644`\\)\\), \\(\\(-4.835087992453162`\\)\\)}\\)\\), \ \\(\\(\[LeftSkeleton] 3 \[RightSkeleton]\\)\\), \\(\\({0.002139232988554289`, \ \\(\\(-0.007400528070002858`\\)\\), \\(\\(-0.04533072912759874`\\)\\), \ 1.0298832752378466`, 0.10343401949483687`}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LUDecomposition::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728932343192111*^9, 3.728933198141591*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.3594308189054978`, \ 21.536120932951018`, \\(\\(-11.850140772854777`\\)\\), \ \\(\\(-49.74789617133644`\\)\\), \\(\\(-4.835087992453162`\\)\\)}\\)\\), \ \\(\\({0.`, \\(\\(-6.410624644929232`\\)\\), 3.527462938483377`, \ 14.80836845284792`, 1.4391515796192955`}\\)\\), \\(\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 3 \ \[RightSkeleton]\\)\\), \\(\\(\[LeftSkeleton] 19 \ \[RightSkeleton]\\)\\)}\\)\\), \\(\\({0.`, 0.`, 0.`, 0.`, \ \\(\\(-2.7755575615628914`*^-17\\)\\)}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728932343192111*^9, 3.728933198172696*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.3594308189054978`, \ 21.536120932951018`, \\(\\(-11.850140772854777`\\)\\), \ \\(\\(-49.74789617133644`\\)\\), \\(\\(-4.835087992453162`\\)\\)}\\)\\), \ \\(\\({0.`, \\(\\(-6.410624644929232`\\)\\), 3.527462938483377`, \ 14.80836845284792`, 1.4391515796192955`}\\)\\), \\(\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 3 \ \[RightSkeleton]\\)\\), \\(\\(\[LeftSkeleton] 19 \ \[RightSkeleton]\\)\\)}\\)\\), \\(\\({0.`, 0.`, 0.`, 0.`, \ \\(\\(-2.7755575615628914`*^-17\\)\\)}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728932343192111*^9, 3.728933198201749*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"LinearSolve", "::", "luc"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Result for \[NoBreak]\\!\\(LinearSolve\\)\[NoBreak] of \ badly conditioned matrix \[NoBreak]\\!\\({\\(\\({3.3594308189054978`, \ 21.536120932951018`, \\(\\(-11.850140772854777`\\)\\), \ \\(\\(-49.74789617133644`\\)\\), \\(\\(-4.835087992453162`\\)\\)}\\)\\), \ \\(\\({0.`, \\(\\(-6.410624644929232`\\)\\), 3.527462938483377`, \ 14.80836845284792`, 1.4391515796192955`}\\)\\), \\(\\(\[LeftSkeleton] 1 \ \[RightSkeleton]\\)\\), \\(\\({0.`, \\(\\(\[LeftSkeleton] 3 \ \[RightSkeleton]\\)\\), \\(\\(\[LeftSkeleton] 19 \ \[RightSkeleton]\\)\\)}\\)\\), \\(\\({0.`, 0.`, 0.`, 0.`, \ \\(\\(-2.7755575615628914`*^-17\\)\\)}\\)\\)}\\)\[NoBreak] may contain \ significant numerical errors. \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", \ ButtonStyle->\\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/luc\\\", ButtonNote -> \ \\\"LinearSolve::luc\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728932343192111*^9, 3.7289331982278476`*^9}], Cell[BoxData[ RowBox[{ StyleBox[ RowBox[{"General", "::", "stop"}], "MessageName"], RowBox[{ ":", " "}], "\<\"Further output of \ \[NoBreak]\\!\\(\\*StyleBox[\\(LinearSolve :: luc\\), \\\"MessageName\\\"]\\)\ \[NoBreak] will be suppressed during this calculation. \ \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\\\"Link\\\", \ ButtonFrame->None, ButtonData:>\\\"paclet:ref/message/General/stop\\\", \ ButtonNote -> \\\"General::stop\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{3.728932343192111*^9, 3.728933198244894*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "2.870870773331291`*^-17"}], ",", RowBox[{"{", RowBox[{"0.00009999999665438453`", ",", RowBox[{"-", "0.000999999974905962`"}], ",", "0.009999999832706436`", ",", RowBox[{"-", "0.09999999916353218`"}], ",", "1.`"}], "}"}], ",", "4"}], "}"}], "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.728933206467747*^9, 3.728933206487794*^9}}] }, WindowSize->{661, 631}, WindowMargins->{{-7, Automatic}, {Automatic, 7}}, Magnification->1.8000001907348633`, FrontEndVersion->"9.0 for Microsoft Windows (64-bit) (January 25, 2013)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[579, 22, 664, 11, 123, "Input"], Cell[1246, 35, 237, 3, 85, "Output"] }, Open ]], Cell[1498, 41, 178, 3, 54, "Input"], Cell[1679, 46, 211, 8, 54, "Input"], Cell[CellGroupData[{ Cell[1915, 58, 868, 23, 259, "Input"], Cell[2786, 83, 789, 21, 154, "Output"] }, Open ]], Cell[3590, 107, 397, 9, 123, "Input"], Cell[3990, 118, 856, 19, 157, "Input"], Cell[4849, 139, 349, 9, 191, InheritFromParent], Cell[CellGroupData[{ Cell[5223, 152, 785, 21, 259, "Input"], Cell[6011, 175, 633, 12, 148, "Message"], Cell[6647, 189, 847, 15, 190, "Message"], Cell[7497, 206, 849, 15, 190, "Message"], Cell[8349, 223, 302, 7, 85, "Output"] }, Open ]], Cell[8666, 233, 303, 7, 157, "Input"], Cell[CellGroupData[{ Cell[8994, 244, 2375, 67, 565, "Input"], Cell[11372, 313, 1257, 32, 154, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[12666, 350, 891, 21, 157, "Input"], Cell[13560, 373, 357, 9, 141, "Output"] }, Open ]], Cell[13932, 385, 397, 10, 191, "Input"], Cell[14332, 397, 321, 7, 123, "Input"], Cell[CellGroupData[{ Cell[14678, 408, 940, 20, 191, "Input"], Cell[15621, 430, 341, 8, 85, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[15999, 443, 731, 19, 225, "Input"], Cell[16733, 464, 792, 14, 218, "Message"], Cell[17528, 480, 838, 15, 122, "Message"], Cell[18369, 497, 838, 15, 122, "Message"], Cell[19210, 514, 840, 15, 122, "Message"], Cell[20053, 531, 557, 11, 37, "Message"], Cell[20613, 544, 343, 8, 55, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[20993, 557, 2374, 67, 597, "Input"], Cell[23370, 626, 1037, 24, 136, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[24444, 655, 869, 20, 129, "Input"], Cell[25316, 677, 973, 16, 100, "Message"], Cell[26292, 695, 883, 16, 122, "Message"], Cell[27178, 713, 883, 16, 122, "Message"], Cell[28064, 731, 881, 16, 122, "Message"], Cell[28948, 749, 554, 11, 37, "Message"], Cell[29505, 762, 338, 8, 63, "Output"] }, Open ]], Cell[29858, 773, 331, 10, 55, "Input"], Cell[CellGroupData[{ Cell[30214, 787, 836, 23, 165, "Input"], Cell[31053, 812, 806, 22, 133, "Output"] }, Open ]], Cell[31874, 837, 397, 9, 55, "Input"], Cell[CellGroupData[{ Cell[32296, 850, 856, 19, 129, "Input"], Cell[33155, 871, 427, 9, 55, "Output"] }, Open ]], Cell[33597, 883, 376, 8, 55, "Input"], Cell[33976, 893, 439, 10, 55, "Input"], Cell[CellGroupData[{ Cell[34440, 907, 1837, 50, 381, "Input"], Cell[36280, 959, 1326, 32, 136, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[37643, 996, 893, 21, 129, "Input"], Cell[38539, 1019, 333, 8, 55, "Output"] }, Open ]], Cell[38887, 1030, 386, 9, 93, "Input"], Cell[39276, 1041, 377, 8, 55, "Input"], Cell[CellGroupData[{ Cell[39678, 1053, 944, 20, 129, "Input"], Cell[40625, 1075, 439, 10, 55, "Output"] }, Open ]], Cell[41079, 1088, 382, 9, 93, "Input"], Cell[41464, 1099, 439, 10, 55, "Input"], Cell[41906, 1111, 494, 11, 93, "Input"], Cell[CellGroupData[{ Cell[42425, 1126, 1509, 41, 309, "Input"], Cell[43937, 1169, 1055, 25, 136, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[45029, 1199, 923, 21, 129, "Input"], Cell[45955, 1222, 993, 17, 37, "Message"], Cell[46951, 1241, 944, 17, 52, "Message"], Cell[47898, 1260, 942, 17, 52, "Message"], Cell[48843, 1279, 942, 17, 52, "Message"], Cell[49788, 1298, 630, 12, 37, "Message"], Cell[50421, 1312, 416, 9, 63, "Output"] }, Open ]], Cell[50852, 1324, 386, 12, 55, "Input"], Cell[CellGroupData[{ Cell[51263, 1340, 1041, 27, 93, "Input"], Cell[52307, 1369, 1067, 30, 185, "Output"] }, Open ]], Cell[53389, 1402, 760, 14, 93, "Input"], Cell[54152, 1418, 397, 9, 55, "Input"], Cell[54552, 1429, 856, 19, 129, "Input"], Cell[55411, 1450, 387, 9, 93, "Input"], Cell[CellGroupData[{ Cell[55823, 1463, 785, 21, 165, "Input"], Cell[56611, 1486, 1080, 19, 70, "Message"], Cell[57694, 1507, 1099, 20, 81, "Message"], Cell[58796, 1529, 1101, 20, 81, "Message"] }, Open ]], Cell[59912, 1552, 413, 10, 93, "Input"], Cell[60328, 1564, 1080, 29, 309, "Input"], Cell[CellGroupData[{ Cell[61433, 1597, 1408, 40, 309, "Input"], Cell[62844, 1639, 1500, 36, 165, "Output"] }, Open ]], Cell[64359, 1678, 891, 21, 129, "Input"], Cell[65253, 1701, 435, 10, 93, "Input"], Cell[65691, 1713, 321, 7, 55, "Input"], Cell[66015, 1722, 940, 20, 129, "Input"], Cell[66958, 1744, 445, 11, 93, "Input"], Cell[CellGroupData[{ Cell[67428, 1759, 731, 19, 129, "Input"], Cell[68162, 1780, 996, 17, 70, "Message"], Cell[69161, 1799, 986, 18, 81, "Message"], Cell[70150, 1819, 984, 18, 81, "Message"], Cell[71137, 1839, 984, 18, 81, "Message"], Cell[72124, 1859, 557, 11, 37, "Message"] }, Open ]], Cell[72696, 1873, 436, 10, 93, "Input"], Cell[73135, 1885, 1079, 29, 309, "Input"], Cell[CellGroupData[{ Cell[74239, 1918, 1408, 40, 309, "Input"], Cell[75650, 1960, 1540, 36, 169, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[77227, 2001, 869, 20, 129, "Input"], Cell[78099, 2023, 939, 16, 70, "Message"], Cell[79041, 2041, 1084, 19, 81, "Message"], Cell[80128, 2062, 1084, 19, 81, "Message"], Cell[81215, 2083, 1086, 19, 81, "Message"], Cell[82304, 2104, 555, 11, 37, "Message"] }, Open ]], Cell[82874, 2118, 446, 11, 93, "Input"] } ] *) (* End of internal cache information *)