# Python | sympy.Integral() method

With the help of sympy.Integral() method, we can create an unevaluated integral of a SymPy expression. It has the same syntax as integrate() method. To evaluate an unevaluated integral, use the doit() method.

Syntax: Integral(expression, reference variable)

Parameters:
expression – A SymPy expression whose unevaluated integral is found.
reference variable – Variable with respect to which integral is found.

Returns: Returns an unevaluated integral of the given expression.

Example #1:

 `# import sympy  ` `from` `sympy ``import` `*`  ` `  `x, y ``=` `symbols(``'x y'``) ` `expr ``=` `x``*``*``2` `+` `2` `*` `y ``+` `y``*``*``3` `print``(``"Expression : {} "``.``format``(expr)) ` `  `  `# Use sympy.Integral() method  ` `expr_intg ``=` `Integral(expr, x)   ` `     `  `print``(``"Integral of expression with respect to x : {}"``.``format``(expr_intg))   ` `print``(``"Value of the Integral : {} "``.``format``(expr_intg.doit())) `

Output:

```Expression : x**2 + y**3 + 2*y
Integral of expression with respect to x : Integral(x**2 + y**3 + 2*y, x)
Value of the Integral : x**3/3 + x*(y**3 + 2*y)
```

Example #2:

 `# import sympy  ` `from` `sympy ``import` `*`  ` `  `x, y ``=` `symbols(``'x y'``) ` `expr ``=` `y``*``*``3` `*` `x``*``*``2` `+` `2` `*` `y``*``x ``+` `x ``*` `y``*``*``3` `print``(``"Expression : {} "``.``format``(expr)) ` `  `  `# Use sympy.Integral() method  ` `expr_intg ``=` `Integral(expr, x, y)   ` `     `  `print``(``"Integral of expression with respect to x : {}"``.``format``(expr_intg))   ` `print``(``"Value of the Integral : {} "``.``format``(expr_intg.doit())) `

Output:

```Expression : x**2*y**3 + x*y**3 + 2*x*y
Integral of expression with respect to x : Integral(x**2*y**3 + x*y**3 + 2*x*y, x, y)
Value of the Integral : x**2*y**2/2 + y**4*(x**3/12 + x**2/8)
```

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.

Article Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.