test_symbolic_utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:vadouvan 作者: vadouvan 项目源码 文件源码
def test_many_variables(self):
        """
        It can eliminate all x's from the chain
        ``(a = x0, x0 = x1, ..., x19 = x20, x20 = b)``.
        """
        symbols = list(itertools.islice(sympy.numbered_symbols("x"), 20))
        equations = [sympy.Eq(symbols[i], symbols[i + 1])
                     for i in range(len(symbols) - 1)]
        equations.append(sympy.Eq(a, symbols[0]))
        equations.append(sympy.Eq(b, symbols[-1]))
        new_equations = vadouvan.symbolic_utils.eliminate(equations, symbols)
        assert len(new_equations) == 1
        assert new_equations[0].free_symbols == {a, b}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号