[Science and technology calculation by Python] (Partial) differential, mathematical formula, sympy

Contents

Find the derivative of the elementary function using sympy.


code

from sympy import *      #Imoprt all features from the sympy library
sym.init_printing()      #Format output

x=Symbol('x')                  #letter'x'Is defined as the variable x
y=Symbol('y')                 #letter'y'Is defined as the variable y


#differential
diff(sin(x),x)  #sin(x)Differentiation of
diff(exp(x),x)   # e^Differentiation of x

#Higher derivative
diff(x**4+x**3,x,2)  # x^4+x^2nd derivative of 3


#Partial differential
diff(x**2+x*y+2*y**2,x)  # x^2+xy+2y^Partial derivative of 2 by x


#When leaving a differential symbol
Derivative(y(t),t)

result

From top to bottom, it is as follows.

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

スクリーンショット 2017-08-02 2.21.57.png

Recommended Posts

[Science and technology calculation by Python] (Partial) differential, mathematical formula, sympy
[Science and technology calculation by Python] Integral, 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
[Science / technical calculation by Python] Comparison of convergence speeds of SOR method, Gauss-Seidel method, and Jacobi method for Laplace equation, partial differential equation, boundary value problem
I tried Jacobian and partial differential with python
Solve simultaneous ordinary differential equations with Python and SymPy.
[Scientific / technical calculation by Python] Numerical solution of one-dimensional and two-dimensional wave equations by FTCS method (explicit method), hyperbolic partial differential equations
[Science / technical calculation by Python] Numerical solution of first-order ordinary differential equations, initial value problem, numerical calculation
[Python] Heron's formula functionalization and calculation of the maximum area
[Numerical calculation method, python] Solving ordinary differential equations by Eular method
[Scientific / technical calculation by Python] Numerical solution of one-dimensional unsteady heat conduction equation by Crank-Nicholson method (implicit method) and FTCS method (positive solution method), parabolic partial differential equation
Multiple integrals with Python and Sympy
[Control engineering] Calculation of transfer functions and state space models by Python