例1
用 MATLAB 验证换元积分结果
基础
动画演示
3 个公式
题目
用 MATLAB 求 $\int x\sqrt{1+x^2}\,\mathrm{d}x$,并与手算结果比较。
用到的公式
大学
凑微分
$x\mathrm{d}x=\frac12\mathrm{d}(1+x^2)$
大学
幂函数积分
$\int u^{\frac12}\mathrm{d}u=\frac23u^{\frac32}+C$
大学
MATLAB int
$\texttt{int(f,x)}$
解题步骤
1
手算:令 $u=1+x^2$,则 $\mathrm{d}u=2x\mathrm{d}x$,即 $x\mathrm{d}x=\frac12\mathrm{d}u$:
$$\int x\sqrt{1+x^2}\mathrm{d}x=\frac12\int u^{\frac12}\mathrm{d}u$$
2
用幂函数公式(指数 $\frac12$):
$$\frac12\cdot\frac{u^{\frac32}}{\frac32}=\frac13u^{\frac32}$$
3
换回 $x$:
$$\int x\sqrt{1+x^2}\mathrm{d}x=\frac13\left(1+x^2\right)^{\frac32}+C$$
4
机器验算:
$$\texttt{syms x; F = int(x*sqrt(1+x^2), x)}$$
输出 $(x^2+1)^{3/2}/3$,与手算一致(程序不写 +C)。
5
再用 diff 做反向检查,结果为 0 说明完全正确:
$$\texttt{simplify(diff(F,x) - x*sqrt(1+x^2))\ \to\ 0}$$
动画演示 · 被积函数 x√(1+x²)
答案
$\int x\sqrt{1+x^2}\mathrm{d}x=\dfrac13(1+x^2)^{\frac32}+C$,MATLAB 结果与之一致。
易错点 · 踩过才不会再踩
- 把 MATLAB 结果直接抄进作业而漏掉 $+C$。
- 结果形式不同就以为算错了:先用 diff 验证,再判断。
- sqrt 里写成 1+x^2 时忘了括号,导致运算顺序错。