(* 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[ 15410, 464] NotebookOptionsPosition[ 13916, 406] NotebookOutlinePosition[ 14295, 422] CellTagsIndexPosition[ 14252, 419] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["Teste de hipotese - 17/9/2013", "Subtitle", CellChangeTimes->{{3.588318034006462*^9, 3.588318069243704*^9}}], Cell["Teste z", "Section", CellChangeTimes->{{3.5883180966990633`*^9, 3.588318101465076*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["em ajustes do mmq", "Subtitle", CellChangeTimes->{{3.5883181192165203`*^9, 3.5883181229199467`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"oh", "[", RowBox[{"\[Omega]_", ",", "t_", ",", "a_", ",", "b_"}], "]"}], ":=", RowBox[{ RowBox[{"a", " ", RowBox[{"Sin", "[", RowBox[{"\[Omega]", " ", "t"}], "]"}]}], "+", RowBox[{"b", " ", RowBox[{"Cos", "[", RowBox[{"\[Omega]", " ", "t"}], "]"}]}]}]}]], "Input", CellChangeTimes->{{3.5883181488595576`*^9, 3.588318233694586*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"a0", "=", "1."}], ";", RowBox[{"b0", "=", "0.5"}]}]], "Input", CellChangeTimes->{{3.5883182514147787`*^9, 3.5883182613062077`*^9}}], Cell[BoxData["0.5`"], "Output", CellChangeTimes->{3.5883182649627523`*^9, 3.588321652524109*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"tm", "=", RowBox[{"Table", "[", RowBox[{"t", ",", RowBox[{"{", RowBox[{"t", ",", "0", ",", RowBox[{"6", "Pi"}], ",", RowBox[{"6", RowBox[{"Pi", "/", "11"}]}]}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.5883188082257123`*^9, 3.5883188266647124`*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"0", ",", FractionBox[ RowBox[{"6", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"12", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"18", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"24", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"30", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"36", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"42", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"48", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"54", " ", "\[Pi]"}], "11"], ",", FractionBox[ RowBox[{"60", " ", "\[Pi]"}], "11"], ",", RowBox[{"6", " ", "\[Pi]"}]}], "}"}]], "Output", CellChangeTimes->{3.588318829243047*^9, 3.5883216525397353`*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"oh0", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"oh", "[", RowBox[{ RowBox[{"1", "/", "Pi"}], ",", RowBox[{"tm", "[", RowBox[{"[", "i", "]"}], "]"}], ",", "a0", ",", "b0"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "tm", "]"}]}], "}"}]}], "]"}]}]], "Input", CellChangeTimes->{{3.5883182796201982`*^9, 3.5883183552513523`*^9}, { 3.588318461384989*^9, 3.588318485090042*^9}, {3.5883188348841314`*^9, 3.588318868433736*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ "0.5`", ",", "0.9462525100898562`", ",", "1.117886564963956`", ",", "0.9650910639812397`", ",", "0.5322098413681617`", ",", RowBox[{"-", "0.05512766318732132`"}], ",", RowBox[{"-", "0.6264661890952141`"}], ",", RowBox[{"-", "1.0159936495002073`"}], ",", RowBox[{"-", "1.110662598503978`"}], ",", RowBox[{"-", "0.8829985086890548`"}], ",", RowBox[{"-", "0.3990733428628485`"}], ",", "0.20066964512625712`"}], "}"}]], "Output", CellChangeTimes->{ 3.588318359423565*^9, {3.5883184647446346`*^9, 3.588318485433818*^9}, 3.588318872512191*^9, 3.58832165257099*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"sh", "=", RowBox[{"Round", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Sqrt", "[", RowBox[{ RowBox[{"0.03", "^", "2"}], "+", RowBox[{ RowBox[{"(", RowBox[{"0.05", " ", RowBox[{"Cos", "[", RowBox[{"tm", "[", RowBox[{"[", "i", "]"}], "]"}], " ", "]"}]}], ")"}], "^", "2"}]}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "tm", "]"}]}], "}"}]}], "]"}], ",", "0.01"}], "]"}]}]], "Input", CellChangeTimes->{{3.588318367002309*^9, 3.5883184371955204`*^9}, { 3.588318495215866*^9, 3.5883185152331204`*^9}, {3.588318881950461*^9, 3.588318897451722*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{ "0.06`", ",", "0.03`", ",", "0.06`", ",", "0.04`", ",", "0.05`", ",", "0.04`", ",", "0.04`", ",", "0.05`", ",", "0.04`", ",", "0.06`", ",", "0.03`", ",", "0.06`"}], "}"}]], "Output", CellChangeTimes->{{3.5883184386331396`*^9, 3.5883185156862783`*^9}, { 3.588318884872576*^9, 3.5883188980923996`*^9}, 3.58832165260224*^9}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData["a0"], "Input", CellChangeTimes->{{3.5883203924483747`*^9, 3.588320403808673*^9}, { 3.588320607278355*^9, 3.588320607481497*^9}}], Cell[BoxData["1.`"], "Output", CellChangeTimes->{3.588320608278434*^9, 3.5883216526178665`*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"soh", "[", RowBox[{"a1_", ",", "b1_", ",", "\[Alpha]_"}], "]"}], ":=", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{ "y", ",", "f", ",", "g", ",", "m", ",", "d", ",", "p", ",", "s", ",", "z1", ",", "z2"}], "}"}], ",", RowBox[{ RowBox[{"y", "=", RowBox[{"Table", "[", RowBox[{ RowBox[{"RandomVariate", "[", RowBox[{"NormalDistribution", "[", RowBox[{ RowBox[{"oh0", "[", RowBox[{"[", "i", "]"}], "]"}], ",", RowBox[{"sh", "[", RowBox[{"[", "i", "]"}], "]"}]}], " ", "]"}], " ", "]"}], ",", RowBox[{"{", RowBox[{"i", ",", RowBox[{"Length", "[", "tm", "]"}]}], "}"}]}], "]"}]}], ";", RowBox[{"f", "=", RowBox[{"Sin", "/@", RowBox[{"(", RowBox[{"tm", "/", "Pi"}], ")"}]}]}], ";", RowBox[{"g", "=", RowBox[{"Cos", "/@", RowBox[{"(", RowBox[{"tm", "/", "Pi"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"m", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"Total", "[", RowBox[{ RowBox[{"f", "^", "2"}], "/", RowBox[{"sh", "^", "2"}]}], "]"}], ",", RowBox[{"Total", "[", RowBox[{"f", " ", RowBox[{"g", "/", RowBox[{"sh", "^", "2"}]}]}], "]"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Total", "[", RowBox[{"f", " ", RowBox[{"g", "/", RowBox[{"sh", "^", "2"}]}]}], "]"}], ",", RowBox[{"Total", "[", RowBox[{ RowBox[{"g", "^", "2"}], "/", RowBox[{"sh", "^", "2"}]}], "]"}]}], "}"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"d", "=", RowBox[{"{", RowBox[{ RowBox[{"Total", "[", RowBox[{"f", " ", RowBox[{"y", "/", RowBox[{"sh", "^", "2"}]}]}], "]"}], ",", RowBox[{"Total", "[", RowBox[{"g", " ", RowBox[{"y", "/", RowBox[{"sh", "^", "2"}]}]}], "]"}]}], "}"}]}], ";", "\[IndentingNewLine]", RowBox[{"p", "=", RowBox[{"LinearSolve", "[", RowBox[{"m", ",", "d"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"s", "=", RowBox[{"Sqrt", "[", RowBox[{"Diagonal", "[", RowBox[{"Inverse", "[", "m", "]"}], "]"}], " ", "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Print", "[", RowBox[{"\"\\"", ",", RowBox[{"Round", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "0.001"}], "]"}], ",", " ", "\"\<+-\>\"", " ", ",", RowBox[{"Round", "[", RowBox[{ RowBox[{"s", "[", RowBox[{"[", "1", "]"}], "]"}], ",", "0.001"}], "]"}], " ", ",", "\"\< b= \>\"", ",", RowBox[{"Round", "[", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "0.001"}], "]"}], ",", " ", "\"\<+-\>\"", " ", ",", RowBox[{"Round", "[", RowBox[{ RowBox[{"s", "[", RowBox[{"[", "2", "]"}], "]"}], ",", "0.001"}], "]"}]}], " ", "]"}], " ", ";", "\[IndentingNewLine]", RowBox[{"z1", "=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "1", "]"}], "]"}], "-", "a1"}], ")"}], "/", RowBox[{"s", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], ";", RowBox[{"z2", "=", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"p", "[", RowBox[{"[", "2", "]"}], "]"}], "-", "b1"}], ")"}], "/", RowBox[{"s", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"{", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Abs", "[", "z1", "]"}], ">", RowBox[{"Abs", "[", RowBox[{"InverseCDF", "[", RowBox[{ RowBox[{"NormalDistribution", "[", RowBox[{"0", ",", "1"}], "]"}], ",", RowBox[{"\[Alpha]", "/", "2"}]}], "]"}], " ", "]"}]}], ",", RowBox[{"Print", "[", "\"\\"", "]"}], ",", RowBox[{"Print", "[", "\"\\"", "]"}]}], " ", "]"}], " ", ",", " ", "\[IndentingNewLine]", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"Abs", "[", "z2", "]"}], ">", RowBox[{"Abs", "[", RowBox[{"InverseCDF", "[", RowBox[{ RowBox[{"NormalDistribution", "[", RowBox[{"0", ",", "1"}], "]"}], ",", RowBox[{"\[Alpha]", "/", "2"}]}], "]"}], " ", "]"}]}], ",", RowBox[{"Print", "[", "\"\\"", "]"}], ",", RowBox[{"Print", "[", "\"\\"", "]"}]}], " ", "]"}]}], " ", "}"}], ";"}]}], " ", "\[IndentingNewLine]", "]"}]}]], "Input", CellChangeTimes->{{3.5883185367192445`*^9, 3.588318538391255*^9}, { 3.5883185751598716`*^9, 3.588318792755703*^9}, {3.5883189156094503`*^9, 3.588319170442686*^9}, {3.588319219571684*^9, 3.5883193869603047`*^9}, { 3.588319680374806*^9, 3.5883196881410627`*^9}, {3.588319991353236*^9, 3.588320221371953*^9}, {3.588320265375534*^9, 3.588320274813802*^9}, 3.5883203168640966`*^9, {3.588320361336466*^9, 3.5883203713841586`*^9}, { 3.5883205246466312`*^9, 3.5883205408979535`*^9}, {3.5883207133494864`*^9, 3.5883207939654217`*^9}, {3.588321702793827*^9, 3.588321706372243*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"soh", "[", RowBox[{"1", ",", "0.5", ",", "0.05"}], "]"}]], "Input", CellChangeTimes->{{3.588319174989932*^9, 3.5883191753180833`*^9}, { 3.58832024857729*^9, 3.5883202546402855`*^9}, {3.5883204169347415`*^9, 3.5883204187786417`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"a= \"\>", "\[InvisibleSpace]", "1.0170000000000001`", "\[InvisibleSpace]", "\<\"+-\"\>", "\[InvisibleSpace]", "0.018000000000000002`", "\[InvisibleSpace]", "\<\" b= \"\>", "\[InvisibleSpace]", "0.46`", "\[InvisibleSpace]", "\<\"+-\"\>", "\[InvisibleSpace]", "0.017`"}], SequenceForm[ "a= ", 1.0170000000000001`, "+-", 0.018000000000000002`, " b= ", 0.46, "+-", 0.017], Editable->False]], "Print", CellChangeTimes->{ 3.588320419591219*^9, {3.588320459219432*^9, 3.5883204711891537`*^9}, { 3.588320545992118*^9, 3.588320572244252*^9}, 3.588320728694482*^9, { 3.5883207766358833`*^9, 3.5883208355625525`*^9}, {3.5883216526334925`*^9, 3.588321662696811*^9}}], Cell[BoxData["\<\"a OK\"\>"], "Print", CellChangeTimes->{ 3.588320419591219*^9, {3.588320459219432*^9, 3.5883204711891537`*^9}, { 3.588320545992118*^9, 3.588320572244252*^9}, 3.588320728694482*^9, { 3.5883207766358833`*^9, 3.5883208355625525`*^9}, {3.5883216526334925`*^9, 3.588321662696811*^9}}], Cell[BoxData["\<\"b n\[ATilde]o passa\"\>"], "Print", CellChangeTimes->{ 3.588320419591219*^9, {3.588320459219432*^9, 3.5883204711891537`*^9}, { 3.588320545992118*^9, 3.588320572244252*^9}, 3.588320728694482*^9, { 3.5883207766358833`*^9, 3.5883208355625525`*^9}, {3.5883216526334925`*^9, 3.588321662696811*^9}}] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"soh", "[", RowBox[{"1.05", ",", "0.5", ",", "0.01"}], "]"}]], "Input", CellChangeTimes->{{3.5883216685722895`*^9, 3.588321683354745*^9}, { 3.5883217215141*^9, 3.5883217310304995`*^9}}], Cell[CellGroupData[{ Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"a= \"\>", "\[InvisibleSpace]", "1.`", "\[InvisibleSpace]", "\<\"+-\"\>", "\[InvisibleSpace]", "0.018000000000000002`", "\[InvisibleSpace]", "\<\" b= \"\>", "\[InvisibleSpace]", "0.49`", "\[InvisibleSpace]", "\<\"+-\"\>", "\[InvisibleSpace]", "0.017`"}], SequenceForm[ "a= ", 1., "+-", 0.018000000000000002`, " b= ", 0.49, "+-", 0.017], Editable->False]], "Print", CellChangeTimes->{{3.588321684011049*^9, 3.5883217497351465`*^9}}], Cell[BoxData["\<\"a n\[ATilde]o passa\"\>"], "Print", CellChangeTimes->{{3.588321684011049*^9, 3.5883217497351465`*^9}}], Cell[BoxData["\<\"b OK\"\>"], "Print", CellChangeTimes->{{3.588321684011049*^9, 3.5883217497507753`*^9}}] }, Open ]] }, Open ]] }, Open ]] }, WindowSize->{1435, 932}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, Magnification->1.4000000953674316`, 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, 115, 1, 77, "Subtitle"], Cell[697, 25, 94, 1, 118, "Section"] }, Open ]], Cell[CellGroupData[{ Cell[828, 31, 107, 1, 77, "Subtitle"], Cell[938, 34, 403, 11, 42, "Input"], Cell[CellGroupData[{ Cell[1366, 49, 170, 4, 42, "Input"], Cell[1539, 55, 97, 1, 41, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[1673, 61, 322, 9, 42, "Input"], Cell[1998, 72, 796, 24, 60, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[2831, 101, 534, 14, 42, "Input"], Cell[3368, 117, 638, 14, 41, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4043, 136, 751, 22, 42, "Input"], Cell[4797, 160, 375, 7, 41, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5209, 172, 145, 2, 42, "Input"], Cell[5357, 176, 96, 1, 41, "Output"] }, Open ]], Cell[5468, 180, 5681, 149, 367, "Input"], Cell[CellGroupData[{ Cell[11174, 333, 265, 5, 42, "Input"], Cell[CellGroupData[{ Cell[11464, 342, 746, 15, 31, "Print"], Cell[12213, 359, 309, 5, 31, "Print"], Cell[12525, 366, 324, 5, 31, "Print"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[12898, 377, 214, 4, 42, "Input"], Cell[CellGroupData[{ Cell[13137, 385, 506, 10, 31, "Print"], Cell[13646, 397, 121, 1, 31, "Print"], Cell[13770, 400, 106, 1, 31, "Print"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)