当前位置: 首页>>代码示例>>Python>>正文


Python PurePoly.new方法代码示例

本文整理汇总了Python中sympy.polys.polytools.PurePoly.new方法的典型用法代码示例。如果您正苦于以下问题:Python PurePoly.new方法的具体用法?Python PurePoly.new怎么用?Python PurePoly.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy.polys.polytools.PurePoly的用法示例。


在下文中一共展示了PurePoly.new方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gegenbauer_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def gegenbauer_poly(n, a, x=None, polys=False):
    """Generates Gegenbauer polynomial of degree `n` in `x`.

    Parameters
    ==========

    n : int
        `n` decides the degree of polynomial
    x : optional
    a
        Decides minimal domain for the list of
        coefficients.
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.
    """
    if n < 0:
        raise ValueError(
            "can't generate Gegenbauer polynomial of degree %s" % n)

    K, a = construct_domain(a, field=True)
    poly = DMP(dup_gegenbauer(int(n), a, K), K)

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

    return poly if polys else poly.as_expr()
开发者ID:asmeurer,项目名称:sympy,代码行数:31,代码来源:orthopolys.py

示例2: jacobi_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def jacobi_poly(n, a, b, x=None, polys=False):
    """Generates Jacobi polynomial of degree `n` in `x`.

    Parameters
    ==========

    n : int
        `n` decides the degree of polynomial
    a
        Lower limit of minimal domain for the list of
        coefficients.
    b
        Upper limit of minimal domain for the list of
        coefficients.
    x : optional
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.
    """
    if n < 0:
        raise ValueError("can't generate Jacobi polynomial of degree %s" % n)

    K, v = construct_domain([a, b], field=True)
    poly = DMP(dup_jacobi(int(n), v[0], v[1], K), K)

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

    return poly if polys else poly.as_expr()
开发者ID:asmeurer,项目名称:sympy,代码行数:33,代码来源:orthopolys.py

示例3: laguerre_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def laguerre_poly(n, x=None, alpha=None, polys=False):
    """Generates Laguerre polynomial of degree `n` in `x`.

    Parameters
    ==========

    n : int
        `n` decides the degree of polynomial
    x : optional
    alpha
        Decides minimal domain for the list
        of coefficients.
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.
    """
    if n < 0:
        raise ValueError("can't generate Laguerre polynomial of degree %s" % n)

    if alpha is not None:
        K, alpha = construct_domain(
            alpha, field=True)  # XXX: ground_field=True
    else:
        K, alpha = QQ, QQ(0)

    poly = DMP(dup_laguerre(int(n), alpha, K), K)

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

    return poly if polys else poly.as_expr()
开发者ID:asmeurer,项目名称:sympy,代码行数:35,代码来源:orthopolys.py

示例4: chebyshevu_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def chebyshevu_poly(n, x=None, polys=False):
    """Generates Chebyshev polynomial of the second kind of degree `n` in `x`.

    Parameters
    ==========

    n : int
        `n` decides the degree of polynomial
    x : optional
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.
    """
    if n < 0:
        raise ValueError(
            "can't generate 2nd kind Chebyshev polynomial of degree %s" % n)

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

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

    return poly if polys else poly.as_expr()
开发者ID:asmeurer,项目名称:sympy,代码行数:27,代码来源:orthopolys.py

示例5: as_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
 def as_poly(self, x=None):
     """Create a Poly instance from ``self``. """
     if x is not None:
         return Poly.new(self.rep, x)
     else:
         if self.alias is not None:
             return Poly.new(self.rep, self.alias)
         else:
             return PurePoly.new(self.rep, Dummy('x'))
开发者ID:thilinarmtb,项目名称:sympy,代码行数:11,代码来源:numberfields.py

示例6: spherical_bessel_fn

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def spherical_bessel_fn(n, x=None, polys=False):
    """
    Coefficients for the spherical Bessel functions.

    Those are only needed in the jn() function.

    The coefficients are calculated from:

    fn(0, z) = 1/z
    fn(1, z) = 1/z**2
    fn(n-1, z) + fn(n+1, z) == (2*n+1)/z * fn(n, z)

    Parameters
    ==========

    n : int
        `n` decides the degree of polynomial
    x : optional
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.

    Examples
    ========

    >>> from sympy.polys.orthopolys import spherical_bessel_fn as fn
    >>> from sympy import Symbol
    >>> z = Symbol("z")
    >>> fn(1, z)
    z**(-2)
    >>> fn(2, z)
    -1/z + 3/z**3
    >>> fn(3, z)
    -6/z**2 + 15/z**4
    >>> fn(4, z)
    1/z - 45/z**3 + 105/z**5

    """

    if n < 0:
        dup = dup_spherical_bessel_fn_minus(-int(n), ZZ)
    else:
        dup = dup_spherical_bessel_fn(int(n), ZZ)

    poly = DMP(dup, ZZ)

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

    return poly if polys else poly.as_expr()
