(* 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[ 9766, 296] NotebookOptionsPosition[ 9033, 267] NotebookOutlinePosition[ 9367, 282] CellTagsIndexPosition[ 9324, 279] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"prob", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"x1_", ",", "y1_"}], "}"}], ",", RowBox[{"{", RowBox[{"x2_", ",", "y2_"}], "}"}], ",", RowBox[{"{", RowBox[{"x3_", ",", "y3_"}], "}"}], ",", RowBox[{"{", RowBox[{"x4_", ",", "y4_"}], "}"}], ",", RowBox[{"{", RowBox[{"x5_", ",", "y5_"}], "}"}]}], "}"}], "]"}], ":=", RowBox[{ RowBox[{"Det", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", RowBox[{"Cos", "[", RowBox[{"2", "x1"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"x1", "+", "y1"}], "]"}], ",", RowBox[{"Cos", "[", RowBox[{"x1", "-", "y1"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"3", "y1"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Cos", "[", RowBox[{"2", "x2"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"x2", "+", "y2"}], "]"}], ",", RowBox[{"Cos", "[", RowBox[{"x2", "-", "y2"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"3", "y2"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Cos", "[", RowBox[{"2", "x3"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"x3", "+", "y3"}], "]"}], ",", RowBox[{"Cos", "[", RowBox[{"x3", "-", "y3"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"3", "y3"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Cos", "[", RowBox[{"2", "x4"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"x4", "+", "y4"}], "]"}], ",", RowBox[{"Cos", "[", RowBox[{"x4", "-", "y4"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"3", "y4"}], "]"}]}], "}"}], ",", "\[IndentingNewLine]", RowBox[{"{", RowBox[{"1", ",", RowBox[{"Cos", "[", RowBox[{"2", "x5"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"x5", "+", "y5"}], "]"}], ",", RowBox[{"Cos", "[", RowBox[{"x5", "-", "y5"}], "]"}], ",", RowBox[{"Sin", "[", RowBox[{"3", "y5"}], "]"}]}], "}"}]}], "}"}], "]"}], "^", "2"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ RowBox[{ RowBox[{"It", "'"}], "s", " ", "not", " ", "necessary", " ", "to", " ", "normalize", " ", "the", " ", "probability", " ", "density"}], ",", "\[IndentingNewLine]", RowBox[{ "since", " ", "the", " ", "sampleons", " ", "respond", " ", "only", " ", "to", " ", "relative", " ", RowBox[{ "probabilities", ".", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"Note", ":", " ", RowBox[{ "this", " ", "is", " ", "NOT", " ", "the", " ", "ground", " ", RowBox[{"state", "!"}]}]}], " ", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ "The", " ", "size", " ", "of", " ", "the", " ", "square", " ", "is", " ", "chosen", " ", "conveniently", " ", "to", " ", "be", " ", "2", RowBox[{"Pi", "."}]}]}]}]}]}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]"}]], "Input"], Cell[BoxData[ RowBox[{"randPoint", ":=", RowBox[{"RandomReal", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "\[Pi]"}], ",", "\[Pi]"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", "2"}], "}"}]}], "]"}]}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{".1", "randPoint"}]], "Input"], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0.24001326136709`", ",", RowBox[{"-", "0.007866300973662277`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.001797513339906587`", ",", RowBox[{"-", "0.3012756426914`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.07777250270918667`", ",", RowBox[{"-", "0.21870929378096202`"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0.11745581626337459`", ",", "0.29932110061148726`"}], "}"}], ",", RowBox[{"{", RowBox[{"0.202977493999966`", ",", RowBox[{"-", "0.25739884203666635`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.3984167078605843`*^9}] }, Open ]], Cell[BoxData[ RowBox[{"\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{"copies", "=", RowBox[{"2", "Pi", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"1", ",", "1"}], "}"}]}], "}"}]}]}], ";"}]}]], "Input"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"plotParticles", "[", "x_", "]"}], ":=", RowBox[{"Graphics", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"Disk", "[", RowBox[{"#", ",", ".2"}], "]"}], "&"}], ",", RowBox[{"Flatten", "[", RowBox[{ RowBox[{"Outer", "[", RowBox[{"Plus", ",", RowBox[{"Mod", "[", RowBox[{"x", ",", RowBox[{"2", "Pi"}]}], "]"}], ",", "copies", ",", "1"}], "]"}], ",", "1"}], "]"}]}], "]"}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}]}], "]"}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", " ", RowBox[{ "Plots", " ", "four", " ", "periodic", " ", "copies", " ", "of", " ", "the", " ", RowBox[{"configuration", "."}]}], " ", "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]"}]], "Input", CellChangeTimes->{{3.3984167321350307`*^9, 3.3984167487084*^9}}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"plotParticles", "[", "randPoint", "]"}]], "Input"], Cell[BoxData[ GraphicsBox[{DiskBox[{1.7932337770440192`, 5.7169122197435325`}, 0.2], DiskBox[{8.076419084223605, 5.7169122197435325`}, 0.2], DiskBox[{1.7932337770440192`, 12.000097526923119`}, 0.2], DiskBox[{8.076419084223605, 12.000097526923119`}, 0.2], DiskBox[{3.712753496777406, 2.096544531021326}, 0.2], DiskBox[{9.995938803956992, 2.096544531021326}, 0.2], DiskBox[{3.712753496777406, 8.379729838200912}, 0.2], DiskBox[{9.995938803956992, 8.379729838200912}, 0.2], DiskBox[{0.22321942003608441`, 2.211556097326511}, 0.2], DiskBox[{6.506404727215671, 2.211556097326511}, 0.2], DiskBox[{0.22321942003608441`, 8.494741404506097}, 0.2], DiskBox[{6.506404727215671, 8.494741404506097}, 0.2], DiskBox[{3.150172937080227, 5.05608841091175}, 0.2], DiskBox[{9.433358244259814, 5.05608841091175}, 0.2], DiskBox[{3.150172937080227, 11.339273718091336`}, 0.2], DiskBox[{9.433358244259814, 11.339273718091336`}, 0.2], DiskBox[{3.70315815929687, 5.770952640420052}, 0.2], DiskBox[{9.986343466476455, 5.770952640420052}, 0.2], DiskBox[{3.70315815929687, 12.054137947599639`}, 0.2], DiskBox[{9.986343466476455, 12.054137947599639`}, 0.2]}, AspectRatio->Automatic]], "Output", CellChangeTimes->{3.398416755955236*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"x", "=", "randPoint"}], ";", " ", RowBox[{"(*", " ", RowBox[{"initial", " ", "sampleon", " ", "configuration"}], " ", "*)"}]}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"attempts", "=", "100"}], ";"}], "\n", RowBox[{ RowBox[{"accept", "=", "0"}], ";"}], "\n", RowBox[{ RowBox[{"hopSize", "=", "0.1`"}], ";"}], "\n", RowBox[{ RowBox[{"Do", "[", RowBox[{ RowBox[{ RowBox[{"xNew", "=", RowBox[{"x", "+", RowBox[{"hopSize", " ", "randPoint"}]}]}], ";", RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{"RandomReal", "[", "]"}], "<", FractionBox[ RowBox[{"prob", "[", "xNew", "]"}], RowBox[{"prob", "[", "x", "]"}]]}], ",", RowBox[{ RowBox[{"x", "=", "xNew"}], ";", RowBox[{"++", "accept"}]}]}], "]"}], ";"}], ",", RowBox[{"{", "attempts", "}"}]}], "]"}], ";"}], "\n", RowBox[{"N", "[", FractionBox["accept", "attempts"], "]"}]}], "Input"], Cell[BoxData["0.58`"], "Output", CellChangeTimes->{3.398416782262781*^9}] }, Open ]] }, WindowSize->{916, 637}, WindowMargins->{{4, Automatic}, {Automatic, 4}}, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (June 19, 2007)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 3473, 92, 238, "Input"], Cell[4044, 115, 251, 8, 27, "Input"], Cell[CellGroupData[{ Cell[4320, 127, 53, 1, 27, "Input"], Cell[4376, 130, 663, 18, 43, "Output"] }, Open ]], Cell[5054, 151, 459, 14, 58, "Input"], Cell[5516, 167, 986, 27, 103, "Input"], Cell[CellGroupData[{ Cell[6527, 198, 74, 1, 27, "Input"], Cell[6604, 201, 1286, 22, 381, "Output"] }, Open ]], Cell[7905, 226, 183, 5, 27, "Input"], Cell[CellGroupData[{ Cell[8113, 235, 827, 26, 133, "Input"], Cell[8943, 263, 74, 1, 27, "Output"] }, Open ]] } ] *) (* End of internal cache information *)