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


Python Subs.series方法代码示例

本文整理汇总了Python中sympy.Subs.series方法的典型用法代码示例。如果您正苦于以下问题:Python Subs.series方法的具体用法?Python Subs.series怎么用?Python Subs.series使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy.Subs的用法示例。


在下文中一共展示了Subs.series方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_series_of_Subs

# 需要导入模块: from sympy import Subs [as 别名]
# 或者: from sympy.Subs import series [as 别名]
def test_series_of_Subs():
    from sympy.abc import x, y, z

    subs1 = Subs(sin(x), x, y)
    subs2 = Subs(sin(x) * cos(z), x, y)
    subs3 = Subs(sin(x * z), (x, z), (y, x))

    assert subs1.series(x) == subs1
    assert subs1.series(y) == Subs(x, x, y) + Subs(-x**3/6, x, y) + Subs(x**5/120, x, y) + O(y**6)
    assert subs1.series(z) == subs1
    assert subs2.series(z) == Subs(z**4*sin(x)/24, x, y) + Subs(-z**2*sin(x)/2, x, y) + Subs(sin(x), x, y) + O(z**6)
    assert subs3.series(x).doit() == subs3.doit().series(x)
    assert subs3.series(z).doit() == sin(x*y)
开发者ID:Lenqth,项目名称:sympy,代码行数:15,代码来源:test_series.py

示例2: test_series_of_Subs

# 需要导入模块: from sympy import Subs [as 别名]
# 或者: from sympy.Subs import series [as 别名]
def test_series_of_Subs():
    from sympy.abc import x, y, z

    subs1 = Subs(sin(x), x, y)
    subs2 = Subs(sin(x) * cos(z), x, y)
    subs3 = Subs(sin(x * z), (x, z), (y, x))

    assert subs1.series(x) == subs1
    subs1_series = (Subs(x, x, y) + Subs(-x**3/6, x, y) +
        Subs(x**5/120, x, y) + O(y**6))
    assert subs1.series() == subs1_series
    assert subs1.series(y) == subs1_series
    assert subs1.series(z) == subs1
    assert subs2.series(z) == (Subs(z**4*sin(x)/24, x, y) +
        Subs(-z**2*sin(x)/2, x, y) + Subs(sin(x), x, y) + O(z**6))
    assert subs3.series(x).doit() == subs3.doit().series(x)
    assert subs3.series(z).doit() == sin(x*y)

    raises(ValueError, lambda: Subs(x + 2*y, y, z).series())
    assert Subs(x + y, y, z).series(x).doit() == x + z
开发者ID:asmeurer,项目名称:sympy,代码行数:22,代码来源:test_series.py


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