有限差分是近似
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.