Python | sympy.Lambda() method

Last Updated : 17 Jul, 2019
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. Python3 1=1
# import sympy
from sympy import *

# Use sympy.Lambda() method
x = symbols('x')
gfg = Lambda(x, x + 1)

print(gfg(9))
Output :
10
Example #2 : Python3 1=1
# 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
Comment