Open In App

Python | sympy.Function() method

Last Updated : 19 Jul, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
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. Python3 1=1
# import sympy
from sympy import * 

x, y = symbols('x y')
f = Function('f')

# Use sympy.Function() method
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 : Python3 1=1
# import sympy
from sympy import * 

x, y = symbols('x y')
f = Function('f')

# Use sympy.Function() method
gfg = (2 + 3 * cos(y) + 5 * log(2 * x)).atoms(Function)
  
print(gfg)
Output :
{cos(y), log(2*x)}

Next Article
Article Tags :
Practice Tags :

Similar Reads