五、数值积分和数值微分
基本概念
一般的数值积分公式为:
∫
a
b
f
(
x
)
d
x
≈
∑
k
=
0
n
A
k
f
(
x
k
)
\int_a^b f(x)dx \approx \sum_{k=0}^n A_kf(x_k)
∫abf(x)dx≈k=0∑nAkf(xk)
其中称
x
k
x_k
xk 为求积点,
A
k
A_k
Ak 为求积系数,记
I
(
f
)
=
∫
a
b
f
(
x
)
d
x
,
I
n
(
f
)
=
∑
k
=
0
n
A
k
f
(
x
k
)
I(f)=\int_a^bf(x)dx,\quad I_n(f)=\sum_{k=0}^n A_kf(x_k)
I(f)=∫abf(x)dx,In(f)=k=0∑nAkf(xk)
则求积公式的截断误差为
R
(
f
)
=
I
(
f
)
−
I
n
(
f
)
R(f) = I(f) - I_n(f)
R(f)=I(f)−In(f)
插值型求积公式
给定节点
a
≤
x
0
<
x
1
<
.
.
.
<
x
n
≤
b
a \le x_0 \lt x_1 \lt ... \lt x_n \le b
a≤x0<x1<...<xn≤b,已知
f
(
x
)
f(x)
f(x) 在这些点上的函数值为
f
(
x
i
)
,
(
i
=
0
,
1
,
.
.
.
,
n
)
f(x_i),\ (i=0,1,...,n)
f(xi), (i=0,1,...,n)。由插值理论,
f
(
x
)
f(x)
f(x) 的 n 次插值多项式为:
L
n
(
x
)
=
∑
k
=
0
n
f
(
x
k
)
l
k
(
x
)
=
∑
k
=
0
n
f
(
x
k
)
∏
j
=
0
,
j
≠
k
n
x
−
x
j
x
k
−
x
j
I
(
f
)
=
∫
a
b
f
(
x
)
d
x
≈
∫
a
b
L
n
(
x
)
d
x
=
∑
k
=
0
n
[
∫
a
b
l
k
(
x
)
d
x
]
f
(
x
k
)
=
∑
k
=
0
n
A
k
f
(
x
k
)
\begin{aligned} L_n(x) &= \sum_{k=0}^nf(x_k)l_k(x) = \sum_{k=0}^nf(x_k)\prod_{j=0,j\ne k}^n \frac{x-x_j}{x_k-x_j} \\ I(f) &= \int_a^bf(x)dx \approx \int_a^b L_n(x)dx = \sum_{k=0}^n [\int_a^bl_k(x)dx]f(x_k) = \sum_{k=0}^n A_kf(x_k) \end{aligned}
Ln(x)I(f)=k=0∑nf(xk)lk(x)=k=0∑nf(xk)j=0,j=k∏nxk−xjx−xj=∫abf(x)dx≈∫abLn(x)dx=k=0∑n[∫ablk(x)dx]f(xk)=k=0∑nAkf(xk)
其中,
A
k
=
∫
a
b
l
k
(
x
)
d
x
A_k = \int_a^bl_k(x)dx
Ak=∫ablk(x)dx。记
I
n
(
f
)
=
∑
k
=
0
n
A
k
f
(
x
k
)
I_n(f) = \sum_{k=0}^nA_kf(x_k)
In(f)=∑k=0nAkf(xk),则
I
(
f
)
≈
I
n
(
f
)
I(f) \approx I_n(f)
I(f)≈In(f)
- 设有计算积分 I ( f ) I(f) I(f) 的求积公式 I n ( f ) = ∑ k = 0 n A k f ( x k ) I_n(f)=\sum_{k=0}^nA_kf(x_k) In(f)=∑k=0nAkf(xk),且求积系数 A k = ∫ a b l k ( x ) d x , ( k = 0 , 1 , . . . , n ) A_k = \int_a^bl_k(x)dx,\ (k=0,1,...,n) Ak=∫ablk(x)dx, (k=0,1,...,n),则称该求积公式为插值型求积公式
- 记 R ( f ) = I ( f ) − I n ( f ) R(f)=I(f)-I_n(f) R(f)=I(f)−In(f),由插值多项式的余项得插值型求积公式的截断误差为
R ( f ) = ∫ a b f ( n + 1 ) ( ξ ) ( n + 1 ) ! ∏ i = 0 n ( x − x i ) d x , ξ ∈ ( a , b ) R(f) = \int_a^b\frac{f^{(n+1)}(\xi)}{(n+1)!}\prod_{i=0}^n(x-x_i)dx, \ \xi \in (a, b) R(f)=∫ab(n+1)!f(n+1)(ξ)i=0∏n(x−xi)dx, ξ∈(a,b)
Newton-Cotes 公式
- 如果求积点 x k ( k = 0 , 1 , . . . , n ) x_k(k=0,1,...,n) xk(k=0,1,...,n) 是等距的,即 x k = a + k h , h = b − a n , k = 0 , 1 , . . . , n x_k = a+kh,h=\frac{b-a}{n},k=0,1,...,n xk=a+kh,h=nb−a,k=0,1,...,n,则称对应的插值型求积公式为 Newton-cotes 公式
令
x
=
a
+
t
h
,
t
∈
[
0
,
n
]
x=a+th,t\in[0,n]
x=a+th,t∈[0,n],则
x
k
=
a
+
k
h
,
x
j
=
a
+
j
h
x_k = a+kh,x_j=a+jh
xk=a+kh,xj=a+jh,
A
k
=
∫
a
b
l
k
(
x
)
d
x
=
∫
a
b
∏
j
=
0
,
j
≠
k
n
x
−
x
j
x
k
−
x
j
d
x
=
h
∫
0
n
∏
j
=
0
,
j
≠
k
n
t
−
j
k
−
j
d
t
=
(
−
1
)
n
−
k
h
k
!
(
n
−
k
)
!
∫
0
n
∏
j
=
0
,
j
≠
k
n
(
t
−
j
)
d
t
=
(
b
−
a
)
(
−
1
)
n
−
k
n
×
k
!
(
n
−
k
)
!
∫
0
n
∏
j
=
0
,
j
≠
k
n
(
t
−
j
)
d
t
,
k
=
0
,
1
,
.
.
.
,
n
记
C
n
,
k
=
(
−
1
)
n
−
k
n
×
k
!
(
n
−
k
)
!
∫
0
n
∏
j
=
0
,
j
≠
k
n
(
t
−
j
)
d
t
,
k
=
0
,
1
,
.
.
.
,
n
则
N
e
w
t
o
n
−
C
o
t
e
s
公
式
可
写
为
I
n
(
f
)
=
(
b
−
a
)
∑
k
=
0
n
C
n
,
k
f
(
x
k
)
,
其
中
C
n
,
k
只
依
赖
于
k
和
n
\begin{aligned} A_k &= \int_a^bl_k(x)dx = \int_a^b\prod_{j=0,j\ne k}^n \frac{x-x_j}{x_k-x_j}dx = h\int_0^n\prod_{j=0,j \ne k}^n \frac{t-j}{k-j}dt \\ &=\frac{(-1)^{n-k}h}{k!(n-k)!}\int_0^n\prod_{j=0,j \ne k}^n(t-j)dt = (b-a)\frac{(-1)^{n-k}}{n\times k!(n-k)!}\int_0^n\prod_{j=0,j \ne k}^n(t-j)dt,\ k=0,1,...,n \\ 记\ C_{n,k}&=\frac{(-1)^{n-k}}{n\times k!(n-k)!}\int_0^n\prod_{j=0,j \ne k}^n(t-j)dt,\ k=0,1,...,n \qquad 则\ Newton-Cotes\ 公式可写为 \\ I_n(f) &= (b-a)\sum_{k=0}^nC_{n,k}f(x_k),\ 其中 \ C_{n,k}\ 只依赖于 k和n \end{aligned}
Ak记 Cn,kIn(f)=∫ablk(x)dx=∫abj=0,j=k∏nxk−xjx−xjdx=h∫0nj=0,j=k∏nk−jt−jdt=k!(n−k)!(−1)n−kh∫0nj=0,j=k∏n(t−j)dt=(b−a)n×k!(n−k)!(−1)n−k∫0nj=0,j=k∏n(t−j)dt, k=0,1,...,n=n×k!(n−k)!(−1)n−k∫0nj=0,j=k∏n(t−j)dt, k=0,1,...,n则 Newton−Cotes 公式可写为=(b−a)k=0∑nCn,kf(xk), 其中 Cn,k 只依赖于k和n
-
左/右/中矩形积分公式——对于函数 f ( x ) f(x) f(x) 在 [ a , b ] [a, b] [a,b] 上的积分有
- 左: ∫ a b f ( x ) d x ≈ ( b − a ) f ( a ) \int_a^bf(x)dx \approx (b-a)f(a) ∫abf(x)dx≈(b−a)f(a)
- 右: ∫ a b f ( x ) d x ≈ ( b − a ) f ( b ) \int_a^bf(x)dx \approx (b-a)f(b) ∫abf(x)dx≈(b−a)f(b)
- 中: ∫ a b f ( x ) d x ≈ ( b − a ) f ( a + b 2 ) \int_a^bf(x)dx \approx (b-a)f(\frac{a+b}{2}) ∫abf(x)dx≈(b−a)f(2a+b)
-
梯形公式:当 n = 1 , h = b − a , x 0 = a , x 1 = b n=1,h=b-a,x_0=a,x_1=b n=1,h=b−a,x0=a,x1=b 时有 C 1 , 0 = 1 2 , C 1 , 1 = 1 2 C_{1,0}=\frac{1}{2},C_{1,1}=\frac{1}{2} C1,0=21,C1,1=21,则
T ( f ) = b − a 2 [ f ( a ) + f ( b ) ] T(f)=\frac{b-a}{2}[f(a)+f(b)] T(f)=2b−a[f(a)+f(b)]
- 梯形公式的截断误差如下:
R T ( f ) = I ( f ) − T ( f ) = ∫ a b f ′ ′ ( ξ ) 2 ( x − a ) ( x − b ) d x = f ′ ′ ( η ) 2 ∫ a b ( x − a ) ( x − b ) d x = − ( b − a ) 3 12 f ′ ′ ( η ) , η ∈ ( a , b ) \begin{aligned} R_T(f) &= I(f)-T(f)=\int_a^b\frac{f^{''}(\xi)}{2}(x-a)(x-b)dx \\ &=\frac{f^{''}(\eta)}{2}\int_a^b(x-a)(x-b)dx = -\frac{(b-a)^3}{12}f^{''}(\eta),\ \eta \in (a,b) \end{aligned} RT(f)=I(f)−T(f)=∫ab2f′′(ξ)(x−a)(x−b)dx=2f′′(η)∫ab(x−a)(x−b)dx=−12(b−a)3f′′(η), η∈(a,b)
- Simpson 公式:当 n = 2 , h = b − a 2 , x 0 = a , x 1 = a + b 2 , x 2 = b n=2,h=\frac{b-a}{2},x_0=a,x_1=\frac{a+b}{2},x_2=b n=2,h=2b−a,x0=a,x1=2a+b,x2=b 时有 C 2 , 0 = 1 6 , C 2 , 1 = 2 3 , C 2 , 2 = 1 6 C_{2,0}=\frac{1}{6},C_{2,1}=\frac{2}{3},C_{2,2}=\frac{1}{6} C2,0=61,C2,1=32,C2,2=61,则
S ( f ) = b − a 6 [ f ( a ) + 4 f ( a + b 2 ) + f ( b ) ] S(f) = \frac{b-a}{6}[f(a)+4f(\frac{a+b}{2})+f(b)] S(f)=6b−a[f(a)+4f(2a+b)+f(b)]
- Simpson 公式的截断误差如下:
R S ( f ) = I ( f ) − S ( f ) = ∫ a b f ( x ) d x − ∫ a b H ( x ) d x = ∫ a b [ f ( x ) − H ( x ) ] d x = ∫ a b f ( 4 ) ( ξ ) 4 ( x − a ) ( x − a + b 2 ) 2 ( x − b ) d x = f ( 4 ) ( η ) 4 ∫ a b ( x − a ) ( x − a + b 2 ) 2 ( x − b ) d x = − b − a 180 ( b − a 2 ) 4 f ( 4 ) ( η ) , η ∈ ( a , b ) \begin{aligned} R_S(f) &= I(f) - S(f) = \int_a^bf(x)dx - \int_a^bH(x)dx = \int_a^b[f(x)-H(x)]dx \\ &= \int_a^b\frac{f^{(4)}(\xi)}{4}(x-a)(x-\frac{a+b}{2})^2(x-b)dx \\ &= \frac{f^{(4)}(\eta)}{4}\int_a^b(x-a)(x-\frac{a+b}{2})^2(x-b)dx \\ &= -\frac{b-a}{180}(\frac{b-a}{2})^4f^{(4)}(\eta),\ \eta \in (a,b) \end{aligned} RS(f)=I(f)−S(f)=∫abf(x)dx−∫abH(x)dx=∫ab[f(x)−H(x)]dx=∫ab4f(4)(ξ)(x−a)(x−2a+b)2(x−b)dx=4f(4)(η)∫ab(x−a)(x−2a+b)2(x−b)dx=−180b−a(2b−a)4f(4)(η), η∈(a,b)
- Cotes 公式(*):当 n = 4 , h = b − a 4 , x 0 = a , x 1 = 3 a + b 4 , x 2 = a + b 2 , x 3 = a + 3 b 4 , x 4 = b n=4,h=\frac{b-a}{4},x_0=a,x_1=\frac{3a+b}{4},x_2=\frac{a+b}{2},x_3=\frac{a+3b}{4},x_4=b n=4,h=4b−a,x0=a,x1=43a+b,x2=2a+b,x3=4a+3b,x4=b 时有 C 4 , 0 = 7 90 , C 4 , 1 = 32 90 , C 4 , 2 = 12 90 , C 4 , 3 = 32 90 , C 4 , 4 = 7 90 C_{4,0}=\frac{7}{90},C_{4,1}=\frac{32}{90},C_{4,2}=\frac{12}{90},C_{4,3}=\frac{32}{90},C_{4,4}=\frac{7}{90} C4,0=907,C4,1=9032,C4,2=9012,C4,3=9032,C4,4=907,则
C ( f ) = b − a 90 [ 7 f ( a ) + 32 f ( 3 a + b 4 ) + 12 f ( a + b 2 ) + 32 f ( a + 3 b 4 ) + 7 f ( b ) ] C(f) = \frac{b-a}{90}[7f(a)+32f(\frac{3a+b}{4})+12f(\frac{a+b}{2})+32f(\frac{a+3b}{4})+7f(b)] C(f)=90b−a[7f(a)+32f(43a+b)+12f(2a+b)+32f(4a+3b)+7f(b)]
- Cotes 公式的截断误差如下:
R C ( f ) = I ( f ) − C ( f ) = − 2 ( b − a ) 945 ( b − a 4 ) 6 f ( 6 ) ( η ) , η ∈ ( a , b ) R_C(f) = I(f)-C(f) = -\frac{2(b-a)}{945}(\frac{b-a}{4})^6f^{(6)}(\eta),\ \eta \in (a, b) RC(f)=I(f)−C(f)=−9452(b−a)(4b−a)6f(6)(η), η∈(a,b)
代数精度
- 对于求积公式 I ( f ) ≈ I n ( f ) = ∑ k = 0 n A k f ( x k ) I(f) \approx I_n(f) = \sum_{k=0}^n A_kf(x_k) I(f)≈In(f)=∑k=0nAkf(xk),如果对任意次数不超过 m 次的多项式 p m ( x ) p_m(x) pm(x),如 x m \pmb{x^m} xmxmxm ,有 I ( p m ) = I n ( p m ) I(p_m)=I_n(p_m) I(pm)=In(pm);而存在 m+1 次多项式 q m + 1 ( x ) q_{m+1}(x) qm+1(x),如 x m + 1 x^{m+1} xm+1,使得 I ( q m + 1 ) ≠ I n ( q m + 1 ) I(q_{m+1}) \ne I_n(q_{m+1}) I(qm+1)=In(qm+1),则称求积公式的代数精度为 m
- n+1 个节点的插值型求积公式的代数精度至少是 n
- 求积公式 I n ( f ) = ∑ k = 0 n A k f ( x k ) I_n(f) = \sum_{k=0}^nA_kf(x_k) In(f)=∑k=0nAkf(xk) 至少具有 n 次代数精度 ⇔ \Leftrightarrow ⇔ 该求积公式是插值型求积公式,即 A k = ∫ a b l k ( x ) d x , k = 0 , 1 , . . . , n A_k = \int_a^bl_k(x)dx,\ k=0,1,...,n Ak=∫ablk(x)dx, k=0,1,...,n
- 一般,对于 n+1 个节点的 Newton-Cotes(等距节点插值型)公式,若 n 为奇数,则代数精度为 n;若 n 为偶数,则代数精度为 n+1
复化求积公式
复化梯形公式
将区间
[
a
,
b
]
[a, b]
[a,b] 作
n
n
n 等分,记
h
=
b
−
a
n
,
x
k
=
a
+
k
h
,
k
=
0
,
1
,
.
.
.
,
n
h=\frac{b-a}{n},x_k = a+kh,k=0,1,...,n
h=nb−a,xk=a+kh,k=0,1,...,n
I
(
f
)
=
∫
a
b
f
(
x
)
d
x
=
∑
k
=
0
n
−
1
∫
x
k
x
k
+
1
f
(
x
)
d
x
I(f) = \int_a^bf(x)dx = \sum_{k=0}^{n-1}\int_{x_k}^{x_{k+1}}f(x)dx
I(f)=∫abf(x)dx=k=0∑n−1∫xkxk+1f(x)dx
对小区间上的积分
∫
x
k
x
k
+
1
f
(
x
)
d
x
\int_{x_k}^{x_{k+1}}f(x)dx
∫xkxk+1f(x)dx 应用梯形公式即可得到复化梯形公式
T
n
(
f
)
=
∑
k
=
0
n
−
1
h
2
[
f
(
x
k
)
+
f
(
x
k
+
1
)
]
T_n(f) = \sum_{k=0}^{n-1}\frac{h}{2}[f(x_k)+f(x_{k+1})]
Tn(f)=k=0∑n−12h[f(xk)+f(xk+1)]
其截断误差为
I
(
f
)
−
T
n
(
f
)
=
∑
k
=
0
n
−
1
∫
x
k
x
k
+
1
f
(
x
)
d
x
−
∑
k
=
0
n
−
1
h
2
[
f
(
x
k
)
+
f
(
x
k
+
1
)
]
=
∑
k
=
0
n
−
1
[
−
h
3
12
f
′
′
(
η
k
)
]
,
η
k
∈
[
x
k
,
x
k
+
1
]
\begin{aligned} I(f)-T_n(f) &= \sum_{k=0}^{n-1}\int_{x_k}^{x_{k+1}}f(x)dx - \sum_{k=0}^{n-1}\frac{h}{2}[f(x_k)+f(x_{k+1})] \\ &= \sum_{k=0}^{n-1}[-\frac{h^3}{12}f^{''}(\eta_k)],\ \eta_k \in [x_k, x_{k+1}] \end{aligned}
I(f)−Tn(f)=k=0∑n−1∫xkxk+1f(x)dx−k=0∑n−12h[f(xk)+f(xk+1)]=k=0∑n−1[−12h3f′′(ηk)], ηk∈[xk,xk+1]
设
f
(
x
)
∈
C
2
[
a
,
b
]
f(x) \in C^2[a, b]
f(x)∈C2[a,b],则由连续函数介值定理,
∃
η
∈
(
a
,
b
)
\exists \eta \in (a, b)
∃η∈(a,b),使
1
n
∑
k
=
0
n
−
1
f
′
′
(
η
k
)
=
f
′
′
(
η
)
\frac{1}{n}\sum_{k=0}^{n-1}f^{''}(\eta_k)=f^{''}(\eta)
n1∑k=0n−1f′′(ηk)=f′′(η),故
T
n
(
f
)
T_n(f)
Tn(f) 的截断误差为
I
(
f
)
−
T
n
(
f
)
=
−
h
3
12
n
f
′
′
(
η
)
=
−
b
−
a
12
h
2
f
′
′
(
η
)
I(f)-T_n(f) = -\frac{h^3}{12}nf^{''}(\eta) = -\frac{b-a}{12}h^2f^{''}(\eta)
I(f)−Tn(f)=−12h3nf′′(η)=−12b−ah2f′′(η)
- 先验误差估计:记 M 2 = max a ≤ x ≤ b ∣ f ′ ′ ( x ) ∣ M_2 = \max_{a \le x\le b}|f^{''}(x)| M2=maxa≤x≤b∣f′′(x)∣,对于给定精度 $\epsilon $,只要 b − a 12 M 2 h 2 ≤ ϵ \frac{b-a}{12}M_2h^2 \le \epsilon 12b−aM2h2≤ϵ,则有先验误差估计
∣ I ( f ) − T n ( f ) ∣ = b − a 12 h 2 ∣ f ′ ′ ( η ) ∣ ≤ b − a 12 M 2 h 2 ≤ ϵ |I(f)-T_n(f)| = \frac{b-a}{12}h^2|f^{''}(\eta)| \le \frac{b-a}{12}M_2h^2 \le \epsilon ∣I(f)−Tn(f)∣=12b−ah2∣f′′(η)∣≤12b−aM2h2≤ϵ
-
后验误差估计:$|I(f)-T_{2n}(f)| \approx \frac{1}{3}|T_{2n}(f)-T_n(f)| \le \epsilon $
- 当 h 很小时有, I ( f ) − T n ( f ) ≈ h 2 12 [ f ′ ( a ) − f ′ ( b ) ] I(f)-T_n(f) \approx \frac{h^2}{12}[f^{'}(a)-f^{'}(b)] I(f)−Tn(f)≈12h2[f′(a)−f′(b)]
- 将 [ a , b ] [a, b] [a,b] 进行 2 等分有, I ( f ) − T 2 n ( f ) ≈ 1 12 ( h 2 ) 2 [ f ′ ( a ) − f ′ ( b ) ] I(f)-T_{2n}(f) \approx \frac{1}{12}(\frac{h}{2})^2[f^{'}(a)-f^{'}(b)] I(f)−T2n(f)≈121(2h)2[f′(a)−f′(b)]
- 假设 T n ( f ) T_n(f) Tn(f) 已知,则 T 2 n ( f ) = 1 2 T n ( f ) + h 2 ∑ k = 0 n − 1 f [ 1 2 ( x k + x k + 1 ) ] T_{2n}(f) = \frac{1}{2}T_n(f)+\frac{h}{2}\sum_{k=0}^{n-1}f[\frac{1}{2}(x_k+x_{k+1})] T2n(f)=21Tn(f)+2h∑k=0n−1f[21(xk+xk+1)],其中 h h h 为计算 T n ( f ) T_n(f) Tn(f) 时的步长
复化 Simpson 公式
记
x
k
+
1
2
=
1
2
(
x
k
+
x
k
+
1
)
x_{k+\frac{1}{2}} = \frac{1}{2}(x_k+x_{k+1})
xk+21=21(xk+xk+1),对每个小区间上积分
∫
x
k
x
k
+
1
f
(
x
)
d
x
\int_{x_k}^{x_{k+1}}f(x)dx
∫xkxk+1f(x)dx 应用 Simpson 公式即可得到复化 Simpson 公式:
S
n
(
f
)
=
∑
k
=
0
n
−
1
h
6
[
f
(
x
k
)
+
4
f
(
x
k
+
1
2
)
+
f
(
x
k
+
1
)
]
S_n(f) = \sum_{k=0}^{n-1}\frac{h}{6}[f(x_k)+4f(x_{k+\frac{1}{2}})+f(x_{k+1})]
Sn(f)=k=0∑n−16h[f(xk)+4f(xk+21)+f(xk+1)]
其截断误差为
I
(
f
)
−
S
n
(
f
)
=
∑
k
=
0
n
−
1
−
h
180
(
h
2
)
4
f
(
4
)
(
η
k
)
=
−
h
180
(
h
2
)
4
∑
k
=
0
n
−
1
f
(
4
)
(
η
k
)
,
η
k
∈
[
x
k
,
x
k
+
1
]
I(f)-S_n(f) = \sum_{k=0}^{n-1}-\frac{h}{180}(\frac{h}{2})^4f^{(4)}(\eta_k) = -\frac{h}{180}(\frac{h}{2})^4\sum_{k=0}^{n-1}f^{(4)}(\eta_k) ,\ \eta_k \in [x_k, x_{k+1}]
I(f)−Sn(f)=k=0∑n−1−180h(2h)4f(4)(ηk)=−180h(2h)4k=0∑n−1f(4)(ηk), ηk∈[xk,xk+1]
设
f
(
x
)
∈
C
4
[
a
,
b
]
f(x) \in C^4[a, b]
f(x)∈C4[a,b],由连续函数介值定理,
∃
η
∈
(
a
,
b
)
\exists \eta \in (a,b)
∃η∈(a,b),使
1
n
∑
k
=
0
n
−
1
f
(
4
)
(
η
k
)
=
f
(
4
)
(
η
)
\frac{1}{n}\sum_{k=0}^{n-1}f^{(4)}(\eta_k) = f^{(4)}(\eta)
n1∑k=0n−1f(4)(ηk)=f(4)(η),故
S
n
(
f
)
S_n(f)
Sn(f) 的截断误差为
I
(
f
)
−
S
n
(
f
)
=
−
h
180
(
h
2
)
4
n
f
(
4
)
(
η
)
=
−
b
−
a
180
(
h
2
)
4
f
(
4
)
(
η
)
,
η
∈
(
a
,
b
)
I(f)-S_n(f)=-\frac{h}{180}(\frac{h}{2})^4nf^{(4)}(\eta)=-\frac{b-a}{180}(\frac{h}{2})^4f^{(4)}(\eta),\ \eta \in (a, b)
I(f)−Sn(f)=−180h(2h)4nf(4)(η)=−180b−a(2h)4f(4)(η), η∈(a,b)
- 先验误差估计:记 M 4 = max a ≤ x ≤ b ∣ f ( 4 ) ( x ) ∣ M_4 = \max_{a \le x \le b}|f^{(4)}(x)| M4=maxa≤x≤b∣f(4)(x)∣,对给定的精度 ϵ \epsilon ϵ,选取 h h h 使得 b − a 180 ( h 2 ) 4 M 4 ≤ ϵ \frac{b-a}{180}(\frac{h}{2})^4M_4\le\epsilon 180b−a(2h)4M4≤ϵ,则有先验误差估计
∣ I ( f ) − S n ( f ) ∣ ≤ b − a 180 ( h 2 ) 4 M 4 ≤ ϵ |I(f)-S_n(f)| \le \frac{b-a}{180}(\frac{h}{2})^4M_4 \le \epsilon ∣I(f)−Sn(f)∣≤180b−a(2h)4M4≤ϵ
-
后验误差估计:
∣
I
(
f
)
−
S
2
n
(
f
)
∣
≈
1
15
∣
S
2
n
(
f
)
−
S
n
(
f
)
∣
≤
ϵ
|I(f)-S_{2n}(f)| \approx \frac{1}{15}|S_{2n}(f)-S_n(f)| \le \epsilon
∣I(f)−S2n(f)∣≈151∣S2n(f)−Sn(f)∣≤ϵ
- 当 h h h 很小时, I ( f ) − S n ( f ) ≈ 1 180 [ f ( 3 ) ( a ) − f ( 3 ) ( b ) ] ( h 2 ) 4 I(f)-S_n(f) \approx \frac{1}{180}[f^{(3)}(a)-f^{(3)}(b)](\frac{h}{2})^4 I(f)−Sn(f)≈1801[f(3)(a)−f(3)(b)](2h)4
- I ( f ) − S 2 n ( f ) ≈ 1 180 [ f ( 3 ) ( a ) − f ( 3 ) ( b ) ] ( h 2 2 ) 4 I(f)-S_{2n}(f) \approx \frac{1}{180}[f^{(3)}(a)-f^{(3)}(b)](\frac{\frac{h}{2}}{2})^4 I(f)−S2n(f)≈1801[f(3)(a)−f(3)(b)](22h)4
复化 Cotes 公式(*)
记
x
k
+
1
4
=
x
k
+
1
4
h
,
x
k
+
1
2
=
x
k
+
1
2
h
,
x
k
+
3
4
=
x
k
+
3
4
h
x_{k+\frac{1}{4}}=x_k+\frac{1}{4}h,\ x_{k+\frac{1}{2}}=x_k+\frac{1}{2}h,\ x_{k+\frac{3}{4}}=x_k+\frac{3}{4}h
xk+41=xk+41h, xk+21=xk+21h, xk+43=xk+43h,对积分
∫
x
k
x
k
+
1
f
(
x
)
d
x
\int_{x_k}^{x_{k+1}}f(x)dx
∫xkxk+1f(x)dx 应用 Cotes 公式即可得到复化 Cotes 公式
C
n
(
f
)
=
∑
k
=
0
n
−
1
h
90
[
7
f
(
x
k
)
+
32
f
(
x
x
+
1
4
)
+
12
f
(
x
k
+
1
2
)
+
32
f
(
x
k
+
3
4
)
+
7
f
(
x
k
+
1
)
]
C_n(f) = \sum_{k=0}^{n-1}\frac{h}{90}[7f(x_k)+32f(x_{x+\frac{1}{4}})+12f(x_{k+\frac{1}{2}})+32f(x_{k+\frac{3}{4}})+7f(x_{k+1})]
Cn(f)=k=0∑n−190h[7f(xk)+32f(xx+41)+12f(xk+21)+32f(xk+43)+7f(xk+1)]
其截断误差为
I
(
f
)
−
C
n
(
f
)
=
−
2
(
b
−
a
)
945
(
h
2
)
6
f
(
6
)
(
η
)
,
η
∈
(
a
,
b
)
I(f)-C_n(f)=-\frac{2(b-a)}{945}(\frac{h}{2})^6f^{(6)}(\eta),\ \eta \in (a, b)
I(f)−Cn(f)=−9452(b−a)(2h)6f(6)(η), η∈(a,b)
当 h 很小时有
- I ( f ) − C n ( f ) ≈ 2 945 [ f ( 5 ) ( a ) − f ( 5 ) ( b ) ] ( h 2 ) 6 I(f)-C_n(f) \approx \frac{2}{945}[f^{(5)}(a)-f^{(5)}(b)](\frac{h}{2})^6 I(f)−Cn(f)≈9452[f(5)(a)−f(5)(b)](2h)6
- I ( f ) − C 2 n ( f ) ≈ 1 63 [ C 2 n ( f ) − C n ( f ) ] I(f)-C_{2n}(f) \approx \frac{1}{63}[C_{2n}(f)-C_n(f)] I(f)−C2n(f)≈631[C2n(f)−Cn(f)]
复化求积公式的阶数
设有计算积分
I
(
f
)
I(f)
I(f) 的复化求积公式
I
n
(
f
)
I_n(f)
In(f),如果存在正整数
p
p
p 和非零常数
C
C
C,使
lim
h
→
0
I
(
f
)
−
I
n
(
f
)
h
p
=
C
\lim_{h \rightarrow 0} \frac{I(f)-I_n(f)}{h^p}=C
h→0limhpI(f)−In(f)=C
则称公式
I
n
(
f
)
I_n(f)
In(f) 是
p
p
p 阶的,即截断误差为:
R
(
f
)
=
I
(
f
)
−
I
n
(
f
)
=
O
(
h
p
)
R(f)=I(f)-I_n(f)=O(h^p)
R(f)=I(f)−In(f)=O(hp)
- 复化梯形公式为 2 阶;复化 Simpson 公式为 4 阶;复化 Cotes 公式为 6 阶
- S n ( f ) = 4 3 T 2 n ( f ) − 1 3 T n ( f ) S_n(f)=\frac{4}{3}T_{2n}(f)-\frac{1}{3}T_n(f) Sn(f)=34T2n(f)−31Tn(f)
- C n ( f ) = 16 15 S 2 n ( f ) − 1 15 S n ( f ) C_n(f)=\frac{16}{15}S_{2n}(f)-\frac{1}{15}S_n(f) Cn(f)=1516S2n(f)−151Sn(f)
- Romberg 公式: R n ( f ) = 64 63 C 2 n ( f ) − 1 63 C n ( f ) R_n(f)=\frac{64}{63}C_{2n}(f)-\frac{1}{63}C_n(f) Rn(f)=6364C2n(f)−631Cn(f)(会算即可)
- Romberg 公式的截断误差为 O ( h 8 ) O(h^8) O(h8),从而有 I ( f ) − R 2 n ( f ) ≈ 1 255 [ R 2 n ( f ) − R n ( f ) ] I(f)-R_{2n}(f) \approx \frac{1}{255}[R_{2n}(f)-R_n(f)] I(f)−R2n(f)≈2551[R2n(f)−Rn(f)]
Gauss 求积公式
设
I
(
f
)
=
∫
a
b
f
(
x
)
d
x
I(f)=\int_a^b f(x)dx
I(f)=∫abf(x)dx,
I
n
(
f
)
=
∑
k
=
0
n
A
k
f
(
x
k
)
I_n(f)=\sum_{k=0}^nA_kf(x_k)
In(f)=∑k=0nAkf(xk),
I
n
(
f
)
I_n(f)
In(f) 是求积公式
I
(
f
)
I(f)
I(f) 的求积公式,如果求积公式
I
n
(
f
)
I_n(f)
In(f) 的代数精度是 (2n+1),则称该公式为 Gauss-Legendre 公式,简称 Gauss 公式,对应的求积点
x
k
(
k
=
0
,
1
,
.
.
.
,
n
)
x_k(k=0,1,...,n)
xk(k=0,1,...,n) 称为 Gauss 点。由代数精度知,求积公式
I
(
f
)
≈
I
n
(
f
)
I(f) \approx I_n(f)
I(f)≈In(f) 的代数精度为
(
2
n
+
1
)
↔
∫
a
b
x
i
d
x
=
∑
k
=
0
n
A
k
x
k
i
,
i
=
0
,
1
,
.
.
.
,
2
n
+
1
(2n+1) \leftrightarrow \int_a^bx^idx=\sum_{k=0}^nA_kx_k^i, \ \ i=0,1,...,2n+1
(2n+1)↔∫abxidx=k=0∑nAkxki, i=0,1,...,2n+1
例1:考虑求积公式
∫
−
1
1
f
(
x
)
d
x
≈
A
0
f
(
x
0
)
+
A
1
f
(
x
1
)
\int_{-1}^1 f(x) dx \approx A_0f(x_0)+A_1f(x_1)
∫−11f(x)dx≈A0f(x0)+A1f(x1) 决定求积系数
A
0
A_0
A0,
A
1
A_1
A1 和求积点
x
0
x_0
x0,
x
1
x_1
x1,使其成为 2 点 Gauss 公式
解:n = 1,即要使公式的代数精度为 2+1=3,由代数精度可得
f
(
x
)
=
1
,
A
0
+
A
1
=
∫
−
1
1
1
d
x
=
2
f
(
x
)
=
x
,
A
0
x
0
+
A
1
x
1
=
∫
−
1
1
x
d
x
=
0
f
(
x
)
=
x
2
,
A
0
x
0
2
+
A
1
x
1
2
=
∫
−
1
1
x
2
d
x
=
2
3
f
(
x
)
=
x
3
,
A
0
x
0
3
+
A
1
x
1
3
=
∫
−
1
1
x
3
d
x
=
0
\begin{aligned} f(x) &= 1,\quad A_0+A_1=\int_{-1}^1 1dx=2 \\ f(x) &= x,\quad A_0x_0+A_1x_1=\int_{-1}^1 xdx=0 \\ f(x) &= x^2,\quad A_0x_0^2+A_1x_1^2=\int_{-1}^1x^2dx=\frac{2}{3} \\ f(x) &= x^3,\quad A_0x_0^3+A_1x_1^3=\int_{-1}^1 x^3 dx = 0 \end{aligned}
f(x)f(x)f(x)f(x)=1,A0+A1=∫−111dx=2=x,A0x0+A1x1=∫−11xdx=0=x2,A0x02+A1x12=∫−11x2dx=32=x3,A0x03+A1x13=∫−11x3dx=0
求得
A
0
=
A
1
=
1
A_0=A_1=1
A0=A1=1,
x
0
=
−
1
3
x_0=-\frac{1}{\sqrt{3}}
x0=−3
1,
x
1
=
1
3
x_1=\frac{1}{\sqrt{3}}
x1=3
1,故
[
−
1
,
1
]
[-1,1]
[−1,1] 上两点 Gauss 公式为
∫
−
1
1
f
(
x
)
d
x
≈
f
(
−
1
3
)
+
f
(
1
3
)
\int_{-1}^1f(x)dx \approx f(-\frac{1}{\sqrt{3}})+f(\frac{1}{\sqrt{3}})
∫−11f(x)dx≈f(−3
1)+f(3
1)
- 设 I ( f ) = ∫ a b f ( x ) d x I(f)=\int_a^bf(x)dx I(f)=∫abf(x)dx, I n ( f ) = ∑ k = 0 n A k f ( x k ) I_n(f)=\sum_{k=0}^nA_kf(x_k) In(f)=∑k=0nAkf(xk), I n ( f ) I_n(f) In(f) 是计算积分 I ( f ) I(f) I(f) 的插值型求积公式,记
W n + 1 ( x ) = ( x − x 0 ) ( x − x 1 ) . . . ( x − x n ) W_{n+1}(x)=(x-x_0)(x-x_1)...(x-x_n) Wn+1(x)=(x−x0)(x−x1)...(x−xn)
则求积公式
I
(
f
)
≈
I
n
(
f
)
I(f) \approx I_n(f)
I(f)≈In(f) 是 Gauss 求积公式
↔
\leftrightarrow
↔
W
n
+
1
(
x
)
W_{n+1}(x)
Wn+1(x) 与任意一个次数不超过
n
n
n 的多项式
p
(
x
)
p(x)
p(x) 正交,即
∫
a
b
p
(
x
)
W
n
+
1
(
x
)
d
x
=
0
\int_a^bp(x)W_{n+1}(x)dx = 0
∫abp(x)Wn+1(x)dx=0
- 设 g n ( x ) = a n , 0 x n + a n , 1 x n − 1 + . . . + a n , n − 1 x + a n , n , n = 0 , 1 , 2 , . . . g_n(x)=a_{n,0}x^n+a_{n,1}x^{n-1}+...+a_{n,n-1}x+a_{n,n},n=0,1,2,... gn(x)=an,0xn+an,1xn−1+...+an,n−1x+an,n,n=0,1,2,...,其中 a n , 0 ≠ 0 a_{n,0}\ne 0 an,0=0。如果对任意的 i , j = 0 , 1 , . . . , i ≠ j i,j=0,1,...,i\ne j i,j=0,1,...,i=j 有
( g i , g j ) = ∫ a b g i ( x ) g j ( x ) d x = 0 (g_i, g_j) = \int_a^bg_i(x)g_j(x)dx=0 (gi,gj)=∫abgi(x)gj(x)dx=0
则称 { g k ( x ) } k = 0 ∞ \{g_k(x)\}_{k=0}^\infty {gk(x)}k=0∞ 为区间 [ a , b ] [a,b] [a,b] 上的正交多项式序列,称 g n ( x ) g_n(x) gn(x) 为区间 [ a , b ] [a,b] [a,b] 上的 n n n 次正交多项式
- 设 { g k ( x ) } k = 0 ∞ \{g_k(x)\}_{k=0}^\infty {gk(x)}k=0∞ 为区间 [ a , b ] [a,b] [a,b] 上的正交多项式序列,则对任意的 n n n,多项式 g 0 ( x ) , g 1 ( x ) , . . . , g n ( x ) g_0(x),g_1(x),...,g_n(x) g0(x),g1(x),...,gn(x) 线性无关
- 设 { g k ( x ) } k = 0 ∞ \{g_k(x)\}_{k=0}^\infty {gk(x)}k=0∞ 为区间 [ a , b ] [a,b] [a,b] 上的正交多项式序列,则 g n ( x ) g_n(x) gn(x) 在 ( a , b ) (a,b) (a,b) 上有 n \pmb{n} nnn 个不同的实零点
n 次勒让德(Legendre)多项式:
P
n
(
t
)
=
1
2
n
n
!
d
n
(
t
2
−
1
)
n
d
t
n
,
n
=
0
,
1
,
2
,
.
.
.
P_n(t) = \frac{1}{2^nn!}\frac{d^n(t^2-1)^n}{dt^n},\ n=0,1,2,...
Pn(t)=2nn!1dtndn(t2−1)n, n=0,1,2,...
- Legendre 多项式序列 { P k ( t ) } k = 0 ∞ \{P_k(t)\}_{k=0}^{\infty} {Pk(t)}k=0∞ 是区间 [ − 1 , 1 ] [-1,1] [−1,1] 上的正交多项式序列
- n + 1 n+1 n+1 次 Legendre 多项式 P n + 1 ( t ) P_{n+1}(t) Pn+1(t) 的零点就是 Gauss 公式的节点
区间 [ − 1 , 1 ] [-1,1] [−1,1] 上的 Gauss 公式
I ( g ) ≈ ∫ − 1 1 g ( t ) d t ≈ ∑ k = 0 n A k ~ g ( t k ) A k ~ = ∫ − 1 1 ∏ j = 0 , j ≠ k n t − t j t k − t j d t , k = 0 , 1 , . . . , n \begin{aligned} I(g) &\approx \int_{-1}^1g(t)dt \approx \sum_{k=0}^n \tilde{A_k}g(t_k) \\ \tilde{A_k} &= \int_{-1}^1 \prod_{j=0,j \ne k}^n \frac{t-t_j}{t_k-t_j}dt,\ k = 0,1,...,n \end{aligned} I(g)Ak~≈∫−11g(t)dt≈k=0∑nAk~g(tk)=∫−11j=0,j=k∏ntk−tjt−tjdt, k=0,1,...,n
- 当 n = 0 n=0 n=0 时, t 0 = 0 t_0=0 t0=0, A 0 ~ = 2 \tilde{A_0}=2 A0~=2,得 1 个节点的 Gauss 公式
∫ − 1 1 g ( t ) d t ≈ 2 g ( 0 ) \int_{-1}^1g(t)dt \approx 2g(0) ∫−11g(t)dt≈2g(0)
- 当 n = 1 n=1 n=1 时, t 0 = − 1 3 t_0=-\frac{1}{\sqrt{3}} t0=−3 1, t 1 = 1 3 t_1=\frac{1}{\sqrt{3}} t1=3 1, A 0 ~ = A 1 ~ = 1 \tilde{A_0}=\tilde{A_1}=1 A0~=A1~=1,得 2 个节点的 Gauss 公式
∫ − 1 1 g ( t ) d t ≈ g ( − 1 3 ) + g ( 1 3 ) \int_{-1}^1 g(t)dt \approx g(-\frac{1}{\sqrt{3}})+g(\frac{1}{\sqrt{3}}) ∫−11g(t)dt≈g(−3 1)+g(3 1)
- 当 n = 2 n=2 n=2 时, t 0 = − 3 5 t_0=-\sqrt{\frac{3}{5}} t0=−53 , t 1 = 0 t_1=0 t1=0, t 2 = 3 5 t_2=\sqrt{\frac{3}{5}} t2=53 , A 0 ~ = A 2 ~ = 5 9 \tilde{A_0}=\tilde{A_2}=\frac{5}{9} A0~=A2~=95, A 1 ~ = 8 9 \tilde{A_1}=\frac{8}{9} A1~=98,得 3 点 Gauss 公式
∫ − 1 1 g ( t ) d t ≈ 5 9 g ( − 3 5 ) + 8 9 g ( 0 ) + 5 9 g ( 3 5 ) \int_{-1}^1 g(t)dt \approx \frac{5}{9}g(-\sqrt{\frac{3}{5}})+\frac{8}{9}g(0)+\frac{5}{9}g(\sqrt{\frac{3}{5}}) ∫−11g(t)dt≈95g(−53 )+98g(0)+95g(53 )
区间 [ a , b ] [a,b] [a,b] 上的 Gauss 公式
作变换
x
=
a
+
b
2
+
b
−
a
2
t
\pmb{x=\frac{a+b}{2}+\frac{b-a}{2}t}
x=2a+b+2b−atx=2a+b+2b−atx=2a+b+2b−at,可得
I
(
f
)
=
∫
a
b
f
(
x
)
d
x
=
∫
−
1
1
b
−
a
2
f
(
a
+
b
2
+
b
−
a
2
t
)
d
t
I(f) = \int_a^b f(x)dx = \int_{-1}^1\frac{b-a}{2}f(\frac{a+b}{2}+\frac{b-a}{2}t)dt
I(f)=∫abf(x)dx=∫−112b−af(2a+b+2b−at)dt
由
[
−
1
,
1
]
[-1,1]
[−1,1] 上的 Gauss 公式得
[
a
,
b
]
[a, b]
[a,b] 上的 Gauss 公式为
I
n
(
f
)
=
∑
k
=
0
n
b
−
a
2
A
k
~
f
(
a
+
b
2
+
b
−
a
2
t
k
)
I_n(f) = \sum_{k=0}^n\frac{b-a}{2}\tilde{A_k}f(\frac{a+b}{2}+\frac{b-a}{2}t_k)
In(f)=k=0∑n2b−aAk~f(2a+b+2b−atk)
Gauss 公式的截断误差
设
f
(
x
)
∈
C
2
n
+
2
[
a
,
b
]
f(x) \in C^{2n+2}[a,b]
f(x)∈C2n+2[a,b],则 Gauss 公式
∫
a
b
f
(
x
)
d
x
≈
∑
k
=
0
n
A
k
f
(
x
k
)
\int_a^bf(x)dx \approx \sum_{k=0}^nA_kf(x_k)
∫abf(x)dx≈∑k=0nAkf(xk) 的截断误差为
R
(
f
)
=
∫
a
b
f
(
x
)
d
x
−
∑
k
=
0
n
A
k
f
(
x
k
)
=
f
(
2
n
+
2
)
(
ξ
)
(
2
n
+
2
)
!
∫
a
b
W
n
+
1
2
(
x
)
d
x
R(f) = \int_a^bf(x)dx - \sum_{k=0}^nA_kf(x_k) = \frac{f^{(2n+2)}(\xi)}{(2n+2)!}\int_a^bW_{n+1}^2(x)dx
R(f)=∫abf(x)dx−k=0∑nAkf(xk)=(2n+2)!f(2n+2)(ξ)∫abWn+12(x)dx
其中, W n + 1 ( x ) = ∏ j = 0 n ( x − x j ) , ξ ∈ ( a , b ) W_{n+1}(x)=\prod_{j=0}^n(x-x_j),\ \xi\in(a,b) Wn+1(x)=∏j=0n(x−xj), ξ∈(a,b)
Gauss 公式的稳定性和收敛性
- Gauss 公式 ∫ a b f ( x ) d x ≈ ∑ k = 0 n A k f ( x k ) \int_a^bf(x)dx \approx \sum_{k=0}^nA_kf(x_k) ∫abf(x)dx≈∑k=0nAkf(xk) 的求积系数 A k > 0 ( k = 0 , 1 , . . . , n ) A_k \gt 0(k=0,1,...,n) Ak>0(k=0,1,...,n)
- 由于舍入误差的影响, f ( x k ) f(x_k) f(xk) 往往有误差,即用 f ( x k ) f(x_k) f(xk) 的近似值 f k ~ \tilde{f_k} fk~ 计算,因此实际求得定积分的近似值为
I n ( f ~ ) = ∑ k = 0 n A k f k ~ I_n(\tilde{f}) = \sum_{k=0}^n A_k \tilde{f_k} In(f~)=k=0∑nAkfk~
- 求积公式 I n ( f ) = ∑ k = 0 n A k f ( x k ) I_n(f) = \sum_{k=0}^n A_k f(x_k) In(f)=∑k=0nAkf(xk),其近似值为 I n ( f ~ ) = ∑ k = 0 n A k f k ~ I_n(\tilde{f}) = \sum_{k=0}^n A_k \tilde{f_k} In(f~)=∑k=0nAkfk~。如果对于任意 ϵ > 0 \epsilon \gt 0 ϵ>0,存在 δ > 0 \delta \gt 0 δ>0,当 max 0 ≤ k ≤ n ∣ f ( x k ) − f k ~ ∣ < δ \max_{0 \le k \le n}|f(x_k)-\tilde{f_k}| \lt \delta max0≤k≤n∣f(xk)−fk~∣<δ 时,有 ∣ I n ( f ) − I n ( f ~ ) ∣ < ϵ |I_n(f)-I_n(\tilde{f})| \lt \epsilon ∣In(f)−In(f~)∣<ϵ,则称该求积公式是稳定的
- Gauss 公式 ∫ a b f ( x ) d x ≈ ∑ k = 0 n A k f ( x k ) \int_a^b f(x)dx \approx \sum_{k=0}^nA_kf(x_k) ∫abf(x)dx≈∑k=0nAkf(xk) 是稳定的
- 给定求积公式 ∫ a b f ( x ) d x ≈ ∑ k = 0 n A k ( n ) f ( x k ( n ) ) \int_a^bf(x)dx \approx \sum_{k=0}^n A_k^{(n)}f(x_k^{(n)}) ∫abf(x)dx≈∑k=0nAk(n)f(xk(n)),如果对任意 ϵ > 0 \epsilon \gt 0 ϵ>0,存在正整数 N N N,当 n > N n \gt N n>N 时,有 ∣ I ( f ) − I n ( f ) < ϵ ∣ |I(f)-I_n(f) \lt \epsilon| ∣I(f)−In(f)<ϵ∣,则称该求积公式收敛
- 设 f ( x ) ∈ C [ a , b ] f(x) \in C[a, b] f(x)∈C[a,b],则 Gauss 公式收敛
复化 Gauss
TODO
数值微分
f ′ ( x 0 ) ≈ f ( x 0 + h ) − f ( x 0 ) h , ( 向 前 差 商 ) f ′ ( x 0 ) ≈ f ( x 0 ) − f ( x 0 − h ) h , ( 向 后 差 商 ) f ′ ( x 0 ) ≈ f ( x 0 + h ) − f ( x 0 − h ) 2 h , ( 中 心 差 商 ) \begin{aligned} f^{'}(x_0) &\approx \frac{f(x_0+h)-f(x_0)}{h}, \quad (向前差商) \\ f^{'}(x_0) &\approx \frac{f(x_0)-f(x_0-h)}{h}, \quad (向后差商) \\ f^{'}(x_0) &\approx \frac{f(x_0+h)-f(x_0-h)}{2h}, \quad (中心差商) \end{aligned} f′(x0)f′(x0)f′(x0)≈hf(x0+h)−f(x0),(向前差商)≈hf(x0)−f(x0−h),(向后差商)≈2hf(x0+h)−f(x0−h),(中心差商)
将
f
(
x
0
+
h
)
f(x_0+h)
f(x0+h),
f
(
x
0
−
h
)
f(x_0-h)
f(x0−h) 在
x
0
x_0
x0 点 Taylor 展开,可以得
f
′
(
x
0
)
−
f
(
x
0
+
h
)
−
f
(
x
0
)
h
=
−
h
2
f
′
′
(
x
0
)
+
O
(
h
2
)
f
′
(
x
0
)
−
f
(
x
0
)
−
f
(
x
0
−
h
)
h
=
h
2
f
′
′
(
x
0
)
+
O
(
h
2
)
f
′
(
x
0
)
−
f
(
x
0
+
h
)
−
f
(
x
0
−
h
)
2
h
=
−
h
2
6
f
′
′
′
(
x
0
)
+
O
(
h
3
)
\begin{aligned} f^{'}(x_0) - \frac{f(x_0+h)-f(x_0)}{h} &= -\frac{h}{2}f^{''}(x_0)+O(h^2) \\ f^{'}(x_0) - \frac{f(x_0)-f(x_0-h)}{h} &= \frac{h}{2}f^{''}(x_0)+O(h^2) \\ f^{'}(x_0) - \frac{f(x_0+h)-f(x_0-h)}{2h} &= -\frac{h^2}{6}f^{'''}(x_0)+O(h^3) \end{aligned}
f′(x0)−hf(x0+h)−f(x0)f′(x0)−hf(x0)−f(x0−h)f′(x0)−2hf(x0+h)−f(x0−h)=−2hf′′(x0)+O(h2)=2hf′′(x0)+O(h2)=−6h2f′′′(x0)+O(h3)