SymPy Library Introduction
[SymPy official website] ( "http://www.sympy.org/en/index.html")
[API Manual] ( "http://www.sympy.org/en/index.html")
Basic usage
Symbols- symbol
* Import from SymPy >>>
>>> # two ways to create a symbol
>>> x, y, z = symbols ( 'xy z') # create a symbol X, Y, Z
>>> the Symbol T = ( 'T' ) # create a symbol t
Derivatives-导数
>>> diff (cos (x), x) # cos (x) for x derivative
-sin (x)
>>> the diff (exp (x ** 2), x) of the x # for x E derivative
* x * exp 2 (x ** 2)
>>> the diff (x ** 4, x, x, x) # x to the fourth power relative to x cubic guide
24⋅x
>>> the diff (x ** 4, x, 3) # 4 x to the power of the pilot cubic x
24⋅x
Integrals- Points
# Definite integrals definite integral
>>> integrate (exp (-x), (x, 0, oo)) -x # e side of the lower limit: the upper limit of 0: Infinite (o represents two letters) of the definite integral x demand
1
> >> integrate (exp (-x ** 2 - y ** 2), (x, -oo, oo), (y, -oo, oo)) # request double integral
π
# Indefinite integrals indefinite integral
>>> integrate (cos (x), x) # cos (x) for x indefinite integral
> sin (x)
Limits- limit
>>> limit (sin (x) / x, x, 0) # sin (x) / x x tends to zero at the limit
. 1
>>> limit (. 1 / x, x, 0, '+') # 1 / x in the x tends to limit 0+ when
∞
Application of Advanced Mathematics
Import SymPy * from
X = the Symbol ( 'X'); T = the Symbol ( 'T') define two variables #
LMT = limit (
(integrate (T * COS (T), (T, 0, X)) -. 1 COS + (X)) / (sqrt (X * Tan (X) + 1'd) -sqrt (SiN X * (X) + 1'd)),
X,
0)
Print (LMT) # -1/3