借助sympy.atoms()
方法,我们可以使用提取数学函数的原子值,例如任何数字,符号,iota等sympy.atoms()
。
用法:sympy.atoms()
返回:Return the atomic values from mathematical expression.
范例1:
在此示例中,我们可以看到,通过使用sympy.atoms()
方法。
# import sympy
from sympy import *
# Use sympy.atoms() method
x = symbols('x')
gfg = (2 + x + 7 * tan(x + I * pi)).atoms(Number)
print(gfg)
输出:
{2, 7}
范例2:
# import sympy
from sympy import *
# Use sympy.atoms() method
x = symbols('x')
gfg = (2 + x + 7 * log(x + I * pi)).atoms(Number, Symbol, NumberSymbol)
print(gfg)
输出:
{pi, 2, x, 7}
相关用法
- Python next()用法及代码示例
- Python os.dup()用法及代码示例
- Python set()用法及代码示例
- Python Decimal max()用法及代码示例
- Python PIL ImageOps.fit()用法及代码示例
- Python os.rmdir()用法及代码示例
- Python sympy.det()用法及代码示例
- Python Decimal min()用法及代码示例
- Python os.readlink()用法及代码示例
- Python os.writev()用法及代码示例
- Python os.readv()用法及代码示例
- Python PIL RankFilter()用法及代码示例
- Python os.rename()用法及代码示例
- Python os.sendfile()用法及代码示例
注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Python | sympy.atoms() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。