\qquad 函数就是在区间 [ a , b ] [a,b] [a,b]上用简单函数逼近已知的复杂函数问题。即函数 A A A中给定的函数 f ( x ) f(x) f(x),记作 f ( x ) ∈ A f(x)\in A f(x)∈A,要求在另一类简单的便于计算的函数类 B B B中求函数 p ( x ) ∈ B p(x)\in B p(x)∈B,使 p ( x ) p(x) p(x)与 f ( x ) f(x) f(x)的误差在某种度量下意义下最小。
\qquad 次数不超过 n n n次的多项式集合 H n H_{n} Hn,其元素 p ( x ) ∈ H n p(x)\in H_{n} p(x)∈Hn表示为
p ( x ) = a 0 + a 1 x + ⋯ + a n x n p(x)=a_{0}+a_{1}x+\cdots+a_{n}x^{n} p(x)=a0+a1x+⋯+anxn \quad 是由 n + 1 n+1 n+1个系数 ( a 0 , a 1 , ⋯   , a n ) (a_{0},a_{1},\cdots,a_{n}) (a0,a1,⋯,an)唯一确定。 1 , x , ⋯   , x n 1,x,\cdots,x^{n} 1,x,⋯,xn线性无关,使 H H H的一组基。
\qquad 可用一组在 C [ a , b ] C[a,b] C[a,b]上线性无关的函数集合 { φ i ( x ) } i = 0 n \{\varphi_{i}(x)\}_{i=0}^{n} { φi(x)}i=0n来逼近 f ( x ) ∈ C [ a , b ] f(x)\in C[a,b] f(x)∈C[a,b],元素 φ i ( x ) ∈ Φ = s p a n { φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) } ⊂ C [ a , b ] \varphi_{i}(x)\in\Phi=span\{\varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x)\}\subset C[a,b] φi(x)∈Φ=span{ φ0(x),φ1(x),⋯,φn(x)}⊂C[a,b],表示为
φ ( x ) = a 0 φ 1 ( x ) + a 1 φ 1 ( x ) + ⋯ + a n φ n ( x ) \varphi(x)=a_{0}\varphi_{1}(x)+a_{1}\varphi_{1}(x)+\cdots+a_{n}\varphi_{n}(x) φ(x)=a0φ1(x)+a1φ1(x)+⋯+anφn(x) \qquad 函数逼近问题就是对 f ( x ) ∈ C [ a , b ] f(x)\in C[a,b] f(x)∈C[a,b],在子空间 Φ \Phi Φ中找到一个元素 φ ∗ ( x ) ∈ Φ \varphi^{*}(x)\in\Phi φ∗(x)∈Φ,使 f ( x ) − φ ∗ ( x ) f(x)-\varphi^{*}(x) f(x)−φ∗(x)在某种意义下最小。范数是为了对线性函数空间中的元素大小进行衡量(即为“某种度量”)。
\qquad 在 R n \mathbb{R}^{n} Rn上的向量 x = ( x 1 , x 2 , ⋯   , x n ) T ∈ R n x=(x_{1},x_{2},\cdots,x_{n})^{T}\in\mathbb{R}^{n} x=(x1,x2,⋯,xn)T∈Rn常见范数:
∣ ∣ x ∣ ∣ ∞ = m a x ∣ x i ∣ ||x||_{\infty}=max|x_{i}| ∣∣x∣∣∞=max∣xi∣,称为 ∞ \infty ∞-范数或最大范数,
∣ ∣ x ∣ ∣ 1 = ∑ i = 1 n ∣ x i ∣ ||x||_{1}=\sum_{i=1}^{n}|x_{i}| ∣∣x∣∣1=∑i=1n∣xi∣,称为1-范数,
∣ ∣ x ∣ ∣ 2 = ( ∑ i = 1 n x i 2 ) 1 2 ||x||_{2}=(\sum_{i=1}^{n}x_{i}^{2})^{\frac{1}{2}} ∣∣x∣∣2=(∑i=1nxi2)21,称为2-范数。
\qquad 对于连续函数空间 C [ a , b ] C[a,b] C[a,b],若 f ∈ C [ a , b ] f\in C[a,b] f∈C[a,b]常见函数范数
∣ ∣ f ∣ ∣ ∞ = m a x ∣ f ( x ) ∣ ||f||_{\infty}=max|f(x)| ∣∣f∣∣∞=max∣f(x)∣,称为 ∞ \infty ∞-范数,
∣ ∣ f ∣ ∣ 1 = ∫ a b ∣ f ( x ) ∣ d x ||f||_{1}=\int_{a}^{b}|f(x)|dx ∣∣f∣∣1=∫ab∣f(x)∣dx,称为1-范数,
∣ ∣ f ∣ ∣ 2 = ( ∫ a b f 2 ( x ) d x ) 1 2 ||f||_{2}=(\int_{a}^{b}f^{2}(x)dx)^{\frac{1}{2}} ∣∣f∣∣2=(∫abf2(x)dx)21,称为2-范数。
\qquad 最佳逼近,若 P ∗ ( x ) ∈ H n P^{*}(x)\in H_{n} P∗(x)∈Hn使误差
∣ ∣ f ( x ) − P ∗ ( x ) ∣ ∣ = m i n P ∈ H n ∣ ∣ f ( x ) − P ( x ) ∣ ∣ ||f(x)-P^{*}(x)||=\mathop{min}\limits_{P\in H_{n}}||f(x)-P(x)|| ∣∣f(x)−P∗(x)∣∣=P∈Hnmin∣∣f(x)−P(x)∣∣ \qquad 则称 P ∗ ( x ) P^{*}(x) P∗(x)使 f ( x ) f(x) f(x)在 [ a , b ] [a,b] [a,b]上的最佳逼近多项式,包括最优一致逼近、最佳平方逼近多项式和最小二乘拟合。
\qquad 函 数 求 内 积 \color{#F00}{\boldsymbol{函数求内积}} 函数求内积
( f ( x ) , g ( x ) ) = ∫ a b ρ ( x ) f ( x ) g ( x ) d x (f(x),g(x))=\int_{a}^{b}\rho(x)f(x)g(x)dx (f(x),g(x))=∫abρ(x)f(x)g(x)dx
\qquad 若 f ( x ) , g ( x ) ∈ C [ a , b ] , ρ ( x ) f(x),g(x)\in C[a,b],\rho(x) f(x),g(x)∈C[a,b],ρ(x)为在 [ a , b ] [a,b] [a,b]上的权函数且满足
( f ( x ) , g ( x ) ) = ∫ a b ρ ( x ) f ( x ) g ( x ) d x = 0 (f(x),g(x))=\int_{a}^{b}\rho(x)f(x)g(x)dx=0 (f(x),g(x))=∫abρ(x)f(x)g(x)dx=0则 f ( x ) f(x) f(x)与 g ( x ) g(x) g(x)在 [ a , b ] [a,b] [a,b]上带权 ρ ( x ) \rho(x) ρ(x)正交,若函数族 φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) \varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x) φ0(x),φ1(x),⋯,φn(x)满足关系
( φ j , φ k ) = ∫ a b ρ ( x ) φ j φ k d x = { 0 , j ≠ k , A k > 0 , j = k , (\varphi_{j},\varphi_{k})=\int_{a}^{b}\rho(x)\varphi_{j}\varphi_{k}dx=\begin{cases} 0,\quad j\neq k, \\ A_{k}>0,\quad j=k, \end{cases} (φj,φk)=∫abρ(x)φjφkdx={ 0,j̸=k,Ak>0,j=k, \quad 则称 { φ k ( x ) } \{\varphi_{k}(x)\} { φk(x)}是 [ a , b ] [a,b] [a,b]上带权 ρ ( x ) \rho(x) ρ(x)的正交函数族,若 A k = 1 A_{k}=1 Ak=1,称为标准正交函数组。给定区间 [ a , b ] [a,b] [a,b]及带权 ρ ( x ) \rho(x) ρ(x)函数,均可由一组线性无关的幂函数 { 1 , x , ⋯   , x n } \{1,x,\cdots,x^{n}\} { 1,x,⋯,xn},利用正交化手段构造正交多项式序列 { φ n ( x ) } 0 ∞ \{\varphi_{n}(x)\}_{0}^{\infty} { φn(x)}0∞。
\qquad 构造正交多项式设 { φ n ( x ) } 0 ∞ \{\varphi_{n}(x)\}_{0}^{\infty} { φn(x)}0∞是 [ a , b ] [a,b] [a,b]上带权 ρ ( x ) \rho(x) ρ(x)的正交多项式,对 n ≥ 0 n\ge 0 n≥0成立递推关系为
φ n + 1 ( x ) = ( x − α n ) φ n ( x ) − β n φ n − 1 ( x ) , n = 0 , 1 , ⋯   , \varphi_{n+1}(x)=(x-\alpha_{n})\varphi_{n}(x)-\beta_{n}\varphi_{n-1}(x),n = 0,1,\cdots, φn+1(x)=(x−αn)φn(x)−βnφn−1(x),n=0,1,⋯,
其中,
φ 0 ( x ) = 1 , φ − 1 ( x ) = 0 α n = ( x φ n ( x ) , φ n ( x ) ) / ( φ n ( x ) , φ n ( x ) ) , β n = ( φ n ( x ) , φ n ( x ) ) / ( φ n − 1 ( x ) , φ n − 1 ( x ) ) , n = 1 , 2 , ⋯ \varphi_{0}(x)= 1,\varphi_{-1}(x)=0\\ \alpha_{n}=(x\varphi_{n}(x),\varphi_{n}(x))/(\varphi_{n}(x),\varphi_{n}(x)),\\ \beta_{n}=(\varphi_{n}(x),\varphi_{n}(x))/(\varphi_{n-1}(x),\varphi_{n-1}(x)),\ n=1,2,\cdots\\ φ0(x)=1,φ−1(x)=0αn=(xφn(x),φn(x))/(φn(x),φn(x)),βn=(φn(x),φn(x))/(φn−1(x),φn−1(x)), n=1,2,⋯这里 ( x φ n ( x ) , φ n ( x ) ) = ∫ a b x φ n 2 ( x ) ρ ( x ) d x (x\varphi_{n}(x),\varphi_{n}(x))=\int_{a}^{b}x\varphi^{2}_{n}(x)\rho(x)dx (xφn(x),φn(x))=∫abxφn2(x)ρ(x)dx
\qquad 勒让德多项式 在区间[-1,1],权函数 ρ ( x ) = 1 \rho(x)=1 ρ(x)=1,由 { 1 , x , ⋯   , x n , ⋯   } \{1,x,\cdots,x^{n},\cdots\} { 1,x,⋯,xn,⋯}正交化得到的多项式为勒让德多项式。
P 0 ( x ) = 1 , P n ( x ) = 1 2 n n ! d n d x n ( x 2 − 1 ) n , n = 1 , 2 , ⋯ P_{0}(x)=1,P_{n}(x)=\frac{1}{2^{n}n!}\frac{d^{n}}{dx^{n}}(x^2-1)^{n},\quad n=1,2,\cdots P0(x)=1,Pn(x)=2nn!1dxndn(x2−1)n,n=1,2,⋯
1.(正交性)
∫ − 1 1 P n ( x ) P m ( x ) d x = { 0 , m ≠ m ; 2 2 n + 1 , m = n . \int_{-1}^{1}P_{n}(x)P_{m}(x)dx = \begin{cases} 0,\qquad m \neq m; \\ \frac{2}{2n+1}, \qquad m=n. \end{cases} ∫−11Pn(x)Pm(x)dx={ 0,m̸=m;2n+12,m=n.
2.(递推关系)
( n + 1 ) P n + 1 ( x ) = ( 2 n + 1 ) x P n ( x ) − n P n − 1 ( x ) , n = 1 , 2 , ⋯ (n+1)P_{n+1}(x)=(2n+1)xP_{n}(x)-nP_{n-1}(x),\quad n=1,2,\cdots (n+1)Pn+1(x)=(2n+1)xPn(x)−nPn−1(x),n=1,2,⋯ \qquad 切比雪夫多项式 权函数 ρ ( x ) = 1 1 − x 2 \rho(x)=\frac{1}{\sqrt{1-x^{2}}} ρ(x)=1−x21,区间为[-1,1]时,由序列 { 1 , x , ⋯   , x n , ⋯   } \{1,x,\cdots,x^{n},\cdots\} { 1,x,⋯,xn,⋯}正交化得到的正交多项式为切比雪夫多项式
T n ( x ) = c o s ( n a r c c o s x ) , ∣ x ∣ ≤ 1 T_{n}(x)=cos(n\ arccos\ x),\quad |x|\leq1 Tn(x)=cos(n arccos x),∣x∣≤1若令 x = c o s θ x= cos\theta x=cosθ,则 T n ( x ) = c o s n θ , 0 ≤ θ ≤ π T_{n}(x)=cos\ n\theta,0\leq\theta\leq\pi Tn(x)=cos nθ,0≤θ≤π。
1.(递推关系)
{ T 0 ( x ) = 1 , T 1 ( x ) = x T n + 1 ( x ) = 2 x T n ( x ) − T n − 1 ( x ) , n = 1 , 2 , ⋯ \begin{cases} T_{0}(x)=1,T_{1}(x)=x\\ T_{n+1}(x)=2xT_{n}(x)-T_{n-1}(x),\quad n =1,2,\cdots \end{cases} { T0(x)=1,T1(x)=xTn+1(x)=2xTn(x)−Tn−1(x),n=1,2,⋯
2.(正交性)
∫ − 1 1 T n ( x ) T m ( x ) 1 − x 2 = ∫ 0 n c o s n θ c o s m θ d θ = { 0 , n ≠ m π 2 , n = m ≠ 0 π , n = m = 0 \int_{-1}^{1}\frac{T_{n}(x)T_{m}(x)}{\sqrt{1-x^{2}}}=\int_{0}^{n}cos\ n\theta cos\ m\theta d\theta=\begin{cases} 0,\quad n\neq m\\ \frac{\pi}{2},\quad n=m\neq 0\\ \pi, \quad n=m=0 \end{cases} ∫−111−x2Tn(x)Tm(x)=∫0ncos nθcos mθdθ=⎩⎪⎨⎪⎧0,n̸=m2π,n=m̸=0π,n=m=0
\qquad 研究在区间[a,b]上一般的最佳平方逼近问题,对 f ( x ) ∈ C [ a , b ] f(x)\in C[a,b] f(x)∈C[a,b]及 C [ a , b ] C[a,b] C[a,b]中的一个子集 φ ( x ) = s p a n { φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) } \varphi(x)=span\{\varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x)\} φ(x)=span{ φ0(x),φ1(x),⋯,φn(x)},若存在 S ∗ ( x ) ∈ φ S^{*}(x)\in\varphi S∗(x)∈φ,使
∣ ∣ f ( x ) − S ∗ ( x ) ∣ ∣ 2 2 = m i n S ( x ) ∈ φ ∣ ∣ f ( x ) − S ( x ) ∣ ∣ 2 2 = m i n S ( x ) ∈ φ ∫ a b ρ ( x ) [ f ( x ) − S ( x ) ] 2 d x ||f(x)-S^{*}(x)||_{2}^{2}=\mathop{min}\limits_{S(x)\in\varphi}||f(x)-S(x)||_{2}^{2}\\ = \mathop{min}\limits_{S(x)\in\varphi}\int_{a}^{b}\rho(x)[f(x)-S(x)]^{2}dx ∣∣f(x)−S∗(x)∣∣22=S(x)∈φmin∣∣f(x)−S(x)∣∣22=S(x)∈φmin∫abρ(x)[f(x)−S(x)]2dx则称 S ∗ ( x ) S^{*}(x) S∗(x)是 f ( x ) f(x) f(x)在子集上 ϕ ⊂ C [ a , b ] \phi\subset C[a,b] ϕ⊂C[a,b]中的最佳平方逼近函数,等价于求多元函数
I ( a 0 , a 1 , ⋯   , a n ) = ∫ a b ρ ( x ) [ ∑ j = 0 n a j φ j ( x ) − f ( x ) ] 2 d x I(a_{0},a_{1},\cdots,a_{n})=\int_{a}^{b}\rho(x)[\sum_{j=0}^{n}a_{j}\varphi_{j}(x)-f(x)]^{2}dx I(a0,a1,⋯,an)=∫abρ(x)[j=0∑najφj(x)−f(x)]2dx的最小值。由多元函数求极值的必要条件
∂ I ∂ a k = 0 , k = 0 , 1 , ⋯   , n , \frac{\partial I}{\partial a_{k}}=0,\quad k=0,1,\cdots,n, ∂ak∂I=0,k=0,1,⋯,n,即
∂ I ∂ a k = 2 ∫ a b ρ ( x ) [ ∑ j = 0 n a j φ j ( x ) − f ( x ) ] φ k ( x ) d x = 0 , k = 0 , 1 , ⋯   , n \frac{\partial I}{\partial a_{k}}=2\int_{a}^{b}\rho(x)[\sum_{j=0}^{n}a_{j}\varphi_{j}(x)-f(x)]\varphi_{k}(x)dx=0,\quad k=0,1,\cdots,n ∂ak∂I=2∫abρ(x)[j=0∑najφj(x)−f(x)]φk(x)dx=0,k=0,1,⋯,n于是有
∑ j = 0 n ( φ k ( x ) , φ j ( x ) ) a j = ( f ( x ) , φ k ( x ) ) , k = 0 , 1 , ⋯   , n . \sum_{j=0}^{n}(\varphi_{k}(x),\varphi_{j}(x))a_{j}=(f(x),\varphi_{k}(x)),\quad k=0,1,\cdots,n. j=0∑n(φk(x),φj(x))aj=(f(x),φk(x)),k=0,1,⋯,n.这是关于 a 0 , a 1 , ⋯   , a n a_{0},a_{1},\cdots,a_{n} a0,a1,⋯,an的线性方程组,称为法方程。(即为函数逼近的求解要点)
\qquad 求解过程为:
[ ( φ 0 ( x ) , φ 0 ( x ) ) ⋯ ( φ 0 ( x ) , φ n ( x ) ) ⋮ ⋱ ⋮ ( φ n ( x ) , φ 0 ( x ) ) ⋯ ( φ n ( x ) , φ n ( x ) ) ] [ a 0 ⋮ a n ] = [ ( f ( x ) , φ 0 ( x ) ) ⋮ ( f ( x ) , φ n ( x ) ) ] \begin{bmatrix} (\varphi_{0}(x),\varphi_{0}(x)) & \cdots & (\varphi_{0}(x),\varphi_{n}(x)) \\ \vdots & \ddots & \vdots \\ (\varphi_{n}(x),\varphi_{0}(x)) & \cdots & (\varphi_{n}(x),\varphi_{n}(x)) \end{bmatrix}\begin{bmatrix} a_{0} \\ \vdots \\ a_{n} \end{bmatrix}=\begin{bmatrix} (f(x),\varphi_{0}(x)) \\ \vdots \\ (f(x),\varphi_{n}(x)) \end{bmatrix} ⎣⎢⎡(φ0(x),φ0(x))⋮(φn(x),φ0(x))⋯⋱⋯(φ0(x),φn(x))⋮(φn(x),φn(x))⎦⎥⎤⎣⎢⎡a0⋮an⎦⎥⎤=⎣⎢⎡(f(x),φ0(x))⋮(f(x),φn(x))⎦⎥⎤ H a = d Ha=d Ha=d \qquad 由于 φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) \varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x) φ0(x),φ1(x),⋯,φn(x)线性无关,故系数 d e t G ( φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) ) ≠ 0 det\ G(\varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x))\neq 0 det G(φ0(x),φ1(x),⋯,φn(x))̸=0,所以线性方程组有唯一的 a k = a k ∗ ( k = 0 , 1 , ⋯   , n ) a_{k}=a_{k}^{*}(k=0,1,\cdots,n) ak=ak∗(k=0,1,⋯,n),从而得到
S ∗ ( x ) = a 0 ∗ φ 0 ( x ) + ⋯ + a n ∗ φ n ( x ) S^{*}(x)=a_{0}^{*}\varphi_{0}(x)+\cdots+a_{n}^{*}\varphi_{n}(x) S∗(x)=a0∗φ0(x)+⋯+an∗φn(x) \qquad 若令 δ ( x ) = f ( x ) − S ∗ ( x ) \delta(x)=f(x)-S^{*}(x) δ(x)=f(x)−S∗(x),则最佳平方逼近的误差为
∣ ∣ δ ( x ) ∣ ∣ 2 2 = ( f ( x ) − S ∗ ( x ) , f ( x ) − S ∗ ( x ) ) = ∣ ∣ f ( x ) ∣ ∣ 2 2 − ∑ k = 0 n a k ∗ ( φ k ( x ) , f ( x ) ) ||\delta(x)||_{2}^{2}=(f(x)-S^{*}(x),f(x)-S^{*}(x))=||f(x)||_{2}^{2}-\sum_{k=0}^{n}a_{k}^{*}(\varphi_{k}(x),f(x)) ∣∣δ(x)∣∣22=(f(x)−S∗(x),f(x)−S∗(x))=∣∣f(x)∣∣22−k=0∑nak∗(φk(x),f(x)) \quad 方程求解过程中给定 φ i ( x ) \varphi_{i}(x) φi(x)、权函数 ρ ( x ) \rho(x) ρ(x)和函数区间 f ( x ) ∈ C [ a , b ] f(x)\in C[a,b] f(x)∈C[a,b]。两个经典的 φ i ( x ) \varphi_{i}(x) φi(x)构造方法:
1.给定 φ i ( x ) = x k , ρ ( x ) ≡ 1 , f ( x ) ∈ C [ 0 , 1 ] \varphi_{i}(x)=x^{k},\rho(x)\equiv 1,f(x)\in C[0,1] φi(x)=xk,ρ(x)≡1,f(x)∈C[0,1]则最佳多项式为:
( φ j ( x ) , φ k ( x ) ) = ∫ 0 1 x k + j d x = 1 k + j + 1 ( f ( x ) , φ k ( x ) ) = ∫ 0 1 f ( x ) x k d x = d k (\varphi_{j}(x),\varphi_{k}(x))=\int_{0}^{1}x^{k+j}dx=\frac{1}{k+j+1}\\ (f(x),\varphi_{k}(x))=\int_{0}^{1}f(x)x^{k}dx{=}d_{k} (φj(x),φk(x))=∫01xk+jdx=k+j+11(f(x),φk(x))=∫01f(x)xkdx=dk S ∗ ( x ) = a 0 ∗ + a 1 ∗ x + ⋯ + a n ∗ x n H = [ 1 ⋯ 1 / ( n + 1 ) ⋮ ⋱ ⋮ 1 / n ⋯ 1 / ( 2 n + 1 ) ] S^{*}(x)=a_{0}^{*}+a_{1}^{*}x+\cdots+a_{n}^{*}x^{n}\\ H=\begin{bmatrix} 1 & \cdots & 1/(n+1) \\ \vdots & \ddots & \vdots \\ 1/n & \cdots & 1/(2n+1) \end{bmatrix} S∗(x)=a0∗+a1∗x+⋯+an∗xnH=⎣⎢⎡1⋮1/n⋯⋱⋯1/(n+1)⋮1/(2n+1)⎦⎥⎤ 缺点为当 n → ∞ n\to\infty n→∞时矩阵高度病态。取正交函数族可以避免该问题(不需求解线性方程组)。
2.设 f ( x ) ∈ C [ a , b ] , φ = s p a n { φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) } f(x)\in C[a,b],\varphi=span\{\varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x)\} f(x)∈C[a,b],φ=span{ φ0(x),φ1(x),⋯,φn(x)},使得 φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) \varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x) φ0(x),φ1(x),⋯,φn(x)为正交函数族。故法方程的系数矩阵 G n = G ( φ 0 ( x ) , φ 1 ( x ) , ⋯   , φ n ( x ) ) G_{n}=G(\varphi_{0}(x),\varphi_{1}(x),\cdots,\varphi_{n}(x)) Gn=G(φ0(x),φ1(x),⋯,φn(x))为非奇异对称矩阵,方程解为
a k ∗ = ( f ( x ) , φ k ( x ) ) / ( φ k ( x ) , φ k ( x ) ) , k = 0 , 1 , ⋯   , n a^{*}_{k}=(f(x),\varphi_{k}(x))/(\varphi_{k}(x),\varphi_{k}(x)),\quad k=0,1,\cdots,n ak∗=(f(x),φk(x))/(φk(x),φk(x)),k=0,1,⋯,n \qquad 最佳逼近函数为:
S ∗ ( x ) = ∑ k = 0 n ( f ( x ) , φ k ( x ) ) ∣ ∣ φ k ( x ) ∣ ∣ 2 2 φ k ( x ) S^{*}(x)=\sum_{k=0}^{n}\frac{(f(x),\varphi_{k}(x))}{||\varphi_{k}(x)||_{2}^{2}}\varphi_{k}(x) S∗(x)=k=0∑n∣∣φk(x)∣∣22(f(x),φk(x))φk(x)
\qquad 若 f ( x ) ∈ C [ a , b ] f(x)\in C[a,b] f(x)∈C[a,b],如果 f ( x ) f(x) f(x)只在一组离散点集上给出 { x i , i = 0 , 1 , ⋯   , m } \{x_{i},i=0,1,\cdots,m\} { xi,i=0,1,⋯,m}上给出,即为常见实验数据 { ( x i , y i ) , i = 0 , 1 , ⋯   , m } \{(x_{i},y_{i}),i=0,1,\cdots,m\} { (xi,yi),i=0,1,⋯,m}的曲线拟合,其中 y i = f ( x i ) ( i = 0 , 1 , ⋯   , m ) y_{i}=f(x_{i})(i=0,1,\cdots,m) yi=f(xi)(i=0,1,⋯,m),求函数 y = S ∗ ( x ) y=S^{*}(x) y=S∗(x)使得
∣ ∣ δ ∣ ∣ 2 2 = ∑ i = 0 m δ i 2 = ∑ i = 0 m [ S ∗ ( x i ) − y i ] 2 = m i n S ( x ) ∈ φ ∑ i = 0 m [ S ( x i ) − y i ] 2 ||\delta||^{2}_{2}=\sum_{i=0}^{m}\delta_{i}^{2}=\sum_{i=0}^{m}[S^{*}(x_{i})-y_{i}]^{2}=\mathop{min}\limits_{S(x)\in\varphi}\sum_{i=0}^{m}[S(x_{i})-y_{i}]^{2} ∣∣δ∣∣22=i=0∑mδi2=i=0∑m[S∗(xi)−yi]2=S(x)∈φmini=0∑m[S(xi)−yi]2
其中
S ( x ) = a 0 φ 0 ( x ) + a 1 φ 1 ( x ) + ⋯ + a n φ n ( x ) ( n < m ) S(x)=a_{0}\varphi_{0}(x)+a_{1}\varphi_{1}(x)+\cdots+a_{n}\varphi_{n}(x)\qquad(n<m) S(x)=a0φ0(x)+a1φ1(x)+⋯+anφn(x)(n<m)上式就是一般的最小二乘逼近,使用几何语言描述即为曲线拟合的最小二乘法。将其转化为求多元函数
I ( a 0 , a 1 , ⋯   , a n ) = ∑ i = 0 m ω ( x i ) [ ∑ j = 0 n a j φ j ( x i ) − f ( x i ) ] 2 I(a_{0},a_{1},\cdots,a_{n})=\sum_{i=0}^{m}\omega(x_{i})[\sum_{j=0}^{n}a_{j}\varphi_{j}(x_{i})-f(x_{i})]^{2} I(a0,a1,⋯,an)=i=0∑mω(xi)[j=0∑najφj(xi)−f(xi)]2其中 ω ( x i ) \omega(x_{i}) ω(xi)作为权函数,表示不同点的比重不同,有多元函数极值的必要条件有:
∂ I ∂ a k = 2 ∑ i = 0 m ω ( x i ) [ ∑ j = 0 n a j φ j ( x i ) − f ( x i ) ] φ k ( x i ) d x = 0 , k = 0 , 1 , ⋯   , n \frac{\partial I}{\partial a_{k}}=2\sum_{i=0}^{m}\omega(x_{i})[\sum_{j=0}^{n}a_{j}\varphi_{j}(x_{i})-f(x_{i})]\varphi_{k}(x_{i})dx=0,\quad k=0,1,\cdots,n ∂ak∂I=2i=0∑mω(xi)[j=0∑najφj(xi)−f(xi)]φk(xi)dx=0,k=0,1,⋯,n
其中
( φ j , φ k ) = ∑ i = 0 m ω ( x i ) φ j ( x i ) φ k ( x i ) ( f , φ k ) = ∑ i = 0 m ω ( x i ) f ( x i ) φ k ( x i ) (\varphi_{j},\varphi_{k})=\sum_{i=0}^{m}\omega(x_{i})\varphi_{j}(x_{i})\varphi_{k}(x_{i})\\ (f,\varphi_{k})=\sum_{i=0}^{m}\omega(x_{i})f(x_{i})\varphi_{k}(x_{i}) (φj,φk)=i=0∑mω(xi)φj(xi)φk(xi)(f,φk)=i=0∑mω(xi)f(xi)φk(xi)所以,与连续形式的不同在于分解为离散点。
∑ j = 0 n ( φ j , φ k ) a j = d k k = 0 , 1 , ⋯   , n \sum_{j=0}^{n}(\varphi_{j},\varphi_{k})a_{j}=d_{k}\qquad k=0,1,\cdots,n j=0∑n(φj,φk)aj=dkk=0,1,⋯,n表示为矩阵形式
[ ( φ 0 , φ 0 ) ⋯ ( φ 0 , φ n ) ⋮ ⋱ ⋮ ( φ n , φ 0 ) ⋯ ( φ n , φ n ) ] [ a 0 ⋮ a n ] = [ ( f ( x ) , φ ( x ) ) ⋮ ( f ( x ) , φ ( x ) ) ] \begin{bmatrix} (\varphi_{0},\varphi_{0}) & \cdots & (\varphi_{0},\varphi_{n}) \\ \vdots & \ddots & \vdots \\ (\varphi_{n},\varphi_{0}) & \cdots & (\varphi_{n},\varphi_{n}) \end{bmatrix}\begin{bmatrix} a_{0} \\ \vdots \\ a_{n} \end{bmatrix}=\begin{bmatrix} (f(x),\varphi(x)) \\ \vdots \\ (f(x),\varphi(x)) \end{bmatrix} ⎣⎢⎡(φ0,φ0)⋮(φn,φ0)⋯⋱⋯(φ0,φn)⋮(φn,φn)⎦⎥⎤⎣⎢⎡a0⋮an⎦⎥⎤=⎣⎢⎡(f(x),φ(x))⋮(f(x),φ(x))⎦⎥⎤