def lpn(n, z):
 if (not (isscalar(n) and isscalar(z))):
  raise ValueError('arguments must be scalars.')
 if ((n != floor(n)) or (n < 0)):
  raise ValueError('n must be a non-negative integer.')
 if (n < 1):
  n1 = 1
 else:
  n1 = n
 if iscomplex(z):
  (pn, pd) = specfun.clpn(n1, z)
 else:
  (pn, pd) = specfun.lpn(n1, z)
 return (pn[:(n + 1)], pd[:(n + 1)])

def lpn ( n , z ) : if ( not ( isscalar ( n ) and isscalar ( z ) ) ) : raise ValueError ( 'arguments must be scalars.' ) if ( ( n != floor ( n ) ) or ( n < 0 ) ) : raise ValueError ( 'n must be a non-negative integer.' ) if ( n < 1 ) : n1 = 1 else : n1 = n if iscomplex ( z ) : ( pn , pd ) = specfun . clpn ( n1 , z ) else : ( pn , pd ) = specfun . lpn ( n1 , z ) return ( pn [ : ( n + 1 ) ] , pd [ : ( n + 1 ) ] )
legendre function of the first kind .