# Dieses Programm nutzt das Paket GSL von http://octave.sourceforge.net/

function y = Ylm(l,m,th,phi)
  if m>0
    y = sqrt((2*l+1)*factorial(l-m)/(4*pi*factorial(l+m)))*\
	legendre_Plm(l,m,cos(th)).*exp(i*m*phi);
  else
    y = (-1)^m*conj(sqrt((2*l+1)*factorial(l+m)/(4*pi*factorial(l-m)))*\
		    legendre_Plm(l,-m,cos(th)).*exp(-i*m*phi));
  endif
endfunction

vtk_clear
vtk_blackonwhite

[phi,theta] = meshgrid(linspace(0,2*pi,120), linspace(0,pi,60));

sh = Ylm(5,2,theta,phi);

r = abs(sh);
c = arg(sh);

x = r .* sin(theta) .* cos(phi);
y = r .* sin(theta) .* sin(phi);
z = r .* cos(theta);

vtk_surf(x,y,z,c);
