有限差分是近似
Agent 辅助工程检查
前提条件
完成前一项活动;如遇困难,使用列出的恢复来源。
学习目标
由导数定义实现前向、后向和中心有限差分,保持 h 显式可见,并与解析答案比较,而不是把近似当作精确值。
操作说明
1. 代入数字之前,先用符号 h 写出三种格式:前向 [f(a+h) - f(a)]/h,后向 [f(a) - f(a-h)]/h,中心 [f(a+h) - f(a-h)]/(2h)。保持 h 的符号可见。
2. 利用 Day 17 的结论(x^2 在 3 处的前向差商恰为 6 + h),预测哪种格式最接近 f'(3) = 6。
3. 只计算一次 f(3.1)、f(3) 和 f(2.9),然后在三种格式中复用这三个值。
4. 列表写出每个估计值及其带符号的误差(估计值 - 6)。
5. 用泰勒展开解释规律:对 x^2,前向误差恰为 +h,后向误差恰为 -h,二者在中心格式中相互抵消;下一项含 f''',而二次函数的 f''' 为零。
6. 说明哪些量是精确的(f'(3)、函数值),哪些是近似(一般情况下格式的输出),并解释为什么这里中心差分精确只是特例,而不是规律。
时间安排(120 分钟):阅读 30 + 练习 55 + 检查 35。 阅读:OpenStax 第 3.1 节(作为差商极限的导数)和 SciPy derivative 页面概述。练习:三种格式、误差表和泰勒解释。检查:独立完成 x=2、h=.01 的掌握题。
练习与预测记录
对 x=3 处的 f(x)=x^2,取 h=.1,计算前向 [f(3+h)-f(3)]/h、后向 [f(3)-f(3-h)]/h、中心 [f(3+h)-f(3-h)]/(2h)。预测哪个最接近 f'(3)=6。
代入数字前先写出差分格式(stencil),并保持 h 的符号。恢复:SciPy 导数参考中的数值约定;离线后备是这里的三个公式和多项式精确计算。
f(3.1)=9.61,f(2.9)=8.41。前向=(9.61-9)/.1=6.1;后向=(9-8.41)/.1=5.9;中心=(9.61-8.41)/.2=6.0。这里中心差分恰好精确,因为二次函数的三阶余项为零,但这并不普遍成立。
独立计算 f(x)=x^2 在 x=2、h=.01 处的三个估计值,与 4 比较,并说明哪些量是精确的、哪些是近似的。
权威来源资源与出处
OpenStax Calculus Volume 1
对应章节 / 时间戳: Sections 2.1-2.3 (Functions, Limits, and the Derivative); Sections 3.1-3.2 (Derivative Rules)
验证版本与日期: 3rd edition, verified 2026-10-30
Open, systematic treatment of the limit definition and derivative rules with stable section locations.
Algebra, coordinate geometry, and function notation
The authored derivations, tables, and exercises in these three Study Days are complete offline recovery material; use the linked section only for optional comparison.
对比候选资源与选型分析 (3)
Strong exercises and transcripts, but the noncommercial share-alike terms and course navigation make OpenStax the primary stable text.
Useful reference, but rights and redistribution terms are less suitable for embedded recovery material.
A primary API reference for numerical derivative step-size behavior; it complements rather than replaces the hand derivation.
SciPy numerical derivative reference
对应章节 / 时间戳: derivative API: finite differences, step-size iteration, tolerances
验证版本与日期: SciPy documentation, verified 2026-10-30
Documents numerical differentiation as an approximation with finite step sizes and stopping criteria.
Python arithmetic and the definition of a derivative
The local Day 18 tables and pure-Python snippets reproduce the relevant finite-difference behavior without SciPy.
对比候选资源与选型分析 (2)
Array-oriented gradient estimation on sampled grids; the SciPy derivative reference matches the pointwise finite-difference helper the exercises implement.
Symbolic rather than numerical differentiation; useful for exact cross-checks but not the finite-difference practice target.