开发者ID:asmeurer,项目名称:sympy,代码行数:54,代码来源:orthopolys.py

示例7: legendre_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
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
开发者ID:A-turing-machine,项目名称:sympy,代码行数:18,代码来源:orthopolys.py

示例8: chebyshevu_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
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)

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

    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
开发者ID:ALGHeArT,项目名称:sympy,代码行数:18,代码来源:orthopolys.py

示例9: cyclotomic_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
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)

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

    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
开发者ID:ALGHeArT,项目名称:sympy,代码行数:18,代码来源:specialpolys.py

示例10: jacobi_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def jacobi_poly(n, a, b, x=None, **args):
    """Generates Jacobi polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Jacobi polynomial of degree %s" % n)

    K, v = construct_domain([a, b], field=True)
    poly = DMP(dup_jacobi(int(n), v[0], v[1], K), K)

    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
开发者ID:A-turing-machine,项目名称:sympy,代码行数:19,代码来源:orthopolys.py

示例11: spherical_bessel_fn

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def spherical_bessel_fn(n, x=None, **args):
    """
    Coefficients for the spherical Bessel functions.

    Those are only needed in the jn() function.

    The coefficients are calculated from:

    fn(0, z) = 1/z
    fn(1, z) = 1/z**2
    fn(n-1, z) + fn(n+1, z) == (2*n+1)/z * fn(n, z)

    Examples
    ========

    >>> from sympy.polys.orthopolys import spherical_bessel_fn as fn
    >>> from sympy import Symbol
    >>> z = Symbol("z")
    >>> fn(1, z)
    z**(-2)
    >>> fn(2, z)
    -1/z + 3/z**3
    >>> fn(3, z)
    -6/z**2 + 15/z**4
    >>> fn(4, z)
    1/z - 45/z**3 + 105/z**5

    """
    from sympy import sympify

    if n < 0:
        dup = dup_spherical_bessel_fn_minus(-int(n), ZZ)
    else:
        dup = dup_spherical_bessel_fn(int(n), ZZ)

    poly = DMP(dup, ZZ)

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

    if not args.get('polys', False):
        return poly.as_expr()
    else:
        return poly
开发者ID:SwaathiRamesh,项目名称:sympy,代码行数:48,代码来源:orthopolys.py

示例12: gegenbauer_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def gegenbauer_poly(n, a, x=None, **args):
    """Generates Gegenbauer polynomial of degree `n` in `x`. """
    if n < 0:
        raise ValueError("can't generate Gegenbauer polynomial of degree %s" % n)

    K, a = construct_domain(a, field=True)
    poly = DMP(dup_gegenbauer(int(n), a, K), K)

    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
开发者ID:StefenYin,项目名称:sympy,代码行数:19,代码来源:orthopolys.py

示例13: laguerre_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def laguerre_poly(n, x=None, alpha=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 alpha is not None:
        K, alpha = construct_domain(alpha, field=True) # XXX: ground_field=True
    else:
        K, alpha = QQ, QQ(0)

    poly = DMP(dup_laguerre(int(n), alpha, K), K)

    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
开发者ID:ALGHeArT,项目名称:sympy,代码行数:23,代码来源:orthopolys.py

示例14: legendre_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def legendre_poly(n, x=None, polys=False):
    """Generates Legendre polynomial of degree `n` in `x`.

    Parameters
    ----------
    n : int
        `n` decides the degree of polynomial
    x : optional
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.
    """
    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'))

    return poly if polys else poly.as_expr()
开发者ID:KonstantinTogoi,项目名称:sympy,代码行数:25,代码来源:orthopolys.py

示例15: cyclotomic_poly

# 需要导入模块: from sympy.polys.polytools import PurePoly [as 别名]
# 或者: from sympy.polys.polytools.PurePoly import new [as 别名]
def cyclotomic_poly(n, x=None, polys=False):
    """Generates cyclotomic polynomial of order `n` in `x`.

    Parameters
    ----------
    n : int
        `n` decides the order of polynomial
    x : optional
    polys : bool, optional
        ``polys=True`` returns an expression, otherwise
        (default) returns an expression.
    """
    if n <= 0:
        raise ValueError(
            "can't generate cyclotomic polynomial of order %s" % n)

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

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

    return poly if polys else poly.as_expr()
开发者ID:carstimon,项目名称:sympy,代码行数:26,代码来源:specialpolys.py


注:本文中的sympy.polys.polytools.PurePoly.new方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。