Tuesday, January 7, 2025
Google search engine
HomeLanguagesPython | sympy.Lambda() method

Python | sympy.Lambda() method

With the help of sympy.Lambda() method, we can perform any mathematical operation by just defining the formula and then pass the parameters with reference variable by using sympy.Lambda().

Syntax : sympy.Lambda()
Return : Return the result of mathematical formula.

Example #1 :
In this example we can see that we are able to perform any mathematical operation by using sympy.Lambda() method.




# import sympy
from sympy import *
  
# Use sympy.Lambda() method
x = symbols('x')
gfg = Lambda(x, x + 1)
  
print(gfg(9))


Output :

10

Example #2 :




# import sympy
from sympy import *
  
# Use sympy.Lambda() method
x, y = symbols('x y')
gfg = Lambda((x, y), x * y)
  
print(gfg(9, 5))


Output :

45

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