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