Re: Non-mathematician ... please help: Spherical Harmonic Coefficients
- To: mathgroup at smc.vnet.net
- Subject: [mg38956] Re: [mg38932] Non-mathematician ... please help: Spherical Harmonic Coefficients
- From: Hugh Walker <hwalker at gvtc.com>
- Date: Tue, 21 Jan 2003 07:40:04 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On Sunday, January 19, 2003, at 11:45 PM, Alex S wrote: > hello dear everybody, > how to calculate Spherical Harmonic expansion Coefficients? > I am looking for an algorithm possibly for mathematica. > please help > thanks, > A > Hi Alex: The notebook below may be of some help. Just copy and paste into a Mathematica notebook. hw ======================= Notebook[{ Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`Expansion\ in\ Spherical\ Harmonics\)], \ "Subtitle", TextAlignment->Center], Cell[BoxData[ \(TraditionalForm\`Basics\)], "Subsubtitle"], Cell["\<\ Spherical harmonics are a set of complex orthonormal \ functions defined on the surface of the unit sphere. Mathematica \ furnishes a built-in function for their symbolic and numerical \ computation. Let \[Theta] and \[CurlyPhi] be the usual spherical \ polar and azimuthal angles, respectively, which sweep the entire \ surface for (0 < \[Theta] < \[Pi]) and (0 < \[CurlyPhi] < 2\[Pi]). \ These functions may be specified in Mathematica by \ \>", "Text"], Cell[BoxData[ \(TraditionalForm\`\(Y(l_, m_)\)\[InvisibleApplication] \((\[Theta]_, \[CurlyPhi]_)\) := \ \(Y\_l\%m\)(\[Theta], \[CurlyPhi])\)], "Input"], Cell["\<\ Here the index l is any positive integer zero or greater \ while the second index m is restricted, for a given value of l, to \ one or another of the values -l <= m <= l. Spherical harmonics are \ customarilydefined so that the complex congugate of Y[l,m] is given \ by (-1)^m Y[l, -m], and to have the orthogonality property that \ Integrate[(-1)^m Y[l , -m][\[Theta],\[CurlyPhi]] Y[l', m'] Sin[\ \[Theta]] {\[Theta], 0, \[Pi]}, {\[CurlyPhi], 0, 2\[Pi]}] gives zero \ unless both conditions l = l' and m = m' hold. If these conditions \ hold the integral yields 1. These are the conditions of \ orthonormality. After first executing the preceding function to load \ the program that computes a spherical harmonic, you might then verify \ the properties described above by executing the following cell.\ \>", \ "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(TraditionalForm\`Expansion\ of\ a\ Function\)], "Subsubtitle"], Cell["\<\ The properties given above permit a given function of the \ spherical polar angles to be represented as a (generally infinite) \ sum of of spherical harmonics, The {l, m)th expansion coefficients \ an arbitrary function f may be calculated by\ \>", "Text"], Cell[BoxData[ \(TraditionalForm\`\(coef(l_, m_)\)\[InvisibleApplication] \((f_)\) := \[Integral]\_0\%\ \[Pi]\(\[Integral]\_0\%\(2\ \[Pi]\)\((\(-1\))\)\^m\ \(Y( l, \(-m\))\)\[InvisibleApplication] \((\[Theta], \ \[CurlyPhi])\)\ f\ \(sin(\[Theta])\) \[DifferentialD]\[CurlyPhi] \ \[DifferentialD]\[Theta]\)\)], "Input"], Cell[BoxData[ \(TraditionalForm\`2\ l\ of\ set\ The + a\ coefficients\ for\ given\ is\ l\ such\ then\)], "Text"], Cell[BoxData[ \(TraditionalForm\`\(coefset( l_)\)\[InvisibleApplication] \((f_)\) := Table[\(coef(l, m)\)\[InvisibleApplication] \((f)\), {m, \(-l\), l}]\)], "Input"], Cell["\<\ For example, the expansion set for the function \ Cos[\[Theta]]^2 corresponding to l = 0, 1, and 2 are\ \>", "Text"], Cell[BoxData[ \(TraditionalForm\`TableForm[ Table[\(coefset( l)\)\[InvisibleApplication] \((\(cos\^2\)(\[Theta]))\), \ {l, 0, 3}]]\)], "Input"], Cell["\<\ You can check for yourself that these coefficients for this \ particular function are sufficient to furnish the original function \ exactly. This is certainly not true in general. Try some other f[\ \[Theta], \[CurlyPhi]]. \ \>", "Text"] }, Open ]] }, Open ]] }, FrontEndVersion->"4.1 for Macintosh", ScreenRectangle->{{0, 1024}, {0, 746}}, WindowSize->{555, 619}, WindowMargins->{{10, Automatic}, {46, Automatic}} ]