Python | sympy.Function() method
With the help of sympy.Function()
method, we can find the various functions in the whole mathematical expression like f(x), sin(x), log(x), etc by using sympy.Function()
method.
Syntax : sympy.Function()
Return : Return the list of functions in mathematical operation.
Example #1 :
In this example we can see that by using sympy.Function()
method, we are able to find the function in the mathematical operation.
from sympy import *
x, y = symbols( 'x y' )
f = Function( 'f' )
gfg = (f(x) + 2 * tan(y + I * pi) + log( 2 * x)).atoms(Function)
print (gfg)
|
Output :
{f(x), tan(y + I*pi), log(2*x)}
Example #2 :
from sympy import *
x, y = symbols( 'x y' )
f = Function( 'f' )
gfg = ( 2 + 3 * cos(y) + 5 * log( 2 * x)).atoms(Function)
print (gfg)
|
Output :
{cos(y), log(2*x)}
Last Updated :
19 Jul, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...