求连续函数最佳平方逼近的步骤:
1.给定[a,b]上的连续函数f(x),及子空间
Φ
=
s
p
a
n
(
ϕ
0
(
x
)
,
ϕ
1
(
x
)
,
⋯
,
ϕ
n
(
x
)
)
\Phi = span(\phi_{0}(x),\phi_{1}(x),\cdots,\phi_{n}(x))
Φ=span(ϕ0(x),ϕ1(x),⋯,ϕn(x))
2.利用内积
(
ϕ
i
,
ϕ
k
)
=
∫
a
b
ϕ
i
(
x
)
ϕ
k
(
x
)
d
x
(\phi_i,\phi_k)=\int_{a}^{b}\phi_{i}(x)\phi_{k}(x)dx
(ϕi,ϕk)=∫abϕi(x)ϕk(x)dx
( f , ϕ k ) = ∫ a b f ( x ) ϕ k ( x ) d x (f,\phi_k)=\int_{a}^{b}f(x)\phi_{k}(x)dx (f,ϕk)=∫abf(x)ϕk(x)dx
给出法方程组:
[
(
ϕ
0
,
ϕ
0
)
(
ϕ
1
,
ϕ
0
)
⋯
(
ϕ
n
,
ϕ
0
)
(
ϕ
0
,
ϕ
1
)
(
ϕ
1
,
ϕ
1
)
⋯
(
ϕ
n
,
ϕ
1
)
⋯
⋯
⋯
(
ϕ
0
,
ϕ
n
)
(
ϕ
1
,
ϕ
n
)
⋯
(
ϕ
n
,
ϕ
n
)
]
[
c
0
c
1
⋮
c
n
]
=
[
(
f
,
ϕ
0
)
(
f
,
ϕ
1
)
⋮
(
f
,
ϕ
n
)
]
\begin{bmatrix} (\phi_{0},\phi_{0}) & (\phi_{1},\phi_{0}) & \cdots & (\phi_{n},\phi_{0}) \\ (\phi_{0},\phi_{1}) & (\phi_{1},\phi_{1}) & \cdots & (\phi_{n},\phi_{1}) \\ \cdots & \cdots & & \cdots \\ (\phi_{0},\phi_{n}) & (\phi_{1},\phi_{n}) & \cdots & (\phi_{n},\phi_{n}) \\ \end{bmatrix} \begin{bmatrix} c_{0} \\ c_{1} \\ \vdots \\ c_{n}\\ \end{bmatrix}= \begin{bmatrix} (f,\phi_{0}) \\ (f,\phi_{1}) \\ \vdots \\ (f,\phi_{n}) \\ \end{bmatrix}
⎣⎢⎢⎡(ϕ0,ϕ0)(ϕ0,ϕ1)⋯(ϕ0,ϕn)(ϕ1,ϕ0)(ϕ1,ϕ1)⋯(ϕ1,ϕn)⋯⋯⋯(ϕn,ϕ0)(ϕn,ϕ1)⋯(ϕn,ϕn)⎦⎥⎥⎤⎣⎢⎢⎢⎡c0c1⋮cn⎦⎥⎥⎥⎤=⎣⎢⎢⎢⎡(f,ϕ0)(f,ϕ1)⋮(f,ϕn)⎦⎥⎥⎥⎤
3.求出法方程组的解
c
0
∗
,
c
1
∗
,
⋯
,
c
n
∗
c_0^*,c_1^*,\cdots,c_n^*
c0∗,c1∗,⋯,cn∗,得到最佳平方逼近
p
n
∗
(
x
)
=
c
0
∗
ϕ
0
(
x
)
+
c
0
∗
ϕ
1
(
x
)
+
⋯
+
c
n
∗
ϕ
n
(
x
)
p_{n}^*(x)=c_{0}^*\phi_0(x)+c_{0}^*\phi_1(x)+\cdots+c_n^*\phi_n(x)
pn∗(x)=c0∗ϕ0(x)+c0∗ϕ1(x)+⋯+cn∗ϕn(x)
4.求出误差
δ
2
=
∥
f
∥
2
2
−
∑
i
=
0
n
c
i
∗
(
f
,
ϕ
i
)
\delta^2 =\|f\|_2^2 - \sum_{i=0}^n c_i^*(f,\phi_i)
δ2=∥f∥22−i=0∑nci∗(f,ϕi)