[Science and technology calculation by Python] Integral, mathematical formula, sympy

Contents

Use the ** integrate ** method of sympy to find the analytical solution of the indefinite integral, definite integral, and improper integral of the elementary function.


code

from sympy import *
x=Symbol('x')                  #letter'x'Is defined as the variable x
y=Symbol('y')                 #letter'y'Is defined as the variable y
"""
Integral:
Use integrate
"""

#Indefinite integral
integrate(6*x**5, x) # 6 x^Indefinite integral of 5
integrate(log(x), x) # log(x)

#Definite integral
integrate(x**3, (x, -1, 1))  # x^3 of[-1,1]Integral up to
integrate(sin(x), (x, 0, pi/2)) # sin(x)of[0,pi/2]までof積分

#Improper integral
integrate(exp(-x**2), (x, -oo, oo)) #Exp(-x^2)of-From ∞+∞までof積分。ガウス積分。

result

From top to bottom, it is as follows.

スクリーンショット 2017-07-18 14.46.34.png

Recommended Posts

[Science and technology calculation by Python] Integral, mathematical formula, sympy
[Science and technology calculation by Python] (Partial) differential, mathematical formula, sympy
[Science and technology calculation by Python] Taylor expansion, mathematical formulas, sympy
[Scientific / technical calculation by Python] Solving ordinary differential equations, mathematical formulas, sympy
[Scientific / technical calculation by Python] Derivation of analytical solutions for quadratic and cubic equations, mathematical formulas, sympy
[Python] Heron's formula functionalization and calculation of the maximum area
Multiple integrals with Python and Sympy
[Control engineering] Calculation of transfer functions and state space models by Python
[Scientific / technical calculation by Python] Sum calculation, numerical calculation
Socket communication by C language and Python
[Scientific / technical calculation by Python] Analytical solution to find the solution of equation sympy
Machine Learning with docker (40) with anaconda (40) "Hands-On Data Science and Python Machine Learning" By Frank Kane