Spherical Harmonic summary
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: Spherical Harmonic summary
- From: prs at cook.whoi.edu (Peter R. Shaw)
- Date: Mon, 1 Oct 90 09:25:09 EDT
Thanks to everyone who responded to my query about evaluating the spherical harmonic function Ylm for theta=0 and phi=0. Given the way mathematica evaluates expressions, the most stable way to obtain this result is to use: SphericalHarmonicY[2,0,theta,phi] /. {theta->0, phi->0} (Several people pointed out variations of this command). John Schmidt writes that Wolfram acknowledges the error messages when asking for expressions like SphericalHarmonicY[2,0,0,0] be a bug, which may get fixed in a future release. Meanwhile, I have discovered that when I ask for the *plot*, say, using the command: Plot[{ SphericalHarmonicY[2,0,theta,phi] /.phi->0 }, {theta,0,Pi}] Mathematica barfs up a few complaints, and then goes on to draw the correct plot, presumably applying a limiting algorithm at theta->0. This also happens for the simpler command: Plot[SphericalHarmonicY[2,0,theta,0], {theta,0,Pi}] . By the way, what I'm using all this for is to make animations of Earth's free oscillations from an earthquake, for my class in Geophysics. If anybody wants to see the 1st Toroidal mode of oscillation, run this script, and then animate it (on the Macintosh): <<ParametricPlot3D.m w=.3; l:=2; m:=0; ylm:=SphericalHarmonicY[l,m,theta,phi]; utheta:=(w/Sin[theta]) D[ylm,phi]; uphi:=-w D[ylm,theta]; Do[ A:= .2; amp:=A Cos[tphase]; u:=theta+amp utheta; v:=phi+amp uphi; ParametricPlot3D[ {Sin[u] Cos[v], Sin[u] Sin[v], Cos[u]}, {theta, 0, Pi, Pi/15}, {phi,0,2Pi,Pi/15}, BoxRatios->{1,1,1}, PlotRange->{{-1,1},{-1,1},{-1,1}}, ViewPoint->{2.872, 1.166, 1.356}], {tphase,0,Pi,Pi/4}] --------------------------------------------- Peter R. Shaw pshaw at aqua.whoi.edu Woods Hole Oceanographic Institution ---------------------------------------------