<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Shijie,<div><br></div><div>Yes this is very helpful. Its wasn't clear to me that by including the normalization factor</div><div>in the recursion relation that would lead to the extra factors. I tried to back this</div><div>out from the code, but its sometimes harder to go backwards, especially with the factorials</div><div>and the !! terms.</div><div><br></div><div>Thank you for spending the time on this. I'll work through the math to make sure I follow each</div><div>step. I also think it would be good to have CIG add you one page explanation to the documentation for the geoid in CitcomS since&nbsp;it is not derived elsewhere. Along with a note specifying to the user that they must use the&nbsp;same modified legendre polynmials in expanding the geoid coefficients from CitcomS to make&nbsp;a map of the geoid (i.e., reading these into matlab and using their legendre functions won't work).</div><div><br></div><div>Thanks again,</div><div>Magali</div><div><br></div><div><br><div><div>On Mar 4, 2010, at 11:48 AM, Shijie Zhong wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>Magali and Joy,<br><br>I could not find my original note on computing spherical harmonic functions <br>anymore this morning. The original note was made when I was working on <br>CitcomS in 1997 at ANU on a visit to Geoff Davies. I spent sometime this <br>morning to re-derive them, and I compared with the code in CitcomS. <br><br>I once ran into Bill Press (the author for Numerical Recipes) at a small <br>conference in 2006. I mentioned to him about computing harmonic functions. <br>He asked me to send him my notes. I remembered having done something after <br>the meeting. It seems that what I did was to lose my original notes (buried <br>somewhere in my office) -- I did not get back to Press for this for some <br>reasons. <br><br>Hopefully, you and Joy will find the note useful in reading the code.<br><br><br>Shijie<br><br>Shijie Zhong<br>Department of Physics<br>University of Colorado at Boulder<br>Boulder, CO 80309<br>Tel: 303-735-5095; Fax: 303-492-7935<br>Web: <a href="http://anquetil.colorado.edu/szhong">http://anquetil.colorado.edu/szhong</a><br><br>---- Original message ----<br><blockquote type="cite">Date: Thu, &nbsp;4 Mar 2010 12:37:44 -0700 (MST)<br></blockquote><blockquote type="cite">From: Shijie Zhong &lt;<a href="mailto:Shijie.Zhong@Colorado.Edu">Shijie.Zhong@Colorado.Edu</a>&gt; &nbsp;<br></blockquote><blockquote type="cite">Subject: Re: [CIG-MC] computing spherical harmonic functions, and CitcomS <br></blockquote>Legendre polynomial normalization &nbsp;<br><blockquote type="cite">To: "Magali Billen" &lt;<a href="mailto:mibillen@ucdavis.edu">mibillen@ucdavis.edu</a>&gt;,"Shijie Zhong" <br></blockquote>&lt;<a href="mailto:Shijie.Zhong@Colorado.Edu">Shijie.Zhong@Colorado.Edu</a>&gt;<br><blockquote type="cite">Cc: "Joy Hines" &lt;<a href="mailto:jmhines@ucdavis.edu">jmhines@ucdavis.edu</a>&gt;,<a href="mailto:cig-mc@geodynamics.org">cig-mc@geodynamics.org</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I am not sure how many people would be interested in this kind of stuff, but I <br></blockquote><blockquote type="cite">send it to cig-mc anyway. Some of you may find it useful if you want to write <br></blockquote><blockquote type="cite">your own spherical harmonic function/expansion code. While Press' Numerical <br></blockquote><blockquote type="cite">Recipes book gives a nice code for computing the Legendre functions, it is not <br></blockquote><blockquote type="cite">as straightforward to compute spherical harmonic functions. &nbsp;&nbsp;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Shijie Zhong<br></blockquote><blockquote type="cite">Department of Physics<br></blockquote><blockquote type="cite">University of Colorado at Boulder<br></blockquote><blockquote type="cite">Boulder, CO 80309<br></blockquote><blockquote type="cite">Tel: 303-735-5095; Fax: 303-492-7935<br></blockquote><blockquote type="cite">Web: <a href="http://anquetil.colorado.edu/szhong">http://anquetil.colorado.edu/szhong</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">---- Original message ----<br></blockquote><blockquote type="cite"><blockquote type="cite">Date: Wed, 3 Mar 2010 17:26:21 -0800<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">From: Magali Billen &lt;<a href="mailto:mibillen@ucdavis.edu">mibillen@ucdavis.edu</a>&gt; &nbsp;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Subject: Re: [CIG-MC] CitcomS Legendre polynomial normalization &nbsp;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">To: Shijie Zhong &lt;<a href="mailto:Shijie.Zhong@Colorado.Edu">Shijie.Zhong@Colorado.Edu</a>&gt;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Cc: "Joy Hines" &lt;<a href="mailto:jmhines@ucdavis.edu">jmhines@ucdavis.edu</a>&gt;,<a href="mailto:cig-mc@geodynamics.org">cig-mc@geodynamics.org</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Hello Shijie,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Yes, its the factors in the recursion relationship<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;that we were surprised to find, as the rest the <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;recursion relationship steps are the same as that in<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Numerical recipes...I'm glad to know that this<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;is stable for large L as we'll be going up to about<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;L=360. Any chance that there's a reference<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;for the recursion relationship (or maybe point us in<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;the right direction, we've looked up several others<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;and haven't found the same thing)? No hurry, but it<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;seems like this is a good thing to have reference<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;for general<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;CitcomS background information too.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Thanks for answering our e-mail so quickly,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Magali<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;On Mar 3, 2010, at 5:13 PM, Shijie Zhong wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;You are right that the recursion relation for the<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;Legendre polynomials used in <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;CitcomS is different from the standard in<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;Numerical Recipes by Press. The <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;standard one in Numerical Recipes blows up for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;spherical harmonic degree l &gt; <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;20 or something, even with double precision<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;computation. I re-derived a <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;recursion relation in 1997 that is stable for<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;nearly all l's and is used in CitcomS. <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;-----------------------------<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Associate Professor, U.C. Davis<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Department of Geology/KeckCAVEs<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Earth &amp; Physical Sciences Bldg, rm 2129<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;Davis, CA 95616<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;-----------------<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;<a href="mailto:mibillen@ucdavis.edu">mibillen@ucdavis.edu</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;(530) 754-5696<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;--------------------------<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;** Note new e-mail, building, office<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;information as of Sept. 2009 **<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> &nbsp;-----------------------------<br></blockquote></blockquote><blockquote type="cite">________________<br></blockquote><blockquote type="cite">modified_Legendre_functions.pdf (421k bytes)<br></blockquote></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>-----------------------------</div><div>Associate Professor,&nbsp;U.C. Davis</div><div>Department of Geology/KeckCAVEs</div><div>Earth &amp; Physical Sciences Bldg, rm 2129</div><div>Davis, CA 95616</div><div>-----------------</div><div><a href="mailto:mibillen@ucdavis.edu">mibillen@ucdavis.edu</a></div><div>(530) 754-5696</div><div><b>--------------------------</b></div><div><b>** Note new e-mail, building, office</b></div><div><b>&nbsp;&nbsp; &nbsp;information as of Sept. 2009 **</b></div><div>-----------------------------</div></div></div></span></div></span></div></span> </div><br></div></body></html>