当前位置: 首页>>代码示例>>Python>>正文


Python Piecewise.as_leading_term方法代码示例

本文整理汇总了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
开发者ID:hector1618,项目名称:sympy,代码行数:11,代码来源:test_piecewise.py

示例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
开发者ID:HuibinLin,项目名称:sympy,代码行数:19,代码来源:test_piecewise.py


注:本文中的sympy.Piecewise.as_leading_term方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。