name: 一阶常微分方程 description: “一阶常微分方程在偏微分方程中的问题解决策略” allowed-tools: [Bash, Read]
一阶常微分方程
何时使用
在处理偏微分方程中的一阶常微分方程问题时使用此技能。
决策树
-
分类 ODE
- 线性:y’ + P(x)y = Q(x)?
- 可分离:y’ = f(x)g(y)?
- 精确:M(x,y)dx + N(x,y)dy = 0 且 dM/dy = dN/dx?
- 伯努利:y’ + P(x)y = Q(x)y^n?
-
选择求解方法
类型 方法 可分离 分离并积分 线性 积分因子 e^{int P dx} 精确 寻找势函数 伯努利 替换 v = y^{1-n} -
数值解(初值问题)
scipy.integrate.solve_ivp(f, [t0, tf], y0, method='RK45')- 对于刚性系统:
method='Radau'或method='BDF' - 自适应步长:指定 rtol/atol,而非步长
-
验证解
- 代回 ODE
- 检查初值/边界条件
sympy_compute.py dsolve "y' + y = x" --ics "{y(0): 1}"
-
相图(自治系统)
- 寻找平衡点:f(y*) = 0
- 分析稳定性:f’(y*) 的符号
z3_solve.py solve "dy/dt == 0"
工具命令
Scipy_Solve_Ivp
uv run python -c "from scipy.integrate import solve_ivp; sol = solve_ivp(lambda t, y: -y, [0, 5], [1]); print('y(5) =', sol.y[0][-1])"
Sympy_Dsolve
uv run python -m runtime.harness scripts/sympy_compute.py dsolve "Derivative(y,x) + y" --ics "{y(0): 1}"
Z3_Equilibrium
uv run python -m runtime.harness scripts/z3_solve.py solve "f(y_star) == 0"
关键技术
来自索引教材:
- [Elementary Differential Equations and… (Z-Library)] 使用 MATLAB 解 ODEs (New York: Cambridge REFERENCES cyan black NJ: Prentice-Hall, 1971). Mattheij, Robert, and Molenaar, Jaap, 常微分方程理论与实务 Shampine, Lawrence F. 常微分方程的数值解 (New York: Chapman and Shampine, L.
- [Elementary Differential Equations and… (Z-Library)] 微分方程:现代方法与应用导论 (2nd ed. 使用拉普拉斯变换解系统 2e−t 3t α1 α2 ,其中 α1 和 α2 是任意的。α1 和 α2 必须如何选择以使解与 Eq. 相同。
- [An Introduction to Numerical Analysis… (Z-Library)] 常微分方程的现代数值方法 Wiley, New York. DVERK 用户指南:解非刚性 ODEs 的子程序。Keller (1966), 数值方法分析。
- [Elementary Differential Equations and… (Z-Library)] 证明一阶 Adams–Bashforth 方法即欧拉方法,一阶 Adams–Moulton 方法即后向欧拉方法。证明三阶 Adams–Moulton 公式为 yn+1 = yn + (h/12)(5fn+1 + 8fn − fn−1)。推导 Eq. 给出的二阶后向差分公式。
- [An Introduction to Numerical Analysis… (Z-Library)] 非刚性常微分方程初值方法的测试结果,SIAM J. 比较数值方法 Fehlberg, E. 具有步长控制的四阶及更低阶经典 Runge-Kutta 公式及其在热传导问题中的应用,Computing 6, 61-71。
认知工具参考
完整工具文档请参阅 .claude/skills/math-mode/SKILL.md。