MAPLE 1
f := x->;
fsolve(D(f)(x) = 0, x = range);
(D@@2)(f)(代入);
f := ;
s := fsolve(f = 0, z, complex);
s0 := map(abs, s);
max(s0);
with(plots);
plot(f, x= -1..1);
//记得要算两边端点
r := ;
polarplot(r, t = 0..2*Pi);
f := ;
g := ;
implicitplot({f,g}, x = -1..2, y = -1..2);
plot([x(t), y(t), t = 0..2 * Pi]);
maximize(f(x), x = 0..2*Pi, location);
minimize(f(x), x = 0..2*Pi, location);
solve({f(x) = 0, x >= 1, x <= 10}, x);
image: Pasted image 20251126034332.png
Pi, I, infinity, exp();
a := 1; //命名一个变量
f := x ^ 2 + y;
subs(x = 3, f); // 显示 9 + y;
subs(x = 3, y =1, f); //显示10;
evalf(Pi, 100); //精确到100位有效数字
simplify(f);
expand(f);
factor(f);
f := x-> x ^ 2;
f(5);
g :=(x, y)-> x * sin(y);
g(Pi, 1);
limit(f, x = 0);
limit(f, x = 0, left);
limit(f, x = -infinity);
//对表达式求导
diff(f, x);
diff(f, x$2);
implicitdiff(sin(x*y)=1, y, x);
//对函数求导
D(f);
D(f)(5);//代入5
(D@@2)(f);
int(f, x); //不定积分
int(f, x = 0..1); //定积分
set := {1,2,3};
list := [1,2,3];
sort(list); //只有list能排序
sum(i, i = 1..100); // 1 + 2 + ... + 100;
product(i, i = 1..100) // 1 * 2 * 3 * ... * 100;
eqn1 := x + y + z = 1;
eqn2 := 2 * x + y + z = 4;
eqn3 := 3 * x + y + z = 7;
solve({eqn1, eqn2, eqn3}, {x, y, z});
fslove({eqn1, eqn2, eqn3}, {x, y, z});
fsolve(x^5 - x - 1 = 0, x); // 寻找一个实数根
fsolve(x^2 + 1 = 0, x, complex); // 寻找复数根: -I, I
fslove(x^ 2 = 0, x, -1..10); // 限制解的范围
z := 3 + 4 * I;
Re(z);
Im(z);
abs(z);
argument(z);
conjugate(z);
with(plots);
plot(sin(x), x = -Pi..Pi);
plot(tan(x), x = -Pi..Pi, y = -10..10); // 限制绘图范围
//两图联立
f := x;
g := 2 * x;
plot({f,g},x = -100..100);
//参数方程(用[ ]把方程和变量括在一起)
plot([cos(t), sin(t), t = -Pi..Pi]);
ploarplot(1 + cos(t), t = 0..2 * Pi); // t 是角度,1 + cos(t)是距离
implicitplot(x ^ 2 + y ^ 2 = 1, x = -1..1, y = -1..1);
Matrix
<<1,2,3> | <4,5,6> | <7,8,9>> // 列表示法
<<1|2|3>, <4|5|6>, <7|8|9|>> // 行表示法
for i from 0 to n by step do
a[i] = a[i - 1] + 1:
end do:
f := proc(x)
local i, s;
s := 0;
for i from 1 to x do
s := s + i:
end do:
return s;
end proc;
Digits := 30;
f := proc(m)
local a, i;
a[0] := 0;
for i from 1 to m do
a[i] := sin((1 + (1/3)*a[i-1])^2):
end do:
if abs(a[m]-a[m-1]) < 10^(-19)
return a[m]
else
return -1
end if
end proc;
Calculus 笔记
可分离 ODE / 一阶 ODE
ode := diff(y(x), x) = x^4 * y(x)^2;
ic := y(3) = 5;
dsolve({ode, ic}, y(x));
两种写法都行:D(y)(x) 或 diff(y(x), x)
二阶常系数非齐次 ODE
ode := (D@@2)(y)(x) + 2*D(y)(x) + y(x) = 8*exp(-x);
dsolve(ode, y(x));
如果有初始条件就加上:dsolve({ode, y(0)=..., D(y)(0)=...}, y(x))
非线性二阶 ODE
ode := y(x) * (D@@2)(y)(x) + (D(y)(x))^2 = 0;
ic_1 := y(0) = 2;
ic_2 := D(y)(0) = 3;
dsolve({ode, ic_1, ic_2}, y(x));
答案只填等号右边,不含 y(x) =
Taylor 级数系数
taylor(exp(4*x)*sin(5*x), x = 0, 7);
coeftayl(exp(4*x)*sin(5*x), x = 0, 6);
taylor第三个参数是阶数,要看到 x⁶ 就写 7coeftayl直接取某一项的系数
递推数列
a[1] := 4: a[2] := -1: a[3] := 2:
for i from 3 to 99 do
a[i+1] := a[i] - 2*a[i-1] + a[i-2]
end do:
a[100];
循环里必须用 :=,用 = 不会赋值,只是一个等式表达式。
Exact ODE
M := 4*x^3*y^2 + 4;
N := 2*x^4*y - 4;
simplify(diff(M, y) - diff(N, x));
# 结果为 0 -> 恰当
矩阵与向量空间
Rank(A)-> rankColumnDimension(A) - Rank(A)-> nullityNullSpace(A)-> ker(A) 的基ColumnSpace(A)-> im(A) 的基
判断向量是否在 ker(A) 中:
- 算
NullSpace(A)看该向量能否由零空间基线性表示,或直接算A . Vector([...])看是否为零
判断向量是否在 im(A) 中:
LinearSolve(A, b)有解 -> 在 im(A) 中,报错 -> 不在
特征值,特征向量:
Eigenvalues
Eigenvectors:左边输出 Eigenvalues,右边输出对应的特征向量