python三角函数极限 python写三角函数( 三 )


integrate(cos(x), x)积分 。定积分integrate(exp(-x), (x, 0, oo))无穷大用2个oo表示 。integrate(exp(-x**2-y**2),(x,-oo,oo),(y,-oo,oo))二重积分 。print(expr)print的使用 。
expr = Integral(log(x)**2, x),expr.doit()积分得到x*log(x)**2 - 2*x*log(x) + 2*x 。
integ.doit()和integ = Integral((x**4 + x**2*exp(x) - x**2 - 2*x*exp(x) - 2*x -
exp(x))*exp(x)/((x - 1)**2*(x + 1)**2*(exp(x) + 1)), x)连用 。
limit(sin(x)/x,x,0),not-a-number表示nan算不出来,limit(expr, x, oo),,expr = Limit((cos(x) - 1)/x, x, 0),expr.doit()连用 。左右极限limit(1/x, x, 0, '+'),limit(1/x, x, 0, '-') 。。
【python三角函数极限 python写三角函数】Series Expansion级数展开 。expr = exp(sin(x)),expr.series(x, 0, 4)得到1 + x + x**2/2 + O(x**4) , ,x*O(1)得到O(x) , ,expr.series(x, 0, 4).removeO()将无穷小移除 。exp(x-6).series(x,x0=6),,得到
-5 + (x - 6)**2/2 + (x - 6)**3/6 + (x - 6)**4/24 + (x - 6)**5/120 + x + O((x - 6)**6, (x, 6))最高到5阶 。
f=Function('f')定义函数变量和h=Symbol('h')和d2fdx2=f(x).diff(x,2)求2阶,,as_finite_diff(dfdx)函数和as_finite_diff(d2fdx2,[-3*h,-h,2*h]),,x_list=[-3,1,2]和y_list=symbols('a b c')和apply_finite_diff(1,x_list,y_list,0) 。
Eq(x, y),,solveset(Eq(x**2, 1), x)解出来x,当二式相等 。和solveset(Eq(x**2 - 1, 0), x)等价 。solveset(x**2 - 1, x)
solveset(x**2 - x, x)解 , solveset(x - x, x, domain=S.Reals)解出来定义域 。solveset(exp(x), x)# No solution exists解出EmptySet()表示空集 。
等式形式linsolve([x + y + z - 1, x + y + 2*z - 3 ], (x, y, z))和矩阵法linsolve(Matrix(([1, 1, 1, 1], [1, 1, 2, 3])), (x, y, z))得到{(-y - 1, y, 2)}
A*x = b 形式 , M=Matrix(((1,1,1,1),(1,1,2,3))),system=A,b=M[:,:-1],M[:,-1],linsolve(system,x,y,z) , ,solveset(x**3 - 6*x**2 + 9*x, x)解多项式 。roots(x**3 - 6*x**2 + 9*x, x) , 得出,{3: 2, 0: 1},有2个3的重根,1个0根 。solve([x*y - 1, x - 2], x, y)解出坐标 。
f, g = symbols('f g', cls=Function)函数的定义,解微分方程diffeq = Eq(f(x).diff(x, x) - 2*f(x).diff(x) + f(x), sin(x))再和dsolve(diffeq,f(x))结合 。得到Eq(f(x), (C1 + C2*x)*exp(x) + cos(x)/2),dsolve(f(x).diff(x)*(1 - sin(f(x))), f(x))解出来Eq(f(x) + cos(f(x)), C1),,
Matrix([[1,-1],[3,4],[0,2]]),,Matrix([1, 2, 3])列表示 。M=Matrix([[1,2,3],[3,2,1]])
N=Matrix([0,1,1])
M*N符合矩阵的乘法 。M.shape显示矩阵的行列数 。
M.row(0)获取M的第0行 。M.col(-1)获取倒数第一列 。
M.col_del(0)删掉第1列 。M.row_del(1)删除第二行,序列是从0开始的 。M = M.row_insert(1, Matrix([[0, 4]]))插入第二行,,M = M.col_insert(0, Matrix([1, -2]))插入第一列 。
M+N矩阵相加,M*N , 3*M,M**2 , M**-1,N**-1表示求逆 。M.T求转置 。
eye(3)单位 。zeros(2, 3),0矩阵 , ones(3, 2)全1,diag(1, 2, 3)对角矩阵 。diag(-1, ones(2, 2), Matrix([5, 7, 5]))生成Matrix([
[-1, 0, 0, 0],
[ 0, 1, 1, 0],
[ 0, 1, 1, 0],
[ 0, 0, 0, 5],
[ 0, 0, 0, 7],
[ 0, 0, 0, 5]])矩阵 。
Matrix([[1, 0, 1], [2, -1, 3], [4, 3, 2]])
一行一行显示,,M.det()求行列式 。M.rref()矩阵化简 。得到结果为Matrix([
[1, 0,1,3],
[0, 1, 2/3, 1/3],
[0, 0,0,0]]), [0, 1]) 。
M = Matrix([[1, 2, 3, 0, 0], [4, 10, 0, 0, 1]]),M.nullspace()
Columnspace
M.columnspace()和M = Matrix([[1, 2, 3, 0, 0], [4, 10, 0, 0, 1]])
M = Matrix([[3, -2,4, -2], [5,3, -3, -2], [5, -2,2, -2], [5, -2, -3,3]])和M.eigenvals()得到{3: 1, -2: 1, 5: 2} , ,This means thatMhas eigenvalues -2, 3, and 5, and that the eigenvalues -2 and 3 have algebraic multiplicity 1 and that the eigenvalue 5 has algebraic multiplicity 2.
P, D = M.diagonalize(),P得Matrix([

推荐阅读