Python | sympy.atoms() method
Last Updated :
19 Jul, 2019
With the help of sympy.atoms()
method, we can extract the atomic values of the mathematical function like any numbers, symbols, iota and etc, by using sympy.atoms()
.
Syntax : sympy.atoms()
Return : Return the atomic values from mathematical expression.
Example #1 :
In this example we can see that we are able to get the atomic values any mathematical operation by using sympy.atoms()
method.
from sympy import *
x = symbols( 'x' )
gfg = ( 2 + x + 7 * tan(x + I * pi)).atoms(Number)
print (gfg)
|
Output :
{2, 7}
Example #2 :
from sympy import *
x = symbols( 'x' )
gfg = ( 2 + x + 7 * log(x + I * pi)).atoms(Number, Symbol, NumberSymbol)
print (gfg)
|
Output :
{pi, 2, x, 7}
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...