本文整理汇总了Python中sympy.ntheory.modular.crt函数的典型用法代码示例。如果您正苦于以下问题:Python crt函数的具体用法?Python crt怎么用?Python crt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了crt函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_crt
def test_crt():
def mcrt(m, v, r, symmetric=False):
assert crt(m, v, symmetric)[0] == r
mm, e, s = crt1(m)
assert crt2(m, v, mm, e, s, symmetric) == (r, mm)
mcrt([2, 3, 5], [0, 0, 0], 0)
mcrt([2, 3, 5], [1, 1, 1], 1)
mcrt([2, 3, 5], [-1, -1, -1], -1, True)
mcrt([2, 3, 5], [-1, -1, -1], 2*3*5 - 1, False)
assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
示例2: mcrt
def mcrt(m, v, r, symmetric=False):
assert crt(m, v, symmetric)[0] == r
mm, e, s = crt1(m)
assert crt2(m, v, mm, e, s, symmetric) == (r, mm)
示例3: test_crt
def test_crt():
assert crt([2, 3, 5], [0, 0, 0]) == 0
assert crt([2, 3, 5], [1, 1, 1]) == 1
assert crt([2, 3, 5], [-1, -1, -1], True) == -1
assert crt([2, 3, 5], [-1, -1, -1], False) == 2*3*5 - 1