借助sympy.is_polynomial()方法,我们可以检查是否找到了多项式,通过使用,它将返回True作为布尔值sympy.is_polynomial()方法。
用法:sympy.is_polynomial()
返回:Return a boolean value if polynomial is found.
范例1:
在这个例子中,我们可以通过使用sympy.is_polynomial()方法,我们可以通过获取布尔值来检测多项式。
# import sympy 
from sympy import * 
  
x, y = symbols('x y') 
  
# Use sympy.is_polynomial() method 
gfg = simplify(x**2 + 2 * y*x + y**2).is_polynomial() 
     
print(gfg)输出:
True
范例2:
# import sympy 
from sympy import * 
  
x, y = symbols('x y') 
  
# Use sympy.is_constant() method 
gfg = simplify(sin(x)).is_constant() 
     
print(gfg)输出:
False
相关用法
- Python os.dup()用法及代码示例
- Python set()用法及代码示例
- Python next()用法及代码示例
- Python os.get_blocking()用法及代码示例
- Python sympy.apart()用法及代码示例
- Python sympy.nC()用法及代码示例
- Python os.set_blocking()用法及代码示例
- Python os.getcwd()用法及代码示例
- Python os.access()用法及代码示例
- Python dict pop()用法及代码示例
- Python sympy.Add()用法及代码示例
- Python sympy.nP()用法及代码示例
注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Python | sympy.is_polynomial() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
