本文整理汇总了Python中sympy.Piecewise.as_leading_term方法的典型用法代码示例。如果您正苦于以下问题:Python Piecewise.as_leading_term方法的具体用法?Python Piecewise.as_leading_term怎么用?Python Piecewise.as_leading_term使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Piecewise
的用法示例。
在下文中一共展示了Piecewise.as_leading_term方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_piecewise_as_leading_term
# 需要导入模块: from sympy import Piecewise [as 别名]
# 或者: from sympy.Piecewise import as_leading_term [as 别名]
def test_piecewise_as_leading_term():
p1 = Piecewise((1/x, x>1), (0, True))
p2 = Piecewise((x, x>1), (0, True))
p3 = Piecewise((1/x, x>1), (x, True))
p4 = Piecewise((x, x>1), (1/x, True))
assert p1.as_leading_term(x) == 0
assert p2.as_leading_term(x) == 0
assert p3.as_leading_term(x) == x
assert p4.as_leading_term(x) == 1/x
示例2: test_piecewise_as_leading_term
# 需要导入模块: from sympy import Piecewise [as 别名]
# 或者: from sympy.Piecewise import as_leading_term [as 别名]
def test_piecewise_as_leading_term():
p1 = Piecewise((1/x, x > 1), (0, True))
p2 = Piecewise((x, x > 1), (0, True))
p3 = Piecewise((1/x, x > 1), (x, True))
p4 = Piecewise((x, x > 1), (1/x, True))
p5 = Piecewise((1/x, x > 1), (x, True))
p6 = Piecewise((1/x, x < 1), (x, True))
p7 = Piecewise((x, x < 1), (1/x, True))
p8 = Piecewise((x, x > 1), (1/x, True))
assert p1.as_leading_term(x) == 0
assert p2.as_leading_term(x) == 0
assert p3.as_leading_term(x) == x
assert p4.as_leading_term(x) == 1/x
assert p5.as_leading_term(x) == x
assert p6.as_leading_term(x) == 1/x
assert p7.as_leading_term(x) == x
assert p8.as_leading_term(x) == 1/x