Exemple #1
0
def cyclotomic_poly(n, x=None, **args):
    """Generates cyclotomic polynomial of order `n` in `x`. """
    if n <= 0:
        raise ValueError("can't generate cyclotomic polynomial of order %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Dummy('x')

    poly = Poly(DMP(dup_zz_cyclotomic_poly(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #2
0
def hermite_poly(n, x=None, **args):
    """Generates Hermite polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Hermite polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Symbol('x', dummy=True)

    poly = Poly(DMP(dup_hermite(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
def cyclotomic_poly(n, x=None, **args):
    """Generates cyclotomic polynomial of order `n` in `x`. """
    if n <= 0:
        raise ValueError("can't generate cyclotomic polynomial of order %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Symbol('x', dummy=True)

    poly = Poly(DMP(dup_zz_cyclotomic_poly(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #4
0
def hermite_poly(n, x=None, **args):
    """Generates Hermite polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Hermite polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Dummy('x')

    poly = Poly(DMP(dup_hermite(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #5
0
def chebyshevu_poly(n, x=None, **args):
    """Generates Chebyshev polynomial of the second kind of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate 2nd kind Chebyshev polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Dummy('x')

    poly = Poly(DMP(dup_chebyshevu(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #6
0
def laguerre_poly(n, x=None, **args):
    """Generates Laguerre polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Laguerre polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Dummy('x')

    poly = Poly(DMP(dup_laguerre(int(n), QQ), QQ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #7
0
def chebyshevt_poly(n, x=None, **args):
    """Generates Chebyshev polynomial of the first kind of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate 1st kind Chebyshev polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Symbol('x', dummy=True)

    poly = Poly(DMP(dup_chebyshevt(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #8
0
def laguerre_poly(n, x=None, **args):
    """Generates Laguerre polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Laguerre polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Symbol('x', dummy=True)

    poly = Poly(DMP(dup_laguerre(int(n), QQ), QQ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly
Exemple #9
0
def chebyshevt_poly(n, x=None, **args):
    """Generates Chebyshev polynomial of the first kind of degree `n` in `x`. """
    if n < 0:
        raise ValueError(
            "can't generate 1st kind Chebyshev polynomial of degree %s" % n)

    if x is not None:
        x = sympify(x)
    else:
        x = Symbol('x', dummy=True)

    poly = Poly(DMP(dup_chebyshevt(int(n), ZZ), ZZ), x)

    if not args.get('polys', False):
        return poly.as_basic()
    else:
        return poly