(* 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[ 17467, 540] NotebookOptionsPosition[ 16630, 512] NotebookOutlinePosition[ 16974, 527] CellTagsIndexPosition[ 16931, 524] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[TextData[{ " ", StyleBox["Linear Combinations of Spherical Harmonics\n\n", FontWeight->"Bold"], StyleBox["by Corinne Manogue and Kerry Browne\nCopyright 2010 Corinne \ Manogue\n\n\n", FontSize->24, FontWeight->"Bold", FontSlant->"Italic"], StyleBox["In this worksheet, you will examine combinations of the spherical \ harmonics, ", FontSize->22], Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ SubscriptBox["Y", RowBox[{"l", ",", "m"}]], "(", RowBox[{"\[Theta]", ",", "\[Phi]"}], ")"}], FontSize->24], TraditionalForm]], FormatType->"TraditionalForm"], StyleBox[".", FontSize->24] }], "Text", CellChangeTimes->{{3.5208650653242784`*^9, 3.5208652661889935`*^9}}, FontSize->36], Cell[BoxData[{ StyleBox[ RowBox[{"Clear", "[", RowBox[{ "n", ",", "l", ",", "m", ",", "Zq", ",", "a0", ",", "ALegendre", ",", "ylmsumsq"}], "]"}], FontSize->18], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{"Assumptions", "\[Rule]", RowBox[{"Element", "[", RowBox[{"\[Theta]", ",", "Reals"}], "]"}]}], ";"}], FontSize->18], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{"Assumptions", "->", RowBox[{"Element", "[", RowBox[{"\[Phi]", ",", "Reals"}], "]"}]}], ";"}], FontSize->18], "\[IndentingNewLine]"}], "Input", CellChangeTimes->{{3.5208653360760403`*^9, 3.5208653562468824`*^9}, { 3.5208653906982436`*^9, 3.5208655750638037`*^9}, {3.5208657961618576`*^9, 3.5208657994273157`*^9}, {3.5208690731815653`*^9, 3.520869079868723*^9}}], Cell[TextData[{ StyleBox["First we define the ", FontSize->22], Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ SubscriptBox["Y", RowBox[{"l", ",", "m"}]], "(", RowBox[{"\[Theta]", ",", "\[Phi]"}], ")"}], FontSize->24], TraditionalForm]], FormatType->"TraditionalForm"], StyleBox[", just as we did in the previous worksheet:", FontSize->22] }], "Text", CellChangeTimes->{{3.5208655941722*^9, 3.5208656794959564`*^9}}], Cell[BoxData[{ StyleBox[ RowBox[{ RowBox[{"ALegendre", "[", RowBox[{"l__", ",", "m__"}], "]"}], "=", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", RowBox[{"z", "^", "2"}]}], ")"}], "^", RowBox[{"(", RowBox[{ RowBox[{"Abs", "[", "m", "]"}], "/", "2"}], ")"}]}], "*", RowBox[{"D", "[", RowBox[{ RowBox[{"LegendreP", "[", RowBox[{"l", ",", "z"}], "]"}], ",", RowBox[{"{", RowBox[{"z", ",", RowBox[{"Abs", "[", "m", "]"}]}], "}"}]}], "]"}]}]}], FontSize->18], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{"nrm", "[", RowBox[{"l__", ",", "m__"}], "]"}], "=", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"-", "1"}], ")"}], "^", RowBox[{"(", RowBox[{ RowBox[{"(", RowBox[{"m", "+", RowBox[{"Abs", "[", "m", "]"}]}], ")"}], "/", "2"}], ")"}]}], "*", RowBox[{"Sqrt", "[", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"2", "*", "l"}], "+", "1"}], ")"}], "*", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"l", "-", RowBox[{"Abs", "[", "m", "]"}]}], ")"}], "!"}], "/", RowBox[{"(", RowBox[{"4", "*", "Pi", "*", RowBox[{ RowBox[{"(", RowBox[{"l", "+", RowBox[{"Abs", "[", "m", "]"}]}], ")"}], "!"}]}], ")"}]}]}], "]"}]}]}], FontSize->18], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{"Ylm", "[", RowBox[{"l__", ",", "m__"}], "]"}], "=", RowBox[{ RowBox[{"nrm", "[", RowBox[{"l", ",", "m"}], "]"}], "*", RowBox[{ RowBox[{"(", RowBox[{"1", "-", RowBox[{ RowBox[{"Cos", "[", "\[Theta]", "]"}], "^", "2"}]}], ")"}], "^", RowBox[{"(", RowBox[{ RowBox[{"Abs", "[", "m", "]"}], "/", "2"}], ")"}]}], "*", RowBox[{"D", "[", RowBox[{ RowBox[{"LegendreP", "[", RowBox[{"l", ",", RowBox[{"Cos", "[", "\[Theta]", "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Cos", "[", "\[Theta]", "]"}], ",", RowBox[{"Abs", "[", "m", "]"}]}], "}"}]}], "]"}], "*", RowBox[{"Exp", "[", RowBox[{"I", "*", "m", "*", "\[Phi]"}], "]"}]}]}], FontSize->18]}], "Input", CellChangeTimes->{{3.5208657895840693`*^9, 3.520866092802919*^9}, { 3.5208661270667896`*^9, 3.5208661467845297`*^9}, 3.5209443992745934`*^9}], Cell[TextData[{ "\n", StyleBox["Choose a sum of ", FontSize->22], Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ SubscriptBox["Y", RowBox[{"l", ",", "m"}]], "(", RowBox[{"\[Theta]", ",", "\[Phi]"}], ")"}], FontSize->24], TraditionalForm]], FormatType->"TraditionalForm"], StyleBox["'s:\n", FontSize->22] }], "Text", CellChangeTimes->{{3.520866211687457*^9, 3.520866281590128*^9}}], Cell[BoxData[ StyleBox[ RowBox[{"ylmsum", "=", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "/", RowBox[{"Sqrt", "[", "2", "]"}]}], ")"}], "*", RowBox[{"Ylm", "[", RowBox[{"1", ",", "1"}], "]"}]}], "+", RowBox[{ RowBox[{"(", RowBox[{"1", "/", RowBox[{"Sqrt", "[", "2", "]"}]}], ")"}], "*", RowBox[{"Ylm", "[", RowBox[{"1", ",", RowBox[{"-", "1"}]}], "]"}]}]}]}], FontSize->18]], "Input", CellChangeTimes->{{3.52086630135474*^9, 3.520866326994053*^9}, { 3.5208663718511305`*^9, 3.5208663797726*^9}}], Cell[BoxData["\[IndentingNewLine]"], "Input", CellChangeTimes->{3.5208664587060585`*^9}], Cell[TextData[{ StyleBox["Next, \"square\" the sum of the ", FontSize->22], Cell[BoxData[ FormBox[ StyleBox[ RowBox[{ RowBox[{ RowBox[{ SubscriptBox["Y", RowBox[{"l", ",", "m"}]], "(", RowBox[{"\[Theta]", ",", "\[Phi]"}], ")"}], "'"}], "s"}], FontSize->24], TraditionalForm]], FormatType->"TraditionalForm"], StyleBox[":\n", FontSize->22] }], "Text", CellChangeTimes->{{3.5208664695648775`*^9, 3.5208665363583326`*^9}}], Cell[BoxData[ StyleBox[ RowBox[{ RowBox[{"ylmsumsq", "[", RowBox[{"\[Theta]__", ",", "\[Phi]__"}], "]"}], "=", RowBox[{"Simplify", "[", RowBox[{"ComplexExpand", "[", RowBox[{ RowBox[{"Conjugate", "[", "ylmsum", "]"}], "*", "ylmsum"}], "]"}], "]"}]}], FontSize->18]], "Input", CellChangeTimes->{{3.520866577074998*^9, 3.5208666019643483`*^9}, { 3.5208666665547915`*^9, 3.520866721426982*^9}, {3.520869053901303*^9, 3.5208690678693376`*^9}}], Cell[TextData[{ StyleBox["Plot ", FontSize->22], Cell[BoxData[ FormBox[ StyleBox[ RowBox[{"|", RowBox[{ SubscriptBox["Y", RowBox[{"l", ",", "m"}]], "(", RowBox[{"\[Theta]", ",", "\[Phi]"}], ")"}], SuperscriptBox["|", "2"]}], FontSize->24], TraditionalForm]], FormatType->"TraditionalForm"], ", ", StyleBox["on a sphere, coloring the surface with the value of the \ probability density.\n", FontSize->22] }], "Text", CellChangeTimes->{{3.5208667666746645`*^9, 3.5208668992616262`*^9}}], Cell[BoxData[ StyleBox[ RowBox[{"\[IndentingNewLine]", RowBox[{"SphericalPlot3D", "[", RowBox[{"1", ",", RowBox[{"{", RowBox[{"\[Theta]", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Phi]", ",", "0", ",", RowBox[{"2", "*", "Pi"}]}], "}"}], ",", RowBox[{"PlotPoints", " ", "\[Rule]", " ", "30"}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"Function", "[", RowBox[{ RowBox[{"{", RowBox[{ "x", ",", "y", ",", "z", ",", "\[Theta]", ",", "\[Phi]", ",", "r"}], "}"}], ",", RowBox[{"Hue", "[", RowBox[{"ylmsumsq", "[", RowBox[{"\[Theta]", ",", "\[Phi]"}], "]"}], "]"}]}], "]"}]}], ",", RowBox[{"ColorFunctionScaling", "\[Rule]", "False"}], ",", RowBox[{"ViewPoint", "\[Rule]", RowBox[{"{", RowBox[{"2.6", ",", " ", "0", ",", " ", "1.4"}], "}"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"Boxed", "\[Rule]", "False"}], ",", RowBox[{"Mesh", "\[Rule]", "False"}]}], "]"}]}], FontSize->18]], "Input", CellChangeTimes->{{3.5208669046832237`*^9, 3.5208670134276557`*^9}, { 3.5208680387970285`*^9, 3.520868043781149*^9}, {3.520868881128899*^9, 3.5208689669370055`*^9}, {3.520868997372947*^9, 3.5208690054037857`*^9}, { 3.5208691049455643`*^9, 3.520869114991925*^9}, {3.520869153458705*^9, 3.520869162192633*^9}, {3.5208733502231045`*^9, 3.5208734048140593`*^9}, { 3.5208735209331136`*^9, 3.520873528979576*^9}, {3.520873616631338*^9, 3.5208736617852764`*^9}, {3.520873997893067*^9, 3.520874045265641*^9}, { 3.520874336078876*^9, 3.5208743545779285`*^9}, {3.5208750621042013`*^9, 3.5208751706923914`*^9}, {3.5208752790462184`*^9, 3.5208753064666896`*^9}, {3.5208757237890716`*^9, 3.520875777301956*^9}, { 3.520876042632121*^9, 3.520876048584941*^9}, {3.520876222326045*^9, 3.520876254386904*^9}, {3.52087670951985*^9, 3.5208767301594176`*^9}, { 3.520878130884572*^9, 3.520878181772591*^9}, {3.5208782848141904`*^9, 3.520878308266114*^9}, {3.5208783707785387`*^9, 3.520878430791091*^9}, { 3.5208838417796593`*^9, 3.5208839101511583`*^9}, {3.520883974038512*^9, 3.520883981944357*^9}, {3.520884089970076*^9, 3.5208841269369335`*^9}, { 3.5208841929648027`*^9, 3.5208841955896683`*^9}, {3.5208842277286477`*^9, 3.5208842579770985`*^9}, {3.520884310896264*^9, 3.5208843585813227`*^9}, { 3.520884466450799*^9, 3.520884481262541*^9}, {3.5208845474622765`*^9, 3.5208846122870817`*^9}, {3.5208846795023904`*^9, 3.5208847264218636`*^9}, {3.5208849442700834`*^9, 3.5208850111885324`*^9}, 3.520885057045559*^9, 3.520885395700094*^9, {3.520944480692299*^9, 3.5209446255442576`*^9}, {3.520944729898289*^9, 3.520944780583194*^9}, { 3.52094499979072*^9, 3.5209449999000893`*^9}, {3.520945179828377*^9, 3.5209452227011814`*^9}, {3.5209453801931176`*^9, 3.520945408254181*^9}, { 3.520945918478056*^9, 3.520945955538658*^9}, {3.5209460690797195`*^9, 3.5209461649966836`*^9}, {3.5209462111661944`*^9, 3.5209462503204393`*^9}, {3.520946612426899*^9, 3.520946646550152*^9}, { 3.520946827993986*^9, 3.5209468287127*^9}, {3.5209492364019194`*^9, 3.5209492392142754`*^9}, {3.520949278712253*^9, 3.5209492789153676`*^9}, 3.5209493337250614`*^9}], Cell[BoxData[ StyleBox[ RowBox[{"SphericalPlot3D", "[", RowBox[{ RowBox[{"ylmsumsq", "[", RowBox[{"\[Theta]", ",", "\[Phi]"}], "]"}], ",", RowBox[{"{", RowBox[{"\[Phi]", ",", "0", ",", RowBox[{"2", "*", "Pi"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"ColorFunction", "\[Rule]", RowBox[{"Function", "[", RowBox[{ RowBox[{"{", RowBox[{ "x", ",", "y", ",", "z", ",", "\[Theta]", ",", "\[Phi]", ",", "r"}], "}"}], ",", RowBox[{"Hue", "[", RowBox[{"ylmsumsq", "[", RowBox[{"\[Theta]", ",", "\[Phi]"}], "]"}], "]"}]}], "]"}]}], ",", RowBox[{"ColorFunctionScaling", "\[Rule]", "False"}], ",", RowBox[{"ViewPoint", "\[Rule]", RowBox[{"{", RowBox[{"2.6", ",", " ", "0", ",", " ", "1.4"}], "}"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"Boxed", "\[Rule]", "False"}], ",", RowBox[{"Mesh", "\[Rule]", "False"}]}], "]"}], FontSize->18]], "Input", CellChangeTimes->{{3.5208698243306046`*^9, 3.520869899670497*^9}, { 3.5208736756751904`*^9, 3.5208737596396413`*^9}, {3.5208738299172926`*^9, 3.520873866649787*^9}, {3.5208739409741063`*^9, 3.5208739894716234`*^9}, { 3.5208744157466717`*^9, 3.5208744265273695`*^9}, {3.5208760593500147`*^9, 3.520876098457388*^9}, {3.520876307181075*^9, 3.520876319336703*^9}, { 3.5208784468527684`*^9, 3.5208784757106657`*^9}, {3.520879970384135*^9, 3.520879983102234*^9}, {3.5209462739911027`*^9, 3.520946364423972*^9}, { 3.5209463964223337`*^9, 3.52094652110345*^9}, {3.5209465592264977`*^9, 3.5209466029273853`*^9}, {3.520949243057829*^9, 3.5209492464326563`*^9}, { 3.520949303851591*^9, 3.5209493173508997`*^9}}], Cell[BoxData[ StyleBox[ RowBox[{"DensityPlot", "[", RowBox[{ RowBox[{"ylmsumsq", "[", RowBox[{"\[Theta]", ",", "\[Phi]"}], "]"}], ",", RowBox[{"{", RowBox[{"\[Phi]", ",", "0", ",", RowBox[{"2", "*", "Pi"}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]", ",", "0", ",", "Pi"}], "}"}], ",", RowBox[{"ColorFunction", "\[Rule]", "\"\\""}]}], "]"}], FontSize->18]], "Input", CellChangeTimes->{{3.520867020333552*^9, 3.520867095189094*^9}, { 3.5208671501862783`*^9, 3.520867174497533*^9}, {3.5208683571088552`*^9, 3.52086847918073*^9}, {3.520868589159474*^9, 3.520868591065626*^9}, { 3.520868781712115*^9, 3.5208688405841007`*^9}, {3.520869660526492*^9, 3.5208697663804474`*^9}}], Cell[TextData[{ "\n", StyleBox["Try some of the following linear combinations. Note: \[Delta] is \ an arbitrary phase constant you can set to any value.\n\n", FontSize->22], Cell[BoxData[ FormBox[ FractionBox["1", SqrtBox["2"]], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox["(", FontSize->24], Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["Y", RowBox[{"1", ",", "1"}]], "+", SubscriptBox["Y", RowBox[{"1", ",", RowBox[{"-", "1"}]}]]}], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox[")", FontSize->24], "\n\n", Cell[BoxData[ FormBox[ FractionBox["1", SqrtBox["2"]], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox["(", FontSize->24], Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["Y", RowBox[{"1", ",", "1"}]], "-", SubscriptBox["Y", RowBox[{"1", ",", RowBox[{"-", "1"}]}]]}], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox[")", FontSize->24], "\n\n", Cell[BoxData[ FormBox[ FractionBox["1", SqrtBox["2"]], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox["(", FontSize->24], Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["Y", RowBox[{"1", ",", "1"}]], "+", RowBox[{ SuperscriptBox["e", "I\[Delta]"], SubscriptBox["Y", RowBox[{"1", ",", RowBox[{"-", "1"}]}]]}]}], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox[")", FontSize->24], "\n\n", Cell[BoxData[ FormBox[ FractionBox["1", SqrtBox["2"]], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox["(", FontSize->24], Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["Y", RowBox[{"0", ",", "0"}]], "+", SubscriptBox["Y", RowBox[{"1", ",", "0"}]]}], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox[")", FontSize->24], "\n\n", Cell[BoxData[ FormBox[ FractionBox["1", SqrtBox["2"]], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox["(", FontSize->24], Cell[BoxData[ FormBox[ RowBox[{ SubscriptBox["Y", RowBox[{"2", ",", "2"}]], "+", RowBox[{ SuperscriptBox["e", "I\[Delta]"], SubscriptBox["Y", RowBox[{"2", ",", RowBox[{"-", "2"}]}]]}]}], TraditionalForm]], FormatType->"TraditionalForm", FontSize->24], StyleBox[")", FontSize->24] }], "Text", CellChangeTimes->{{3.5208672065115194`*^9, 3.5208672998661137`*^9}, { 3.5208674112041636`*^9, 3.5208677544990854`*^9}}], Cell[BoxData[""], "Input", CellChangeTimes->{{3.52087866195113*^9, 3.5208786680133195`*^9}, 3.5208787416189256`*^9, {3.520878957576618*^9, 3.520878974060149*^9}, { 3.520879177159125*^9, 3.520879177721596*^9}, {3.520879605824676*^9, 3.520879621808233*^9}, {3.5208797082569313`*^9, 3.5208797341618547`*^9}, 3.52087994372925*^9, 3.5208847776067424`*^9}], Cell[BoxData[""], "Input", CellChangeTimes->{3.520885370295145*^9}] }, WindowSize->{1272, 922}, 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[545, 20, 753, 25, 256, "Text"], Cell[1301, 47, 803, 21, 92, "Input"], Cell[2107, 70, 452, 15, 43, "Text"], Cell[2562, 87, 2452, 80, 77, "Input"], Cell[5017, 169, 417, 16, 89, "Text"], Cell[5437, 187, 592, 19, 36, "Input"], Cell[6032, 208, 89, 1, 52, "Input"], Cell[6124, 211, 477, 17, 71, "Text"], Cell[6604, 230, 484, 13, 36, "Input"], Cell[7091, 245, 541, 19, 74, "Text"], Cell[7635, 266, 3338, 59, 118, "Input"], Cell[10976, 327, 1791, 38, 91, "Input"], Cell[12770, 367, 752, 17, 36, "Input"], Cell[13525, 386, 2661, 114, 352, "Text"], Cell[16189, 502, 366, 5, 31, "Input"], Cell[16558, 509, 68, 1, 31, "Input"] } ] *) (* End of internal cache information *)