File: spherharm44.py

package info (click to toggle)
mpmath 1.4.0~a6-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,556 kB
  • sloc: python: 47,434; makefile: 22
file content (14 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from mpmath import fp

# Real part of spherical harmonic Y_(4,4)(theta,phi)
def Y(l,m):
    def g(theta,phi):
        R = abs(fp.re(fp.spherharm(l,m,theta,phi)))
        x = R*fp.cos(phi)*fp.sin(theta)
        y = R*fp.sin(phi)*fp.sin(theta)
        z = R*fp.cos(theta)
        return [x,y,z]
    return g

fp.splot(Y(4,4), [0,fp.pi], [0,2*fp.pi], points=300,
    dpi=45, file="spherharm44.png")