(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 15260, 449] NotebookOptionsPosition[ 13993, 403] NotebookOutlinePosition[ 14357, 419] CellTagsIndexPosition[ 14314, 416] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"kFullStep", "[", "pPlus0_", "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"pMinus", ",", "pPlus1Inv", ",", "pPlus1"}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ "this", " ", "does", " ", "the", " ", "algebra", " ", "for", " ", "one", " ", "step", " ", "of", " ", "the", " ", "discrete", " ", "Kalman", " ", "filter", " ", "starting", " ", "from", " ", "p", RowBox[{"(", "+", ")"}]}], ",", " ", RowBox[{"producing", " ", "the", " ", "next", " ", "p", RowBox[{"(", "-", ")"}]}], ",", " ", RowBox[{"and", " ", "the", " ", "next", " ", "p", RowBox[{"(", "+", ")"}]}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{"pMinus", "=", RowBox[{"Simplify", "[", RowBox[{"pPlus0", "+", RowBox[{"q", " ", "Delta"}]}], "]"}]}], ";"}], "*)"}], "\[IndentingNewLine]", " ", RowBox[{ RowBox[{"pMinus", "=", RowBox[{"Simplify", "[", RowBox[{"pPlus0", "+", RowBox[{"g", " ", "r0"}]}], "]"}]}], ";", RowBox[{"(*", " ", RowBox[{"gamma", " ", "r0"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"pPlus1Inv", "=", RowBox[{"Together", "[", RowBox[{ FractionBox["1", "pMinus"], "+", FractionBox["1", "r0"]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pPlus1", "=", FractionBox["1", "pPlus1Inv"]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", RowBox[{"{", RowBox[{"pMinus", ",", "pPlus1"}], "}"}], "]"}], ";"}]}], " ", RowBox[{"(*", " ", RowBox[{"returns", " ", "p", RowBox[{"(", "-", ")"}], " ", "and", " ", "p", RowBox[{"(", "+", ")"}]}], " ", "*)"}], "\[IndentingNewLine]", "]"}]}], ";"}]], "Input", CellChangeTimes->{{3.487060998860074*^9, 3.4870610074852395`*^9}, { 3.4870610377983217`*^9, 3.48706120359838*^9}, {3.4870612451460524`*^9, 3.487061247677351*^9}, {3.487061310709811*^9, 3.48706134841366*^9}, { 3.487061387055027*^9, 3.4870614281808167`*^9}, {3.4870657283280497`*^9, 3.487065816282863*^9}, {3.4870658606743402`*^9, 3.487065956644933*^9}, { 3.487066344089872*^9, 3.4870663470274286`*^9}, {3.4870723923622465`*^9, 3.487072420878419*^9}, {3.4880134026147575`*^9, 3.488013412021188*^9}, { 3.4880137337929907`*^9, 3.4880137401524878`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ "Lets", " ", "do", " ", "the", " ", "two", " ", "steps", " ", "of", " ", "the", " ", "forward", " ", "solution"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"p0Plus", "=", FractionBox["1", "smallEps"]}], ";"}], "\[IndentingNewLine]", RowBox[{"p1", "=", RowBox[{"kFullStep", "[", "p0Plus", "]"}]}], "\[IndentingNewLine]", RowBox[{"p2", "=", RowBox[{"kFullStep", "[", RowBox[{"p1", "[", RowBox[{"[", "2", "]"}], "]"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.4870612053171625`*^9, 3.4870612373021517`*^9}, { 3.4870614441811237`*^9, 3.487061445681153*^9}, 3.4870658317675357`*^9, { 3.487065989442438*^9, 3.4870660560843425`*^9}, {3.488013419443205*^9, 3.48801343089655*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"g", " ", "r0"}], "+", FractionBox["1", "smallEps"]}], ",", FractionBox[ RowBox[{"r0", " ", RowBox[{"(", RowBox[{"1", "+", RowBox[{"g", " ", "r0", " ", "smallEps"}]}], ")"}]}], RowBox[{"1", "+", RowBox[{"r0", " ", "smallEps"}], "+", RowBox[{"g", " ", "r0", " ", "smallEps"}]}]]}], "}"}]], "Output", CellChangeTimes->{{3.487061419508775*^9, 3.487061445946783*^9}, { 3.487065796782489*^9, 3.4870658197360544`*^9}, 3.487065893284342*^9, 3.4870659626606736`*^9, {3.487065998395735*^9, 3.4870660256618834`*^9}, 3.4870660575687456`*^9, 3.487071468625761*^9, 3.4870715120328445`*^9, 3.487072422722204*^9, 3.4880134573970585`*^9, 3.4880137434806767`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"r0", " ", RowBox[{"(", RowBox[{"g", "+", FractionBox[ RowBox[{"1", "+", RowBox[{"g", " ", "r0", " ", "smallEps"}]}], RowBox[{"1", "+", RowBox[{ RowBox[{"(", RowBox[{"1", "+", "g"}], ")"}], " ", "r0", " ", "smallEps"}]}]]}], ")"}]}], ",", FractionBox[ RowBox[{"r0", " ", RowBox[{"(", RowBox[{"1", "+", "g", "+", RowBox[{"2", " ", "g", " ", "r0", " ", "smallEps"}], "+", RowBox[{ SuperscriptBox["g", "2"], " ", "r0", " ", "smallEps"}]}], ")"}]}], RowBox[{"2", "+", "g", "+", RowBox[{"r0", " ", "smallEps"}], "+", RowBox[{"3", " ", "g", " ", "r0", " ", "smallEps"}], "+", RowBox[{ SuperscriptBox["g", "2"], " ", "r0", " ", "smallEps"}]}]]}], "}"}]], "Output", CellChangeTimes->{{3.487061419508775*^9, 3.487061445946783*^9}, { 3.487065796782489*^9, 3.4870658197360544`*^9}, 3.487065893284342*^9, 3.4870659626606736`*^9, {3.487065998395735*^9, 3.4870660256618834`*^9}, 3.4870660575687456`*^9, 3.487071468625761*^9, 3.4870715120328445`*^9, 3.487072422722204*^9, 3.4880134573970585`*^9, 3.4880137434806767`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ "what", " ", "do", " ", "these", " ", "expressions", " ", "evaluate", " ", "when", " ", "epsilon", " ", "is", " ", RowBox[{"zero", "?"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"p1", "/.", RowBox[{"{", RowBox[{"smallEps", "\[Rule]", "0"}], "}"}]}], "\[IndentingNewLine]", RowBox[{"p2", "/.", RowBox[{"{", RowBox[{"smallEps", "\[Rule]", "0"}], "}"}]}]}]}]], "Input", CellChangeTimes->{{3.487066119085552*^9, 3.48706613800779*^9}, { 3.487071491641828*^9, 3.4870715080171423`*^9}, {3.488013749402665*^9, 3.4880137498089232`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Power", "::", "\<\"infy\"\>"}], RowBox[{ ":", " "}], "\<\"\\!\\(\\*StyleBox[\\\"\\\\\\\"Infinite expression \\\\\\\"\ \\\", \\\"MT\\\"]\\)\[NoBreak]\\!\\(\\*StyleBox[\\!\\(1\\/0\\), \ \\\"MT\\\"]\\)\[NoBreak]\\!\\(\\*StyleBox[\\\"\\\\\\\" encountered.\\\\\\\"\\\ \", \\\"MT\\\"]\\) \\!\\(\\*ButtonBox[\\\"\[RightSkeleton]\\\", ButtonStyle->\ \\\"Link\\\", ButtonFrame->None, \ ButtonData:>\\\"paclet:ref/message/General/infy\\\", ButtonNote -> \ \\\"Power::infy\\\"]\\)\"\>"}]], "Message", "MSG", CellChangeTimes->{{3.4870661254294233`*^9, 3.4870661383202963`*^9}, 3.487071513829754*^9, 3.4870724370974803`*^9, 3.4880137509808207`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{"ComplexInfinity", ",", "r0"}], "}"}]], "Output", CellChangeTimes->{{3.4870661254450493`*^9, 3.4870661383202963`*^9}, 3.487071513829754*^9, 3.4870724370974803`*^9, 3.4880137509964457`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "+", "g"}], ")"}], " ", "r0"}], ",", FractionBox[ RowBox[{ RowBox[{"(", RowBox[{"1", "+", "g"}], ")"}], " ", "r0"}], RowBox[{"2", "+", "g"}]]}], "}"}]], "Output", CellChangeTimes->{{3.4870661254450493`*^9, 3.4870661383202963`*^9}, 3.487071513829754*^9, 3.4870724370974803`*^9, 3.4880137509964457`*^9}] }, Open ]], Cell["\<\ We will do the backwards smoothing by hand now when epsilon is not exactly \ equal to zero.\ \>", "Text", CellChangeTimes->{{3.487071484297937*^9, 3.4870714858292165`*^9}, { 3.487071544830349*^9, 3.4870715535805173`*^9}, {3.487072581459627*^9, 3.487072592444213*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"compute", " ", "A1", " ", "first"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A1", "=", RowBox[{"Simplify", "[", FractionBox[ RowBox[{"p1", "[", RowBox[{"[", "2", "]"}], "]"}], RowBox[{"p2", "[", RowBox[{"[", "1", "]"}], "]"}]], "]"}]}], " ", RowBox[{"(*", " ", RowBox[{"this", " ", "is", " ", "p1", RowBox[{ RowBox[{"(", "+", ")"}], "/", "p2"}], RowBox[{"(", "-", ")"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"A1", "/.", RowBox[{"{", RowBox[{"smallEps", "\[Rule]", "0"}], "}"}]}]}]}]], "Input", CellChangeTimes->{{3.4870726086163983`*^9, 3.487072692118002*^9}, { 3.4880138840927515`*^9, 3.4880138863271694`*^9}, {3.4880139258435526`*^9, 3.488013968188116*^9}}], Cell[BoxData[ FractionBox[ RowBox[{"1", "+", RowBox[{"g", " ", "r0", " ", "smallEps"}]}], RowBox[{"1", "+", "g", "+", RowBox[{"2", " ", "g", " ", "r0", " ", "smallEps"}], "+", RowBox[{ SuperscriptBox["g", "2"], " ", "r0", " ", "smallEps"}]}]]], "Output", CellChangeTimes->{ 3.4870726090851574`*^9, {3.4870726596017523`*^9, 3.4870726924461327`*^9}, 3.488013936265628*^9, 3.48801396917251*^9}], Cell[BoxData[ FractionBox["1", RowBox[{"1", "+", "g"}]]], "Output", CellChangeTimes->{ 3.4870726090851574`*^9, {3.4870726596017523`*^9, 3.4870726924461327`*^9}, 3.488013936265628*^9, 3.48801396917251*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"now", " ", "compute", " ", "P_", RowBox[{"{", RowBox[{"1", "|", "2"}], "}"}]}], " ", "*)"}], " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"p1Given2", "=", RowBox[{"Simplify", "[", RowBox[{ RowBox[{"p1", "[", RowBox[{"[", "2", "]"}], "]"}], "+", RowBox[{"A1", " ", RowBox[{"(", " ", RowBox[{ RowBox[{"p2", "[", RowBox[{"[", "2", "]"}], "]"}], "-", RowBox[{"p2", "[", RowBox[{"[", "1", "]"}], "]"}]}], " ", ")"}], " ", "A1"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"p1Given2", "/.", RowBox[{"{", RowBox[{"smallEps", "\[Rule]", "0"}], "}"}]}]}]}]], "Input", CellChangeTimes->{{3.4870727184622574`*^9, 3.4870727722757907`*^9}, { 3.4880139707662907`*^9, 3.4880139847509336`*^9}}], Cell[BoxData[ FractionBox[ RowBox[{ RowBox[{"(", RowBox[{"1", "+", "g"}], ")"}], " ", "r0", " ", RowBox[{"(", RowBox[{"1", "+", RowBox[{"g", " ", "r0", " ", "smallEps"}]}], ")"}]}], RowBox[{"2", "+", "g", "+", RowBox[{"r0", " ", "smallEps"}], "+", RowBox[{"3", " ", "g", " ", "r0", " ", "smallEps"}], "+", RowBox[{ SuperscriptBox["g", "2"], " ", "r0", " ", "smallEps"}]}]]], "Output", CellChangeTimes->{{3.487072769228857*^9, 3.4870727727289248`*^9}, 3.4880140073294926`*^9, 3.4880147440311365`*^9}], Cell[BoxData[ FractionBox[ RowBox[{ RowBox[{"(", RowBox[{"1", "+", "g"}], ")"}], " ", "r0"}], RowBox[{"2", "+", "g"}]]], "Output", CellChangeTimes->{{3.487072769228857*^9, 3.4870727727289248`*^9}, 3.4880140073294926`*^9, 3.4880147440311365`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"compute", " ", "A0", " ", "next"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"A0", "=", RowBox[{"Simplify", "[", FractionBox["p0Plus", RowBox[{"p1", "[", RowBox[{"[", "1", "]"}], "]"}]], "]"}]}], " ", RowBox[{"(*", " ", RowBox[{"this", " ", "is", " ", "p0", RowBox[{ RowBox[{"(", "+", ")"}], "/", "p1"}], RowBox[{"(", "-", ")"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"A0", "/.", RowBox[{"{", RowBox[{"smallEps", "\[Rule]", "0"}], "}"}]}]}]}]], "Input", CellChangeTimes->{{3.4880140213766375`*^9, 3.4880140301268053`*^9}, { 3.4880148664397373`*^9, 3.48801490669051*^9}}], Cell[BoxData[ FractionBox["1", RowBox[{"1", "+", RowBox[{"g", " ", "r0", " ", "smallEps"}]}]]], "Output", CellChangeTimes->{{3.48801489239336*^9, 3.4880149070186415`*^9}}], Cell[BoxData["1"], "Output", CellChangeTimes->{{3.48801489239336*^9, 3.4880149070342665`*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{"now", " ", "compute", " ", "P_", RowBox[{"{", RowBox[{"0", "|", "2"}], "}"}]}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"p0Given2", "=", RowBox[{"Simplify", "[", RowBox[{"p0Plus", "+", RowBox[{"A0", " ", RowBox[{"(", RowBox[{"p1Given2", " ", "-", " ", RowBox[{"p1", "[", RowBox[{"[", "1", "]"}], "]"}]}], ")"}], " ", "A0"}]}], "]"}]}], "\[IndentingNewLine]", RowBox[{"p0Given2", "/.", RowBox[{"{", RowBox[{"smallEps", "\[Rule]", "0"}], "}"}]}]}]}]], "Input", CellChangeTimes->{{3.4880150111143894`*^9, 3.48801506789673*^9}}], Cell[BoxData[ FractionBox[ RowBox[{ RowBox[{"(", RowBox[{"1", "+", RowBox[{"3", " ", "g"}], "+", SuperscriptBox["g", "2"]}], ")"}], " ", "r0"}], RowBox[{"2", "+", "g", "+", RowBox[{"r0", " ", "smallEps"}], "+", RowBox[{"3", " ", "g", " ", "r0", " ", "smallEps"}], "+", RowBox[{ SuperscriptBox["g", "2"], " ", "r0", " ", "smallEps"}]}]]], "Output", CellChangeTimes->{{3.488015047833845*^9, 3.4880150688811235`*^9}}], Cell[BoxData[ FractionBox[ RowBox[{ RowBox[{"(", RowBox[{"1", "+", RowBox[{"3", " ", "g"}], "+", SuperscriptBox["g", "2"]}], ")"}], " ", "r0"}], RowBox[{"2", "+", "g"}]]], "Output", CellChangeTimes->{{3.488015047833845*^9, 3.4880150688811235`*^9}}] }, Open ]] }, WindowSize->{827, 750}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, ShowSelection->True, FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (February 18, 2009)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[545, 20, 2512, 56, 241, "Input"], Cell[CellGroupData[{ Cell[3082, 80, 822, 20, 110, "Input"], Cell[3907, 102, 777, 18, 49, "Output"], Cell[4687, 122, 1226, 31, 53, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5950, 158, 651, 16, 72, "Input"], Cell[6604, 176, 680, 12, 40, "Message"], Cell[7287, 190, 232, 4, 30, "Output"], Cell[7522, 196, 419, 12, 49, "Output"] }, Open ]], Cell[7956, 211, 283, 6, 29, "Text"], Cell[CellGroupData[{ Cell[8264, 221, 837, 23, 90, "Input"], Cell[9104, 246, 420, 10, 49, "Output"], Cell[9527, 258, 215, 5, 49, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[9779, 268, 870, 25, 72, "Input"], Cell[10652, 295, 549, 14, 49, "Output"], Cell[11204, 311, 264, 7, 49, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[11505, 323, 728, 20, 90, "Input"], Cell[12236, 345, 180, 4, 49, "Output"], Cell[12419, 351, 95, 1, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[12551, 357, 688, 19, 72, "Input"], Cell[13242, 378, 457, 12, 53, "Output"], Cell[13702, 392, 275, 8, 53, "Output"] }, Open ]] } ] *) (* End of internal cache information *)