Python | sympy.doit() method
Last Updated :
01 Feb, 2023
Using the doit() method in sympy module, we can evaluate objects that are not evaluated by default like limits, integrals, sums and products. Note that all objects of this kind will be evaluated recursively.
Syntax : sympy.doit(x)
Return : evaluated object
Code #1: With the help of the below examples, we can clearly understand that using sympy.doit() method we can evaluate objects that are not evaluated by default.
Python3
from sympy import *
from sympy.abc import x
geek = ( 2 * Integral(x, x)).doit()
print (geek)
|
Output:
x**2
Code #2:
Python3
from sympy import *
a, b = symbols( 'a b' )
geek = ( 3 * a + b * log(a) + log(b) + log(a) * log( 1 / b)).doit()
print (geek)
|
Output:
3*a + b*log(a) + log(a)*log(1/b) + log(b)
Share your thoughts in the comments
Please Login to comment...