def roots_legendre(n, mu=False):
 m = int(n)
 if ((n < 1) or (n != m)):
  raise ValueError('n must be a positive integer.')
 mu0 = 2.0
 an_func = (lambda k: (0.0 * k))
 bn_func = (lambda k: (k * np.sqrt((1.0 / (((4 * k) * k) - 1)))))
 f = cephes.eval_legendre
 df = (lambda n, x: (((((- n) * x) * cephes.eval_legendre(n, x)) + (n * cephes.eval_legendre((n - 1), x))) / (1 - (x ** 2))))
 return _gen_roots_and_weights(m, mu0, an_func, bn_func, f, df, True, mu)

def roots_legendre ( n , mu = False ) : m = int ( n ) if ( ( n < 1 ) or ( n != m ) ) : raise ValueError ( 'n must be a positive integer.' ) mu0 = 2.0 an_func = ( lambda k : ( 0.0 * k ) ) bn_func = ( lambda k : ( k * np . sqrt ( ( 1.0 / ( ( ( 4 * k ) * k ) - 1 ) ) ) ) ) f = cephes . eval_legendre df = ( lambda n , x : ( ( ( ( ( - n ) * x ) * cephes . eval_legendre ( n , x ) ) + ( n * cephes . eval_legendre ( ( n - 1 ) , x ) ) ) / ( 1 - ( x ** 2 ) ) ) ) return _gen_roots_and_weights ( m , mu0 , an_func , bn_func , f , df , True , mu )
gauss-legendre quadrature .