function y=ylm(l,m,v1,v2)
% function y=ylm(l,m,v1,v2)
% Calculates the spherical harmonic:
%
%        Y_{l,m}(v1,v2),
%
% where v1 is the polar angle and v2 is the azimuthal angle.
%
% Uses: numleg.m
%
am = abs(m);
x=cos(v1);
prefac=sqrt((2*l+1)/(4*pi*prod(l-am+1:l+am)));
yold=(-1)^am*prefac.*numleg(l,am,x).*exp(i*am*v2);
if m >= 0 
 y=yold;
else
  y = (-1)^m*conj(yold);
end;
