(n, x=None, **args)
Generates Legendre polynomial of degree `n` in `x`.
Generates Legendre polynomial of degree `n` in `x`.
Generates Legendre polynomial of degree n in x .
def legendre_poly(n, x=None, **args):
    """Generates Legendre polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Legendre polynomial of degree %s" % n)

    poly = DMP(dup_legendre(int(n), QQ), QQ)

    if x is not None:
        poly = Poly.new(poly, x)
    else:
        poly = PurePoly.new(poly, Dummy('x'))

    if not args.get('polys', False):
        return poly.as_expr()
    else:
        return poly
def legendre_poly ( n , x = None , * * args ) : if n < 0 : raise ValueError ( "can't generate Legendre polynomial of degree %s" % n ) poly = DMP ( dup_legendre ( int ( n ) , QQ ) , QQ ) if x is not None : poly = Poly . new ( poly , x ) else : poly = PurePoly . new ( poly , Dummy ( 'x' ) ) if not args . get ( 'polys' , False ) : return poly . as_expr ( ) else : return poly