Sunday, November 17, 2024
Google search engine
HomeLanguagesPython | sympy.Function() method

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.




# 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 :




# 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)}

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments