(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 11038, 414] NotebookOptionsPosition[ 9830, 367] NotebookOutlinePosition[ 10170, 382] CellTagsIndexPosition[ 10127, 379] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Solving Vector - valued linear first - order homogeneous recurrence relations \ with constant coefficients\ \>", "Title", CellChangeTimes->{{3.445166783055875*^9, 3.44516681179025*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"SolveVV", "[", RowBox[{"A_", ",", "a_"}], "]"}], ":=", RowBox[{"Block", "[", RowBox[{ RowBox[{"{", RowBox[{"eval", ",", "evec"}], "}"}], ",", RowBox[{ RowBox[{"eval", "=", RowBox[{"Eigenvalues", "[", "A", "]"}]}], ";", RowBox[{"evec", "=", RowBox[{"Eigenvectors", "[", "A", "]"}]}], ";", RowBox[{ RowBox[{"Transpose", "[", "evec", "]"}], ".", RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"eval", "^", "n"}], ")"}], "*", RowBox[{"(", RowBox[{ RowBox[{"Inverse", "[", RowBox[{"Transpose", "[", "evec", "]"}], "]"}], ".", "a"}], ")"}]}], ")"}]}]}]}], "]"}]}]], "Input", CellChangeTimes->{{3.445166457118375*^9, 3.445166478212125*^9}, { 3.445166511837125*^9, 3.445166581712125*^9}}], Cell[CellGroupData[{ Cell["Example of use :", "Section", CellChangeTimes->{{3.445166772274625*^9, 3.445166777759*^9}}], Cell[BoxData[{ RowBox[{"To", " ", "solve", " ", "the", " ", "recurrence", " ", "relation"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"a", RowBox[{"(", "n", ")"}]}], "=", RowBox[{ RowBox[{"(", GridBox[{ {"1", "1"}, {"1", "0"} }], ")"}], "a", RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}]}]}], ";", " ", RowBox[{ RowBox[{"a", RowBox[{"(", "0", ")"}]}], "=", RowBox[{"(", GridBox[{ {"1"}, {"1"} }], ")"}]}]}], ",", " ", RowBox[{"use", " ", "SolveVV", " ", "as", " ", RowBox[{"follows", ":"}]}]}]}], "Text", CellChangeTimes->{{3.445166839774625*^9, 3.445166957509*^9}}, FontSize->16], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"FullSimplify", "[", RowBox[{"SolveVV", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}]}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}]}], "]"}], "]"}]], "Input", CellChangeTimes->{{3.445166960509*^9, 3.44516699397775*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{ FractionBox["1", "5"], " ", SuperscriptBox["2", RowBox[{ RowBox[{"-", "1"}], "-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"5", "-", RowBox[{"3", " ", SqrtBox["5"]}]}], ")"}], " ", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], "+", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"5", "+", RowBox[{"3", " ", SqrtBox["5"]}]}], ")"}]}]}], ")"}]}], ",", RowBox[{ FractionBox["1", "5"], " ", SuperscriptBox["2", RowBox[{ RowBox[{"-", "1"}], "-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "5"}], "+", SqrtBox["5"]}], ")"}]}], "+", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"5", "+", SqrtBox["5"]}], ")"}]}]}], ")"}]}]}], "}"}]], "Output", CellChangeTimes->{{3.445166982555875*^9, 3.445166994774625*^9}}] }, Open ]], Cell["You can then use this to make a definition", "Text", CellChangeTimes->{{3.44516701660275*^9, 3.44516702541525*^9}}, FontSize->18], Cell[BoxData[ RowBox[{ RowBox[{"a", "[", "n_", "]"}], ":=", RowBox[{"FullSimplify", "[", RowBox[{"{", RowBox[{ RowBox[{ FractionBox["1", "5"], " ", SuperscriptBox["2", RowBox[{ RowBox[{"-", "1"}], "-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"5", "-", RowBox[{"3", " ", SqrtBox["5"]}]}], ")"}], " ", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], "+", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"5", "+", RowBox[{"3", " ", SqrtBox["5"]}]}], ")"}]}]}], ")"}]}], ",", RowBox[{ FractionBox["1", "5"], " ", SuperscriptBox["2", RowBox[{ RowBox[{"-", "1"}], "-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "5"}], "+", SqrtBox["5"]}], ")"}]}], "+", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"5", "+", SqrtBox["5"]}], ")"}]}]}], ")"}]}]}], "}"}], "]"}]}]], "Input", CellChangeTimes->{{3.445167056430875*^9, 3.44516707535275*^9}}], Cell["and then verify that ", "Text", CellChangeTimes->{{3.4451670848215*^9, 3.44516709272775*^9}}, FontSize->18], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"a", "[", "5", "]"}]], "Input", CellChangeTimes->{{3.445167105399625*^9, 3.445167113930875*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"13", ",", "8"}], "}"}]], "Output", CellChangeTimes->{3.44516711522775*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"a", "[", "10", "]"}]], "Input", CellChangeTimes->{{3.4451671168215*^9, 3.445167118884*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"144", ",", "89"}], "}"}]], "Output", CellChangeTimes->{3.44516711954025*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"a", "[", "0", "]"}]], "Input", CellChangeTimes->{{3.4451671298215*^9, 3.445167138180875*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}]], "Output", CellChangeTimes->{3.445167138993375*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"a", "[", "n", "]"}], "-", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}]}], "}"}], ".", RowBox[{"a", "[", RowBox[{"n", "-", "1"}], "]"}]}]}]], "Input", CellChangeTimes->{{3.445167140993375*^9, 3.445167151774625*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"-", FractionBox[ RowBox[{ SuperscriptBox["2", RowBox[{"-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{"-", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], "+", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"]}], ")"}]}], SqrtBox["5"]]}], "-", RowBox[{ FractionBox["1", "5"], " ", SuperscriptBox["2", RowBox[{ RowBox[{"-", "1"}], "-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], " ", RowBox[{"(", RowBox[{ RowBox[{"-", "5"}], "+", SqrtBox["5"]}], ")"}]}], "+", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"5", "+", SqrtBox["5"]}], ")"}]}]}], ")"}]}], "+", RowBox[{ FractionBox["1", "5"], " ", SuperscriptBox["2", RowBox[{ RowBox[{"-", "1"}], "-", "n"}]], " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"5", "-", RowBox[{"3", " ", SqrtBox["5"]}]}], ")"}], " ", SuperscriptBox[ RowBox[{"(", RowBox[{"1", "-", SqrtBox["5"]}], ")"}], "n"]}], "+", RowBox[{ SuperscriptBox[ RowBox[{"(", RowBox[{"1", "+", SqrtBox["5"]}], ")"}], "n"], " ", RowBox[{"(", RowBox[{"5", "+", RowBox[{"3", " ", SqrtBox["5"]}]}], ")"}]}]}], ")"}]}]}], ",", "0"}], "}"}]], "Output", CellChangeTimes->{3.44516715716525*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"FullSimplify", "[", "%", "]"}]], "Input", CellChangeTimes->{{3.445167158524625*^9, 3.445167161493375*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}]], "Output", CellChangeTimes->{3.445167163368375*^9}] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{611, 750}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, FrontEndVersion->"6.0 for Microsoft Windows (64-bit) (April 20, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 196, 4, 245, "Title"], Cell[789, 29, 861, 25, 72, "Input"], Cell[CellGroupData[{ Cell[1675, 58, 98, 1, 71, "Section"], Cell[1776, 61, 710, 25, 112, "Text"], Cell[CellGroupData[{ Cell[2511, 90, 397, 12, 31, "Input"], Cell[2911, 104, 1461, 53, 79, "Output"] }, Open ]], Cell[4387, 160, 137, 2, 34, "Text"], Cell[4527, 164, 1654, 56, 99, "Input"], Cell[6184, 222, 115, 2, 34, "Text"], Cell[CellGroupData[{ Cell[6324, 228, 120, 2, 31, "Input"], Cell[6447, 232, 115, 3, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6599, 240, 116, 2, 31, "Input"], Cell[6718, 244, 117, 3, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6872, 252, 118, 2, 31, "Input"], Cell[6993, 256, 115, 3, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[7145, 264, 375, 12, 31, "Input"], Cell[7523, 278, 1981, 72, 128, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[9541, 355, 131, 2, 31, "Input"], Cell[9675, 359, 115, 3, 30, "Output"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)