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.
# import sympy from sympy import * # Use sympy.atoms() method x = symbols( 'x' ) gfg = ( 2 + x + 7 * tan(x + I * pi)).atoms(Number) print (gfg) |
Output :
{2, 7}
Example #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) |
Output :
{pi, 2, x, 7}