本文整理汇总了Python中sympy.Poly.has方法的典型用法代码示例。如果您正苦于以下问题:Python Poly.has方法的具体用法?Python Poly.has怎么用?Python Poly.has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.Poly
的用法示例。
在下文中一共展示了Poly.has方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_has_any
# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import has [as 别名]
def test_has_any():
x,y,z,t,u = symbols('x y z t u')
f = Function("f")
g = Function("g")
p = Wild('p')
assert sin(x).has(x)
assert sin(x).has(sin)
assert not sin(x).has(y)
assert not sin(x).has(cos)
assert f(x).has(x)
assert f(x).has(f)
assert not f(x).has(y)
assert not f(x).has(g)
assert f(x).diff(x).has(x)
assert f(x).diff(x).has(f)
assert f(x).diff(x).has(Derivative)
assert not f(x).diff(x).has(y)
assert not f(x).diff(x).has(g)
assert not f(x).diff(x).has(sin)
assert (x**2).has(Symbol)
assert not (x**2).has(Wild)
assert (2*p).has(Wild)
i = Integer(4400)
assert i.has(x) is False
assert (i*x**i).has(x)
assert (i*y**i).has(x) is False
assert (i*y**i).has(x, y)
expr = x**2*y + sin(2**t + log(z))
assert expr.has(u) is False
assert expr.has(x)
assert expr.has(y)
assert expr.has(z)
assert expr.has(t)
assert expr.has(x, y, z, t)
assert expr.has(x, y, z, t, u)
from sympy.physics.units import m, s
assert (x*m/s).has(x)
assert (x*m/s).has(y, z) is False
poly = Poly(x**2 + x*y*sin(z), x, y, t)
assert poly.has(x)
assert poly.has(x, y, z)
assert poly.has(x, y, z, t)
assert FockState((x, y)).has(x)
示例2: test_has_all
# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import has [as 别名]
def test_has_all():
x,y,z,t,u = symbols('xyztu')
u = symbols('u')
i = Integer(4400)
assert i.has(x, all=True) is False
assert (i*x**i).has(x, all=True)
assert (i*y**i).has(x, all=True) is False
expr = x**2*y + sin(2**t + log(z))
assert expr.has(y, z, t, all=True)
assert expr.has(x, z, t, all=True)
assert expr.has(x, y, t, all=True)
assert expr.has(x, y, z, all=True)
assert expr.has(y, u, t, all=True) is False
assert expr.has(x, z, u, all=True) is False
assert expr.has(u, y, z, all=True) is False
assert expr.has(x, y, z, t, all=True)
assert expr.has(x, y, z, t, u, all=True) is False
from sympy.physics.units import m, s
assert (x*m/s).has(x, all=True)
assert (x*m/s).has(x, y, all=True) is False
poly = Poly(x**2 + x*y*sin(z), x, y, t)
assert poly.has(x, y, z, all=True)
assert poly.has(x, y, z, t, all=True) is False
f = FockState((x, y))
assert f.has(x, y, all=True)
assert f.has(x, y, z, all=True) is False
示例3: test_has_polys
# 需要导入模块: from sympy import Poly [as 别名]
# 或者: from sympy.Poly import has [as 别名]
def test_has_polys():
poly = Poly(x ** 2 + x * y * sin(z), x, y, t)
assert poly.has(x)
assert poly.has(x, y, z)
assert poly.has(x, y, z, t)