Python | sympy.integrate() method
With the help of sympy.integrate() method, we can find the integration of mathematical expressions in the form of variables by using sympy.integrate() method.
Syntax :
sympy.integrate(expression, reference variable)
Return : Return integration of mathematical expression.
Example #1 :
In this example we can see that by using sympy.integrate() method, we can find the integration of mathematical expression with variables. Here we use symbols() method also to declare a variable as symbol.
# import sympy from sympy import * x, y = symbols('x y') gfg_exp = sin(x)*exp(x) print("Before Integration : {}".format(gfg_exp)) # Use sympy.integrate() method intr = integrate(gfg_exp, x) print("After Integration : {}".format(intr)) |
Output :
Before Integration : exp(x)*sin(x)
After Integration : exp(x)*sin(x)/2 – exp(x)*cos(x)/2
Example #2 :
# import sympy from sympy import * x, y = symbols('x y') gfg_exp = sin(x)*tan(x) print("Before Integration : {}".format(gfg_exp)) # Use sympy.integrate() method intr = integrate(gfg_exp, x) print("After Integration : {}".format(intr)) |
Output :
Before Integration : sin(x)*tan(x)
After Integration : -log(sin(x) – 1)/2 + log(sin(x) + 1)/2 – sin(x)
Recommended Posts:
- class method vs static method in Python
- Python | os.dup() method
- Python | set() method
- Python | next() method
- Python | os.waitid() method
- Python | shutil.which() method
- Python PIL | getpalette() Method
- Python PIL | getcolors() Method
- Python | os.WIFEXITED() method
- Python | Tensorflow cos() method
- Python | os.major() method
- Python | os.stat() method
- Python | os.minor() method
- Python | os.fstat() method
- Python | os.umask() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



