本文整理汇总了Python中sympy.Integral.transform方法的典型用法代码示例。如果您正苦于以下问题:Python Integral.transform方法的具体用法?Python Integral.transform怎么用?Python Integral.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Integral
的用法示例。
在下文中一共展示了Integral.transform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_transform
# 需要导入模块: from sympy import Integral [as 别名]
# 或者: from sympy.Integral import transform [as 别名]
def test_transform():
a = Integral(x**2+1, (x, -1, 2))
assert a.doit() == a.transform(x, 3*x+1).doit()
assert a.transform(x, 3*x+1).transform(x, 3*x+1, inverse=True) == a
assert a.transform(x, 3*x+1, inverse=True).transform(x, 3*x+1) == a
a = Integral(sin(1/x), (x, 0, 1))
assert a.transform(x, 1/x) == Integral(sin(x)/x**2, (x, 1, oo))
assert a.transform(x, 1/x).transform(x, 1/x) == a
a = Integral(exp(-x**2), (x, -oo, oo))
assert a.transform(x, 2*x) == Integral(2*exp(-4*x**2), (x, -oo, oo))
raises(ValueError, "a.transform(x, 1/x)")
raises(ValueError, "a.transform(x, 1/x)")
示例2: test_transform
# 需要导入模块: from sympy import Integral [as 别名]
# 或者: from sympy.Integral import transform [as 别名]
def test_transform():
a = Integral(x**2 + 1, (x, -1, 2))
fx = x
fy = 3*y + 1
assert a.doit() == a.transform(fx, fy).doit()
assert a.transform(fx, fy).transform(fy, fx) == a
fx = 3*x + 1
fy = y
assert a.transform(fx, fy).transform(fy, fx) == a
a = Integral(sin(1/x), (x, 0, 1))
assert a.transform(x, 1/y) == Integral(sin(y)/y**2, (y, 1, oo))
assert a.transform(x, 1/y).transform(y, 1/x) == a
a = Integral(exp(-x**2), (x, -oo, oo))
assert a.transform(x, 2*y) == Integral(2*exp(-4*y**2), (y, -oo, oo))
# < 3 arg limit handled properly
assert Integral(x, x).transform(x, a*y).doit() == \
Integral(y*a**2, y).doit()
_3 = S(3)
assert Integral(x, (x, 0, -_3)).transform(x, 1/y).doit() == \
Integral(-1/x**3, (x, -oo, -1/_3)).doit()
assert Integral(x, (x, 0, _3)).transform(x, 1/y) == \
Integral(y**(-3), (y, 1/_3, oo))
# issue 8400
i = Integral(x + y, (x, 1, 2), (y, 1, 2))
assert i.transform(x, (x + 2*y, x)).doit() == \
i.transform(x, (x + 2*z, x)).doit() == 3
示例3: test_transform
# 需要导入模块: from sympy import Integral [as 别名]
# 或者: from sympy.Integral import transform [as 别名]
def test_transform():
a = Integral(x ** 2 + 1, (x, -1, 2))
assert a.doit() == a.transform(x, 3 * x + 1).doit()
assert a.transform(x, 3 * x + 1).transform(x, 3 * x + 1, inverse=True) == a
assert a.transform(x, 3 * x + 1, inverse=True).transform(x, 3 * x + 1) == a
a = Integral(sin(1 / x), (x, 0, 1))
assert a.transform(x, 1 / x) == Integral(sin(x) / x ** 2, (x, 1, oo))
assert a.transform(x, 1 / x).transform(x, 1 / x) == a
a = Integral(exp(-x ** 2), (x, -oo, oo))
assert a.transform(x, 2 * x) == Integral(2 * exp(-4 * x ** 2), (x, -oo, oo))
# < 3 arg limit handled properly
assert Integral(x, x).transform(x, a * x) == Integral(x * a ** 2, x)
raises(ValueError, "a.transform(x, 1/x)")
raises(ValueError, "a.transform(x, 1/x)")
_3 = S(3)
assert Integral(x, (x, 0, -_3)).transform(x, 1 / x) == Integral(-1 / x ** 3, (x, -oo, -1 / _3))
assert Integral(x, (x, 0, _3)).transform(x, 1 / x) == Integral(x ** (-3), (x, 1 / _3, oo))