SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible in order to be comprehensible and easily extensible. SymPy is written entirely in Python.
online sympy https://www.sympygamma.com/
from sympy import *
#define variable
x = Symbol('x')
y = Symbol('y')
a, b, c = symbols('a,b,c')
#expand
expand((x + y)**3)
expand(sin(x+y),trig=True)
#simplify
simplify((x + x*y) / x)
#limit
#limit(function, variable, point)
limit(sin(x)/x,x,0)
limit(1/x, x, oo)
limit( (sin(x+y) - sin(x))/y,y,0)
#diff
#diff(func,var,n)
diff(sin(x),x)
diff(sin(x),x,2)
#taylor series
#series(expr, var)
series(sin(x),x)
#integrate
integrate(x**2,x)
integrate(2*x + sinh(x), x)
integrate(exp(-x**2)*erf(x), x)
-----
integrate(x**3, (x, -1, 1))
integrate(exp(-x), (x, 0, oo))
integrate(exp(-x**2), (x, -oo, oo))
#factor
factor(x**2-1)
#solve equation
solve(x**4 - 1, x)
solve([x + 5*y - 2, -3*x + 6*y - 15], [x, y])
#matrix
A = Matrix([[1,x], [y,1]])
#dsolve
f, g = symbols('f g', cls=Function)
dsolve(f(x).diff(x, x) + f(x), f(x))
from sympy import symbols integrate
a,b,k=symbols('a,b,k',real=True,positive=True)
f=k**2/(k**2+a**2)/(1+k**2*b**2)**(5/6)
g=integrate(f,(k,-oo,oo))
REFERENCE
https://wizardforcel.gitbooks.io/scipy-lecture-notes/content/15.html
REFERENCE
https://wizardforcel.gitbooks.io/scipy-lecture-notes/content/15.html
No comments:
Post a Comment