@public
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

@ public 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
generates legendre polynomial of degree n in x .