Find the derivative of the elementary function using sympy.
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)
From top to bottom, it is as follows.


Recommended Posts