How can I program spherical harmonics in MATLAB?

Click For Summary
SUMMARY

This discussion focuses on programming spherical harmonics in MATLAB, specifically implementing the double summation formula for G(Ω₁, t₁ | Ω₀). The user seeks guidance on finding spherical harmonic functions in MATLAB, noting the absence of direct functions aside from Legendre polynomials. The conversation highlights the use of the diff(x, k) command for calculating higher-order derivatives, emphasizing the importance of careful numerical differentiation due to its local nature.

PREREQUISITES
  • Understanding of spherical harmonics and their mathematical definitions
  • Familiarity with MATLAB programming and syntax
  • Knowledge of numerical differentiation techniques
  • Basic concepts of double summation in mathematical programming
NEXT STEPS
  • Explore MATLAB's built-in functions for spherical harmonics
  • Research the implementation of double summation in MATLAB
  • Learn about numerical differentiation and its applications in MATLAB
  • Investigate recurrence relations for evaluating special functions
USEFUL FOR

Mathematics students, MATLAB programmers, and researchers working with spherical harmonics and numerical methods will benefit from this discussion.

scarecrow
Messages
139
Reaction score
0
I would appreciate some input about how to program spherical harmonics in Matlab.

http://mathworld.wolfram.com/SphericalHarmonic.html

I want to program a double summation that looks like this.

<br /> <br /> G(\Omega_{1},t_{1}|\Omega_{0}) = \sum_{l=0}^\infty \sum_{m=-l}^l \alpha^m_{l}(t_{1}) [\Gamma^m_{l}(\Omega_{0})]^* \Gamma^m_{l}(\Omega_{1})<br />

where \Gamma^m_{l}(\Omega_{i}) is a spherical harmonic and \alpha^m_{l} depends on l, m, and t.

Is there a spherical harmonic function in Matlab? I couldn't find anything except the Legendre polynomials.
 
Physics news on Phys.org
This is a follow up question. I'm a beginner in Matlab, so please excuse my ignorance if these questions seem stupid. How would you program higher-order derivatives into for loops? Is there a syntax in Matlab for higher-order derivatives?

for l = 0:5
for m = -l:l

\frac {d^{l+m}} {dx^{l+m}} (x^2-1)^l
 
Do a search on the MATLAB site, they have an abundance of code for you to look at...
 
Hey
Derivatives can be approximated by differences which is done by the command diff(x,k) where "x" is a vector and k is the order. Hence k=1 corresponds to the first order derivative of x.
Maybe this can help you further.
 
eys_physics said:
Hey
Derivatives can be approximated by differences which is done by the command diff(x,k) where "x" is a vector and k is the order. Hence k=1 corresponds to the first order derivative of x.
Maybe this can help you further.

True, but you have to be very very careful with numerical derivatives (they are a local entity as opposed to numerical integration which is more global in nature). Many special functions are better evaluated using recurrence relations.
 
thanks for the tips.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
7K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
3
Views
3K
  • · Replies 0 ·
Replies
0
Views
985