本文整理汇总了Python中sympy.polys.sqfreetools.dmp_sqf_part函数的典型用法代码示例。如果您正苦于以下问题:Python dmp_sqf_part函数的具体用法?Python dmp_sqf_part怎么用?Python dmp_sqf_part使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmp_sqf_part函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_dmp_sqf
def test_dmp_sqf():
assert dmp_sqf_part([[]], 1, ZZ) == [[]]
assert dmp_sqf_p([[]], 1, ZZ) == True
assert dmp_sqf_part([[7]], 1, ZZ) == [[1]]
assert dmp_sqf_p([[7]], 1, ZZ) == True
assert dmp_sqf_p(f_0, 2, ZZ) == True
assert dmp_sqf_p(dmp_sqr(f_0, 2, ZZ), 2, ZZ) == False
assert dmp_sqf_p(f_1, 2, ZZ) == True
assert dmp_sqf_p(dmp_sqr(f_1, 2, ZZ), 2, ZZ) == False
assert dmp_sqf_p(f_2, 2, ZZ) == True
assert dmp_sqf_p(dmp_sqr(f_2, 2, ZZ), 2, ZZ) == False
assert dmp_sqf_p(f_3, 2, ZZ) == True
assert dmp_sqf_p(dmp_sqr(f_3, 2, ZZ), 2, ZZ) == False
assert dmp_sqf_p(f_5, 2, ZZ) == False
assert dmp_sqf_p(dmp_sqr(f_5, 2, ZZ), 2, ZZ) == False
assert dmp_sqf_p(f_4, 2, ZZ) == True
assert dmp_sqf_part(f_4, 2, ZZ) == dmp_neg(f_4, 2, ZZ)
assert dmp_sqf_p(f_6, 3, ZZ) == True
assert dmp_sqf_part(f_6, 3, ZZ) == f_6
assert dmp_sqf_part(f_5, 2, ZZ) == [[[1]], [[1], [-1, 0]]]
assert dup_sqf_list([], ZZ) == (ZZ(0), [])
assert dup_sqf_list_include([], ZZ) == [([], 1)]
assert dmp_sqf_list([[ZZ(3)]], 1, ZZ) == (ZZ(3), [])
assert dmp_sqf_list_include([[ZZ(3)]], 1, ZZ) == [([[ZZ(3)]], 1)]
f = [-1,1,0,0,1,-1]
assert dmp_sqf_list(f, 0, ZZ) == \
(-1, [([1,1,1,1], 1), ([1,-1], 2)])
assert dmp_sqf_list_include(f, 0, ZZ) == \
[([-1,-1,-1,-1], 1), ([1,-1], 2)]
f = [[-1],[1],[],[],[1],[-1]]
assert dmp_sqf_list(f, 1, ZZ) == \
(-1, [([[1],[1],[1],[1]], 1), ([[1],[-1]], 2)])
assert dmp_sqf_list_include(f, 1, ZZ) == \
[([[-1],[-1],[-1],[-1]], 1), ([[1],[-1]], 2)]
K = FF(2)
f = [[-1], [2], [-1]]
assert dmp_sqf_list_include(f, 1, ZZ) == \
[([[-1]], 1), ([[1], [-1]], 2)]
raises(DomainError, "dmp_sqf_list([[K(1), K(0), K(1)]], 1, K)")
开发者ID:101man,项目名称:sympy,代码行数:53,代码来源:test_sqfreetools.py
示例2: dmp_ext_factor
def dmp_ext_factor(f, u, K):
"""Factor multivariate polynomials over algebraic number fields. """
if not u:
return dup_ext_factor(f, K)
lc = dmp_ground_LC(f, u, K)
f = dmp_ground_monic(f, u, K)
if all([ d <= 0 for d in dmp_degree_list(f, u) ]):
return lc, []
f, F = dmp_sqf_part(f, u, K), f
s, g, r = dmp_sqf_norm(f, u, K)
factors = dmp_factor_list_include(r, u, K.dom)
if len(factors) == 1:
coeff, factors = lc, [f]
else:
H = dmp_raise([K.one, s*K.unit], u, 0, K)
for i, (factor, _) in enumerate(factors):
h = dmp_convert(factor, u, K.dom, K)
h, _, g = dmp_inner_gcd(h, g, u, K)
h = dmp_compose(h, H, u, K)
factors[i] = h
return lc, dmp_trial_division(F, factors, u, K)
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:28,代码来源:factortools.py
示例3: dmp_zz_factor
def dmp_zz_factor(f, u, K):
"""
Factor (non square-free) polynomials in `Z[X]`.
Given a multivariate polynomial `f` in `Z[x]` computes its complete
factorization `f_1, ..., f_n` into irreducibles over integers::
f = content(f) f_1**k_1 ... f_n**k_n
The factorization is computed by reducing the input polynomial
into a primitive square-free polynomial and factoring it using
Enhanced Extended Zassenhaus (EEZ) algorithm. Trial division
is used to recover the multiplicities of factors.
The result is returned as a tuple consisting of::
(content(f), [(f_1, k_1), ..., (f_n, k_n))
Consider polynomial `f = 2*(x**2 - y**2)`::
>>> from sympy.polys.factortools import dmp_zz_factor
>>> from sympy.polys.domains import ZZ
>>> dmp_zz_factor([[2], [], [-2, 0, 0]], 1, ZZ)
(2, [([[1], [-1, 0]], 1), ([[1], [1, 0]], 1)])
In result we got the following factorization::
f = 2 (x - y) (x + y)
**References**
1. [Gathen99]_
"""
if not u:
return dup_zz_factor(f, K)
if dmp_zero_p(f, u):
return K.zero, []
cont, g = dmp_ground_primitive(f, u, K)
if dmp_ground_LC(g, u, K) < 0:
cont, g = -cont, dmp_neg(g, u, K)
if all([ d <= 0 for d in dmp_degree_list(g, u) ]):
return cont, []
G, g = dmp_primitive(g, u, K)
factors = []
if dmp_degree(g, u) > 0:
g = dmp_sqf_part(g, u, K)
H = dmp_zz_wang(g, u, K)
for h in H:
k = 0
while True:
q, r = dmp_div(f, h, u, K)
if dmp_zero_p(r, u):
f, k = q, k+1
else:
break
factors.append((h, k))
for g, k in dmp_zz_factor(G, u-1, K)[1]:
factors.insert(0, ([g], k))
return cont, _sort_factors(factors)
开发者ID:TeddyBoomer,项目名称:wxgeometrie,代码行数:74,代码来源:factortools.py
示例4: sqf_part
def sqf_part(f):
"""Computes square-free part of `f`. """
return f.per(dmp_sqf_part(f.rep, f.lev, f.dom))
开发者ID:fxkr,项目名称:sympy,代码行数:3,代码来源:polyclasses.py
示例5: dmp_zz_factor
def dmp_zz_factor(f, u, K):
"""
Factor (non square-free) polynomials in `Z[X]`.
Given a multivariate polynomial `f` in `Z[x]` computes its complete
factorization `f_1, ..., f_n` into irreducibles over integers::
f = content(f) f_1**k_1 ... f_n**k_n
The factorization is computed by reducing the input polynomial
into a primitive square-free polynomial and factoring it using
Enhanced Extended Zassenhaus (EEZ) algorithm. Trial division
is used to recover the multiplicities of factors.
The result is returned as a tuple consisting of::
(content(f), [(f_1, k_1), ..., (f_n, k_n))
Consider polynomial `f = 2*(x**2 - y**2)`::
>>> from sympy.polys import ring, ZZ
>>> R, x,y = ring("x,y", ZZ)
>>> R.dmp_zz_factor(2*x**2 - 2*y**2)
(2, [(x - y, 1), (x + y, 1)])
In result we got the following factorization::
f = 2 (x - y) (x + y)
References
==========
1. [Gathen99]_
"""
if not u:
return dup_zz_factor(f, K)
if dmp_zero_p(f, u):
return K.zero, []
cont, g = dmp_ground_primitive(f, u, K)
if dmp_ground_LC(g, u, K) < 0:
cont, g = -cont, dmp_neg(g, u, K)
if all(d <= 0 for d in dmp_degree_list(g, u)):
return cont, []
G, g = dmp_primitive(g, u, K)
factors = []
if dmp_degree(g, u) > 0:
g = dmp_sqf_part(g, u, K)
H = dmp_zz_wang(g, u, K)
factors = dmp_trial_division(f, H, u, K)
for g, k in dmp_zz_factor(G, u - 1, K)[1]:
factors.insert(0, ([g], k))
return cont, _sort_factors(factors)
开发者ID:abhi98khandelwal,项目名称:sympy,代码行数:63,代码来源:factortools.py
注:本文中的sympy.polys.sqfreetools.dmp_sqf_part函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论