本文整理汇总了Python中sympy.polys.densebasic.dmp_zeros函数的典型用法代码示例。如果您正苦于以下问题:Python dmp_zeros函数的具体用法?Python dmp_zeros怎么用?Python dmp_zeros使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmp_zeros函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: dmp_mul_term
def dmp_mul_term(f, c, i, u, K):
"""
Multiply ``f`` by ``c(x_2..x_u)*x_0**i`` in ``K[X]``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_mul_term(x**2*y + x, 3*y, 2)
3*x**4*y**2 + 3*x**3*y
"""
if not u:
return dup_mul_term(f, c, i, K)
v = u - 1
if dmp_zero_p(f, u):
return f
if dmp_zero_p(c, v):
return dmp_zero(u)
else:
return [ dmp_mul(cf, c, v, K) for cf in f ] + dmp_zeros(i, v, K)
开发者ID:QuaBoo,项目名称:sympy,代码行数:25,代码来源:densearith.py
示例2: dmp_add_term
def dmp_add_term(f, c, i, u, K):
"""
Add ``c(x_2..x_u)*x_0**i`` to ``f`` in ``K[X]``.
Examples
========
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_add_term(x*y + 1, 2, 2)
2*x**2 + x*y + 1
"""
if not u:
return dup_add_term(f, c, i, K)
v = u - 1
if dmp_zero_p(c, v):
return f
n = len(f)
m = n - i - 1
if i == n - 1:
return dmp_strip([dmp_add(f[0], c, v, K)] + f[1:], u)
else:
if i >= n:
return [c] + dmp_zeros(i - n, v, K) + f
else:
return f[:m] + [dmp_add(f[m], c, v, K)] + f[m + 1:]
开发者ID:QuaBoo,项目名称:sympy,代码行数:32,代码来源:densearith.py
示例3: dmp_integrate
def dmp_integrate(f, m, u, K):
"""
Computes indefinite integral of ``f`` in ``x_0`` in ``K[X]``.
Examples
========
>>> from sympy.polys.domains import QQ
>>> from sympy.polys.densetools import dmp_integrate
>>> dmp_integrate([[QQ(1)], [QQ(2), QQ(0)]], 1, 1, QQ)
[[1/2], [2/1, 0/1], []]
>>> dmp_integrate([[QQ(1)], [QQ(2), QQ(0)]], 2, 1, QQ)
[[1/6], [1/1, 0/1], [], []]
"""
if not u:
return dup_integrate(f, m, K)
if m <= 0 or dmp_zero_p(f, u):
return f
g, v = dmp_zeros(m, u - 1, K), u - 1
for i, c in enumerate(reversed(f)):
n = i + 1
for j in xrange(1, m):
n *= i + j + 1
g.insert(0, dmp_quo_ground(c, K(n), v, K))
return g
开发者ID:jenshnielsen,项目名称:sympy,代码行数:33,代码来源:densetools.py
示例4: dmp_integrate
def dmp_integrate(f, m, u, K):
"""
Computes the indefinite integral of ``f`` in ``x_0`` in ``K[X]``.
Examples
========
>>> from sympy.polys import ring, QQ
>>> R, x,y = ring("x,y", QQ)
>>> R.dmp_integrate(x + 2*y, 1)
1/2*x**2 + 2*x*y
>>> R.dmp_integrate(x + 2*y, 2)
1/6*x**3 + x**2*y
"""
if not u:
return dup_integrate(f, m, K)
if m <= 0 or dmp_zero_p(f, u):
return f
g, v = dmp_zeros(m, u - 1, K), u - 1
for i, c in enumerate(reversed(f)):
n = i + 1
for j in range(1, m):
n *= i + j + 1
g.insert(0, dmp_quo_ground(c, K(n), v, K))
return g
开发者ID:asmeurer,项目名称:sympy,代码行数:33,代码来源:densetools.py
示例5: dmp_add_term
def dmp_add_term(f, c, i, u, K):
"""
Add ``c(x_2..x_u)*x_0**i`` to ``f`` in ``K[X]``.
**Examples**
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densearith import dmp_add_term
>>> f = ZZ.map([[1, 0], [1]])
>>> c = ZZ.map([2])
>>> dmp_add_term(f, c, 2, 1, ZZ)
[[2], [1, 0], [1]]
"""
if not u:
return dup_add_term(f, c, i, K)
v = u-1
if dmp_zero_p(c, v):
return f
n = len(f)
m = n-i-1
if i == n-1:
return dmp_strip([dmp_add(f[0], c, v, K)] + f[1:], u)
else:
if i >= n:
return [c] + dmp_zeros(i-n, v, K) + f
else:
return f[:m] + [dmp_add(f[m], c, v, K)] + f[m+1:]
开发者ID:101man,项目名称:sympy,代码行数:34,代码来源:densearith.py
示例6: dmp_mul_term
def dmp_mul_term(f, c, i, u, K):
"""
Multiply ``f`` by ``c(x_2..x_u)*x_0**i`` in ``K[X]``.
**Examples**
>>> from sympy.polys.domains import ZZ
>>> from sympy.polys.densearith import dmp_mul_term
>>> f = ZZ.map([[1, 0], [1], []])
>>> c = ZZ.map([3, 0])
>>> dmp_mul_term(f, c, 2, 1, ZZ)
[[3, 0, 0], [3, 0], [], [], []]
"""
if not u:
return dup_mul_term(f, c, i, K)
v = u-1
if dmp_zero_p(f, u):
return f
if dmp_zero_p(c, v):
return dmp_zero(u)
else:
return [ dmp_mul(cf, c, v, K) for cf in f ] + dmp_zeros(i, v, K)
开发者ID:101man,项目名称:sympy,代码行数:27,代码来源:densearith.py
示例7: dmp_mul_term
def dmp_mul_term(f, c, i, u, K):
"""Multiply `f` by `c(x_2..x_u)*x_0**i` in `K[X]`. """
if not u:
return dup_mul_term(f, c, i, K)
v = u-1
if dmp_zero_p(f, u):
return f
if dmp_zero_p(c, v):
return dmp_zero(u)
else:
return [ dmp_mul(cf, c, v, K) for cf in f ] + dmp_zeros(i, v, K)
开发者ID:Aang,项目名称:sympy,代码行数:13,代码来源:densearith.py
示例8: test_dmp_zeros
def test_dmp_zeros():
assert dmp_zeros(4, 0, ZZ) == [[], [], [], []]
assert dmp_zeros(0, 2, ZZ) == []
assert dmp_zeros(1, 2, ZZ) == [[[[]]]]
assert dmp_zeros(2, 2, ZZ) == [[[[]]], [[[]]]]
assert dmp_zeros(3, 2, ZZ) == [[[[]]], [[[]]], [[[]]]]
assert dmp_zeros(3, -1, ZZ) == [0, 0, 0]
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:9,代码来源:test_densebasic.py
示例9: _dmp_ff_trivial_gcd
def _dmp_ff_trivial_gcd(f, g, u, K):
"""Handle trivial cases in GCD algorithm over a field. """
zero_f = dmp_zero_p(f, u)
zero_g = dmp_zero_p(g, u)
if zero_f and zero_g:
return tuple(dmp_zeros(3, u, K))
elif zero_f:
return (dmp_ground_monic(g, u, K), dmp_zero(u), dmp_ground(dmp_ground_LC(g, u, K), u))
elif zero_g:
return (dmp_ground_monic(f, u, K), dmp_ground(dmp_ground_LC(f, u, K), u), dmp_zero(u))
elif query("USE_SIMPLIFY_GCD"):
return _dmp_simplify_gcd(f, g, u, K)
else:
return None
开发者ID:mattpap,项目名称:sympy,代码行数:15,代码来源:euclidtools.py
示例10: dmp_sub_term
def dmp_sub_term(f, c, i, u, K):
"""Subtract `c(x_2..x_u)*x_0**i` from `f` in `K[X]`. """
if not u:
return dup_add_term(f, -c, i, K)
v = u-1
if dmp_zero_p(c, v):
return f
n = len(f)
m = n-i-1
if i == n-1:
return dmp_strip([dmp_sub(f[0], c, v, K)] + f[1:], u)
else:
if i >= n:
return [dmp_neg(c, v, K)] + dmp_zeros(i-n, v, K) + f
else:
return f[:m] + [dmp_sub(f[m], c, v, K)] + f[m+1:]
开发者ID:Aang,项目名称:sympy,代码行数:20,代码来源:densearith.py
示例11: _dmp_rr_trivial_gcd
def _dmp_rr_trivial_gcd(f, g, u, K):
"""Handle trivial cases in GCD algorithm over a ring. """
zero_f = dmp_zero_p(f, u)
zero_g = dmp_zero_p(g, u)
if zero_f and zero_g:
return tuple(dmp_zeros(3, u, K))
elif zero_f:
if K.is_nonnegative(dmp_ground_LC(g, u, K)):
return g, dmp_zero(u), dmp_one(u, K)
else:
return dmp_neg(g, u, K), dmp_zero(u), dmp_ground(-K.one, u)
elif zero_g:
if K.is_nonnegative(dmp_ground_LC(f, u, K)):
return f, dmp_one(u, K), dmp_zero(u)
else:
return dmp_neg(f, u, K), dmp_ground(-K.one, u), dmp_zero(u)
elif query('USE_SIMPLIFY_GCD'):
return _dmp_simplify_gcd(f, g, u, K)
else:
return None
开发者ID:addisonc,项目名称:sympy,代码行数:21,代码来源:euclidtools.py
注:本文中的sympy.polys.densebasic.dmp_zeros函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论