(* 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[ 15863, 474] NotebookOptionsPosition[ 14748, 431] NotebookOutlinePosition[ 15092, 446] CellTagsIndexPosition[ 15049, 443] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"A", "=", RowBox[{"Expand", "[", SuperscriptBox[ RowBox[{"(", RowBox[{"f", "-", "a", "-", RowBox[{"b", " ", "x"}], "-", RowBox[{"c", " ", SuperscriptBox["x", "2"]}]}], ")"}], "2"], "]"}]}]], "Input", CellChangeTimes->{{3.4881979014755926`*^9, 3.488197968444771*^9}, { 3.4882057707080183`*^9, 3.488205771473658*^9}, 3.4888154022751083`*^9}], Cell[BoxData[ RowBox[{ SuperscriptBox["a", "2"], "-", RowBox[{"2", " ", "a", " ", "f"}], "+", SuperscriptBox["f", "2"], "+", RowBox[{"2", " ", "a", " ", "b", " ", "x"}], "-", RowBox[{"2", " ", "b", " ", "f", " ", "x"}], "+", RowBox[{ SuperscriptBox["b", "2"], " ", SuperscriptBox["x", "2"]}], "+", RowBox[{"2", " ", "a", " ", "c", " ", SuperscriptBox["x", "2"]}], "-", RowBox[{"2", " ", "c", " ", "f", " ", SuperscriptBox["x", "2"]}], "+", RowBox[{"2", " ", "b", " ", "c", " ", SuperscriptBox["x", "3"]}], "+", RowBox[{ SuperscriptBox["c", "2"], " ", SuperscriptBox["x", "4"]}]}]], "Output", CellChangeTimes->{ 3.4888150921012487`*^9, {3.488815390196906*^9, 3.4888154035094914`*^9}, 3.4888156439927807`*^9, 3.4888167294315863`*^9, 3.4891578060828576`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", "\[IndentingNewLine]", RowBox[{ "Take", " ", "the", " ", "expectation", " ", "of", " ", "the", " ", "above", " ", "keeping", " ", "product", " ", "terms", " ", RowBox[{"separate", ".", " ", "In"}], " ", "the", " ", "above", " ", "\"\<\!\(\*SuperscriptBox[\(x\), \(i\)]\)\>\"", " ", "is", " ", "the", " ", "expectation", " ", "of", " ", "x", " ", "or", " ", "the", " ", "raw", " ", "moment", " ", "of", " ", RowBox[{"x", "."}]}], "\[IndentingNewLine]", "*)"}], "\[IndentingNewLine]", RowBox[{"expectationOfA", "=", RowBox[{ SuperscriptBox["a", "2"], "-", RowBox[{"2", " ", "a", " ", "f"}], "+", "f2", "+", RowBox[{"2", " ", "a", " ", "b", " ", "x"}], "-", RowBox[{"2", " ", "b", " ", "fx"}], "+", RowBox[{ SuperscriptBox["b", "2"], " ", "x2"}], "+", RowBox[{"2", " ", "a", " ", "c", " ", "x2"}], "-", RowBox[{"2", " ", "c", " ", "fx2"}], "+", RowBox[{"2", " ", "b", " ", "c", " ", "x3"}], "+", RowBox[{ SuperscriptBox["c", "2"], " ", "x4"}]}]}]}]], "Input", CellChangeTimes->{{3.4888151062888393`*^9, 3.488815171898634*^9}, { 3.4888152141489043`*^9, 3.4888152495866313`*^9}, 3.4888154074782667`*^9, { 3.4888156534928412`*^9, 3.488815677977373*^9}, {3.4888164034294996`*^9, 3.4888164233046265`*^9}}], Cell[BoxData[ RowBox[{ SuperscriptBox["a", "2"], "-", RowBox[{"2", " ", "a", " ", "f"}], "+", "f2", "-", RowBox[{"2", " ", "b", " ", "fx"}], "-", RowBox[{"2", " ", "c", " ", "fx2"}], "+", RowBox[{"2", " ", "a", " ", "b", " ", "x"}], "+", RowBox[{ SuperscriptBox["b", "2"], " ", "x2"}], "+", RowBox[{"2", " ", "a", " ", "c", " ", "x2"}], "+", RowBox[{"2", " ", "b", " ", "c", " ", "x3"}], "+", RowBox[{ SuperscriptBox["c", "2"], " ", "x4"}]}]], "Output", CellChangeTimes->{{3.488815150007869*^9, 3.488815172711139*^9}, { 3.4888154079001446`*^9, 3.4888154211814795`*^9}, 3.4888156794461327`*^9, 3.488816424210883*^9, 3.4888167543692455`*^9, 3.4891578061297336`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ RowBox[{ "lets", " ", "take", " ", "the", " ", "partial", " ", "derivatives", " ", "with", " ", "respect", " ", "to", " ", "a"}], ",", "b", ",", RowBox[{ "c", " ", "set", " ", "the", " ", "result", " ", "equal", " ", "to", " ", "zero", " ", "and", " ", "solve", " ", "for", " ", "a"}], ",", "b", ",", "c"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"eq1", "=", RowBox[{"D", "[", RowBox[{"expectationOfA", ",", "a"}], "]"}]}], "\[IndentingNewLine]", RowBox[{"eq2", "=", RowBox[{"D", "[", RowBox[{"expectationOfA", ",", "b"}], "]"}]}], "\[IndentingNewLine]", RowBox[{"eq3", "=", RowBox[{"D", "[", RowBox[{"expectationOfA", ",", "c"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.4888161658554955`*^9, 3.488816205715125*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"2", " ", "a"}], "-", RowBox[{"2", " ", "f"}], "+", RowBox[{"2", " ", "b", " ", "x"}], "+", RowBox[{"2", " ", "c", " ", "x2"}]}]], "Output", CellChangeTimes->{3.48881620646513*^9, 3.4888164263983965`*^9, 3.4888167560255065`*^9, 3.489157806192235*^9}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"-", "2"}], " ", "fx"}], "+", RowBox[{"2", " ", "a", " ", "x"}], "+", RowBox[{"2", " ", "b", " ", "x2"}], "+", RowBox[{"2", " ", "c", " ", "x3"}]}]], "Output", CellChangeTimes->{3.48881620646513*^9, 3.4888164263983965`*^9, 3.4888167560255065`*^9, 3.48915780620786*^9}], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"-", "2"}], " ", "fx2"}], "+", RowBox[{"2", " ", "a", " ", "x2"}], "+", RowBox[{"2", " ", "b", " ", "x3"}], "+", RowBox[{"2", " ", "c", " ", "x4"}]}]], "Output", CellChangeTimes->{3.48881620646513*^9, 3.4888164263983965`*^9, 3.4888167560255065`*^9, 3.48915780620786*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Solve", "[", RowBox[{ RowBox[{"eq1", "\[Equal]", "0"}], ",", RowBox[{"{", "a", "}"}]}], "]"}]], "Input", CellChangeTimes->{{3.488816228715273*^9, 3.4888162421059833`*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{"a", "\[Rule]", RowBox[{"f", "-", RowBox[{"b", " ", "x"}], "-", RowBox[{"c", " ", "x2"}]}]}], "}"}], "}"}]], "Output", CellChangeTimes->{{3.4888162355121913`*^9, 3.4888162426216116`*^9}, 3.488816427960907*^9, 3.4888167577911425`*^9, 3.489157806926624*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ "put", " ", "this", " ", "value", " ", "of", " ", "a", " ", "into", " ", "the", " ", "previous", " ", "two", " ", "equations"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"eq2prime", "=", RowBox[{ RowBox[{"eq2", "/.", RowBox[{"{", RowBox[{"a", "->", RowBox[{"f", "-", RowBox[{"b", " ", "x"}], " ", "-", RowBox[{"c", " ", "x2"}]}]}], "}"}]}], "//", "Simplify"}]}], "\[IndentingNewLine]", RowBox[{"eq3prime", "=", RowBox[{ RowBox[{"eq3", "/.", RowBox[{"{", RowBox[{"a", "->", RowBox[{"f", "-", RowBox[{"b", " ", "x"}], " ", "-", RowBox[{"c", " ", "x2"}]}]}], "}"}]}], "//", "Simplify"}]}]}]}]], "Input", CellChangeTimes->{{3.488816251246667*^9, 3.4888163016532393`*^9}, { 3.4888163497491145`*^9, 3.488816352391075*^9}, {3.4888164368047132`*^9, 3.4888164546485777`*^9}}], Cell[BoxData[ RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "fx"}], "+", RowBox[{"b", " ", "x2"}], "+", RowBox[{"x", " ", RowBox[{"(", RowBox[{"f", "-", RowBox[{"b", " ", "x"}], "-", RowBox[{"c", " ", "x2"}]}], ")"}]}], "+", RowBox[{"c", " ", "x3"}]}], ")"}]}]], "Output", CellChangeTimes->{{3.488816289090659*^9, 3.488816302840747*^9}, 3.488816353125821*^9, {3.4888164325703115`*^9, 3.488816455039205*^9}, 3.4888167624630475`*^9, 3.4891578071766286`*^9}], Cell[BoxData[ RowBox[{"2", " ", RowBox[{"(", RowBox[{ RowBox[{"-", "fx2"}], "+", RowBox[{"x2", " ", RowBox[{"(", RowBox[{"f", "-", RowBox[{"b", " ", "x"}], "-", RowBox[{"c", " ", "x2"}]}], ")"}]}], "+", RowBox[{"b", " ", "x3"}], "+", RowBox[{"c", " ", "x4"}]}], ")"}]}]], "Output", CellChangeTimes->{{3.488816289090659*^9, 3.488816302840747*^9}, 3.488816353125821*^9, {3.4888164325703115`*^9, 3.488816455039205*^9}, 3.4888167624630475`*^9, 3.489157807192254*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ RowBox[{ "These", " ", "two", " ", "remaining", " ", "equations", " ", "for", " ", "b"}], ",", "c"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"sol", "=", RowBox[{ RowBox[{"Solve", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"eq2prime", "\[Equal]", "0"}], ",", RowBox[{"eq3prime", "\[Equal]", "0"}]}], "}"}], ",", RowBox[{"{", RowBox[{"b", ",", "c"}], "}"}]}], "]"}], "//", "Simplify"}]}]}]], "Input", CellChangeTimes->{{3.488816469992426*^9, 3.488816488383168*^9}, { 3.4888166455716743`*^9, 3.4888166461185527`*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"b", "\[Rule]", FractionBox[ RowBox[{ RowBox[{ RowBox[{"-", "f"}], " ", "x2", " ", "x3"}], "+", RowBox[{"fx2", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "x"}], " ", "x2"}], "+", "x3"}], ")"}]}], "+", RowBox[{"fx", " ", RowBox[{"(", RowBox[{ SuperscriptBox["x2", "2"], "-", "x4"}], ")"}]}], "+", RowBox[{"f", " ", "x", " ", "x4"}]}], RowBox[{ SuperscriptBox["x2", "3"], "+", SuperscriptBox["x3", "2"], "+", RowBox[{ SuperscriptBox["x", "2"], " ", "x4"}], "-", RowBox[{"x2", " ", RowBox[{"(", RowBox[{ RowBox[{"2", " ", "x", " ", "x3"}], "+", "x4"}], ")"}]}]}]]}], ",", RowBox[{"c", "\[Rule]", FractionBox[ RowBox[{ RowBox[{"fx2", " ", RowBox[{"(", RowBox[{ SuperscriptBox["x", "2"], "-", "x2"}], ")"}]}], "+", RowBox[{"fx", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "x"}], " ", "x2"}], "+", "x3"}], ")"}]}], "+", RowBox[{"f", " ", RowBox[{"(", RowBox[{ SuperscriptBox["x2", "2"], "-", RowBox[{"x", " ", "x3"}]}], ")"}]}]}], RowBox[{ SuperscriptBox["x2", "3"], "+", SuperscriptBox["x3", "2"], "+", RowBox[{ SuperscriptBox["x", "2"], " ", "x4"}], "-", RowBox[{"x2", " ", RowBox[{"(", RowBox[{ RowBox[{"2", " ", "x", " ", "x3"}], "+", "x4"}], ")"}]}]}]]}]}], "}"}], "}"}]], "Output", CellChangeTimes->{3.4888164911488113`*^9, 3.488816646602931*^9, 3.4888167678380823`*^9, 3.489158398719236*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"(*", " ", RowBox[{ "Lets", " ", "convert", " ", "the", " ", "raw", " ", "moments", " ", "into", " ", "central", " ", RowBox[{"moments", ".", " ", "We"}], " ", "denote", " ", "the", " ", "mean", " ", "of", " ", "x", " ", "by", " ", "x", " ", "itself"}], " ", "*)"}], "\[IndentingNewLine]", RowBox[{"Simplify", "[", RowBox[{"sol", "/.", RowBox[{"{", RowBox[{ RowBox[{"x2", "\[Rule]", RowBox[{"m2", "+", SuperscriptBox["x", "2"]}]}], ",", RowBox[{"x3", "\[Rule]", RowBox[{"m3", "+", RowBox[{"3", " ", "m2", " ", "x"}], "+", SuperscriptBox["x", "3"]}]}], ",", RowBox[{"x4", "\[Rule]", RowBox[{"m4", "+", RowBox[{"4", "m3", " ", "x"}], " ", "+", " ", RowBox[{"6", " ", "m2", " ", SuperscriptBox["x", "2"]}], "+", SuperscriptBox["x", "4"]}]}]}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.4882057799425707`*^9, 3.4882058883352766`*^9}, { 3.488814685932415*^9, 3.488814715182602*^9}, {3.488814762526655*^9, 3.488814769182948*^9}, {3.4888149160688715`*^9, 3.488814963069173*^9}, { 3.488815258258562*^9, 3.488815280836831*^9}, {3.4888154271033926`*^9, 3.4888154564473305`*^9}, 3.4888165183833604`*^9, {3.488816651602963*^9, 3.488816681087527*^9}, {3.4888167926819906`*^9, 3.4888168054945726`*^9}, { 3.4891590394815383`*^9, 3.4891590428409777`*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"{", RowBox[{ RowBox[{"b", "\[Rule]", FractionBox[ RowBox[{ RowBox[{"fx2", " ", RowBox[{"(", RowBox[{"m3", "+", RowBox[{"2", " ", "m2", " ", "x"}]}], ")"}]}], "+", RowBox[{"fx", " ", RowBox[{"(", RowBox[{ SuperscriptBox["m2", "2"], "-", "m4", "-", RowBox[{"4", " ", "m3", " ", "x"}], "-", RowBox[{"4", " ", "m2", " ", SuperscriptBox["x", "2"]}]}], ")"}]}], "+", RowBox[{"f", " ", RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"-", "m2"}], " ", "m3"}], "-", RowBox[{"3", " ", SuperscriptBox["m2", "2"], " ", "x"}], "+", RowBox[{"m4", " ", "x"}], "+", RowBox[{"3", " ", "m3", " ", SuperscriptBox["x", "2"]}], "+", RowBox[{"2", " ", "m2", " ", SuperscriptBox["x", "3"]}]}], ")"}]}]}], RowBox[{ SuperscriptBox["m2", "3"], "+", SuperscriptBox["m3", "2"], "-", RowBox[{"m2", " ", "m4"}]}]]}], ",", RowBox[{"c", "\[Rule]", FractionBox[ RowBox[{ RowBox[{ RowBox[{"-", "fx2"}], " ", "m2"}], "+", RowBox[{"fx", " ", RowBox[{"(", RowBox[{"m3", "+", RowBox[{"2", " ", "m2", " ", "x"}]}], ")"}]}], "+", RowBox[{"f", " ", RowBox[{"(", RowBox[{ SuperscriptBox["m2", "2"], "-", RowBox[{"m3", " ", "x"}], "-", RowBox[{"m2", " ", SuperscriptBox["x", "2"]}]}], ")"}]}]}], RowBox[{ SuperscriptBox["m2", "3"], "+", SuperscriptBox["m3", "2"], "-", RowBox[{"m2", " ", "m4"}]}]]}]}], "}"}], "}"}]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{{3.488205785083294*^9, 3.4882057997398252`*^9}, { 3.488205876319421*^9, 3.4882058818195267`*^9}, 3.4888147164638605`*^9, 3.488814769542325*^9, 3.488814940662779*^9, 3.488814978850524*^9, 3.48881503061648*^9, 3.4888152931494102`*^9, 3.4888154708849225`*^9, 3.488815806728197*^9, 3.4888165183833604`*^9, {3.4888166741656075`*^9, 3.4888166814156537`*^9}, {3.4888167841194363`*^9, 3.488816806135202*^9}, { 3.489158395844181*^9, 3.489158401125532*^9}}] }, Open ]] }, WindowSize->{1150, 750}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, 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[CellGroupData[{ Cell[567, 22, 405, 10, 38, "Input"], Cell[975, 34, 818, 21, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[1830, 60, 1355, 28, 92, "Input"], Cell[3188, 90, 704, 15, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[3929, 110, 874, 21, 92, "Input"], Cell[4806, 133, 297, 7, 30, "Output"], Cell[5106, 142, 327, 8, 30, "Output"], Cell[5436, 152, 329, 8, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5802, 165, 206, 5, 31, "Input"], Cell[6011, 172, 333, 8, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6381, 185, 981, 28, 72, "Input"], Cell[7365, 215, 527, 14, 30, "Output"], Cell[7895, 231, 527, 14, 30, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[8459, 250, 663, 19, 52, "Input"], Cell[9125, 271, 1800, 56, 53, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[10962, 332, 1455, 32, 54, "Input"], Cell[12420, 366, 2312, 62, 52, "Output"] }, Open ]] } ] *) (* End of internal cache information *)