数值分析-5[1].5 Piecewise Polynomial__ Interpolation
数值分析课程第五版课后习题答案

*
[解] = (0.031 × 385.6) 1 × 10 − 4 + (1.1021 × 385.6) 1 × 10 −3 + (1.1021 × 0.031) 1 × 10 −3 ; 2 2 2 −3 −3 −3 = 0.59768 × 10 + 212.48488 × 10 + 0.01708255 × 10 = 213.09964255 × 10 −3 = 0.21309964255
ε * (R* ) 1 1 1 从而 ε * ( R * ) = 1% × R * ,故 ε r* ( R * ) = 。 = 1% × = * 3 300 3 R
6 、设 Y0 = 28 ,按递推公式 Yn = Yn −1 − 1 783 (n = 1,2, ) 计算到 Y100 ,若取 100
783 ≈ 27.982 (五位有效数字, )试问计算 Y100 将有多大误差? [解]令 Yn 表示 Yn 的近似值, e * (Yn ) = Yn − Yn ,则 e * (Y0 ) = 0 ,并且由 1 1 × 27.982 , Yn = Yn −1 − × 783 可知, 100 100 1 × (27.982 − 783 ) ,即 Yn − Yn = Yn −1 − Yn −1 − 100 1 2 从 e * (Yn ) = e * (Yn −1 ) − × (27.982 − 783 ) = e * (Yn − 2 ) − × (27.982 − 783 ) = , 100 100 Yn = Yn −1 − 而 e * (Y100 ) = e * (Y0 ) − (27.982 − 783 ) = 783 − 27.982 ,
而 783 − 27.982 ≤
1 1 × 10 −3 ,所以 ε * (Y100 ) = × 10 −3 。 2 2
一种有效的分段光滑信号逼近方法

一种有效的分段光滑信号逼近方法陈伟【摘要】The truncating Fourier and continue wavelet representation of a discontinuous piecewise smooth signal will introduce an unneglectable error which was named as the Gibbs phenomenon.In this paper,we proposed an effective piece-wise smooth signal approximation method.Firstly,a set of normal orthogonal piecewise polynomials was constructed ac-cording to the given positions of breaking points,and it has the properties of orthogonality,convergence and reproduction. Then the signal was orthogonal decomposed under this basis and the best square approximation result could be obtained using reconstruction.The numerical experiments show that our method have the higher accuracy approximation results than the other basis.%传统的Fourier变换,连续小波变换等方法在逼近具有分段光滑特性的非连续信号时,因 Gibbs现象的干扰会产生比较大的误差。
本文提出了一种有效的分段光滑信号逼近方法。
数值分析第五版第5章学习资料

n
即 de(A t) aijAij (i1,2,,n), j1
其中 A ij 为 a ij 的代数余子式,Aij(1)ijMij, M ij 为元素 a ij 的余子式.
行列式性质:
( ad ) ( A e ) d t B ( A e )d ( t B )A e , ,B t R n n .
有非零解,故系数行列式 deIt (A)0,记
a11 a12 p()det(I A) a21 a22
a1n a2n
(1.3)
an1 an2 ann n c1n1cn1cn 0.
p()称为矩阵 A的特征多项式,方程(1.3)称为矩阵 A的特
征方程.
9
因为 n次代数方程 p() 在复数域中有 n个根
其中用 ri 表示矩阵的第 i行. 由此看出,用消去法解方程组的基本思想是用逐次消
去未知数的方法把原方程组 Axb化为与其等价的三角 形方程组,而求解三角形方程组可用回代的方法.
上述过程就是用行的初等变换将原方程组系数矩阵化 为简单形式(上三角矩阵),从而将求解原方程组(2.1)的 问题转化为求解简单方程组的问题.
n
n
trA aii i.
i1
i1
(1.4) (1.5)
称 trA为 A的迹.
A的特征值 和特征向量 x还有一下性质:
(1) AT 与 A有相同的特征值 及特征向量 .
(2)若 A非奇异,则 A1 的特征值为 1,特征向量为 x.
(3)相似矩阵 BS1AS有相同的特征多项式.
11
例1 求 A的特征值及谱半径
4x2x3 5,
2x3 6.
显然,方程组(2.6)是容易求解的,解为
x (1,2,3)T.
第5章 6.分段插值法

1 [ x i −1 , x i ]内是三次多项式 )
2 S 3 ( x )和S '3 ( x )在[a , b]上连续 )
3 S 3 ( x i ) = y i , S ' 3 ( x i ) = y'i , )
Hermite 插值,记 hi = xi − x i −1 插值,
i = 0,1,L n
分段插值法
邹昌文
分段插值法/piecewise polynomial approximation/
•高次插值的龙格/Runge/现象 高次插值的龙格/ 高次插值的龙格 / 插值多项式余项公式说明插值节点越多, 插值多项式余项公式说明插值节点越多,一般 说来误差越小,函数逼近越好,但这也不是绝对的, 说来误差越小,函数逼近越好,但这也不是绝对的, 因为余项的大小既与插值节点的个数有关, 因为余项的大小既与插值节点的个数有关,也与函 f(x)的高阶导数有关 换句话说, 的高阶导数有关。 数f(x)的高阶导数有关。换句话说,适当地提高插 值多项式的次数,有可能提高计算结果的准确程度, 值多项式的次数,有可能提高计算结果的准确程度, 但并非插值多项式的次数越高越好。 但并非插值多项式的次数越高越好。当插值节点增 多时,不能保证非节点处的插值精度得到改善, 多时,不能保证非节点处的插值精度得到改善,有 时反而误差更大。 时反而误差更大。考察函数
例:在[−5, 5]上考察 f ( x ) = −
2.5
1 1 + x2
的Ln(x)。取 xi = −5 + 10 i (i = 0, ... , n) 。
n
2
Ln(x) × f (x) →
1.5
1
0.5
0
n 越大, 越大, 端点附近抖动 越大, 越大,称为 Runge 现象
数值分析第五版课后习题答案

数值分析第五版课后习题答案数值分析是一门应用数学的分支学科,主要研究如何利用数值方法解决实际问题。
在学习这门课程的过程中,课后习题是不可或缺的一部分。
本文将对《数值分析第五版》的课后习题进行一些探讨和解答。
第一章是数值分析的导论,主要介绍了误差分析和计算方法的基本概念。
在课后习题中,有一道题目是关于误差传播的。
假设有一个函数f(x, y) = x^2 + y^2,其中x和y的测量误差分别为Δx和Δy,要求计算f(x, y)的误差。
解答:根据误差传播公式,可以得到f(x, y)的误差为Δf = √[(∂f/∂x)^2 *(Δx)^2 + (∂f/∂y)^2 * (Δy)^2]。
对于本题而言,∂f/∂x = 2x,∂f/∂y = 2y。
代入公式,得到Δf = √[(2x)^2 * (Δx)^2 + (2y)^2 * (Δy)^2] = 2√(x^2 * (Δx)^2+ y^2 * (Δy)^2)。
第二章是插值与多项式逼近的内容。
其中一道习题涉及到拉格朗日插值多项式。
给定n+1个数据点(x0, y0), (x1, y1), ..., (xn, yn),要求构造一个n次多项式p(x),使得p(xi) = yi (i = 0, 1, ..., n)。
解答:拉格朗日插值多项式的表达式为p(x) = Σ(yi * Li(x)),其中Li(x) = Π[(x - xj) / (xi - xj)],j ≠ i。
将数据点代入表达式中,即可得到所求的多项式。
第三章是数值微积分的内容,其中一道习题是关于数值积分的。
给定一个函数f(x),要求使用复化梯形公式计算定积分∫[a, b]f(x)dx。
解答:复化梯形公式的表达式为∫[a, b]f(x)dx ≈ h/2 * [f(a) + 2Σf(xi) + f(b)],其中h = (b - a)/n,xi = a + i * h (i = 1, 2, ..., n-1)。
根据给定的函数f(x),代入公式中的各个值,即可得到近似的定积分值。
数值分析第5版

数值分析第5版简介数值分析是研究利用计算机进行数值计算的一门学科。
它包括了近似计算、数值解法、误差分析等内容,广泛应用于科学计算、工程计算以及其他领域。
《数值分析第5版》是数值分析领域的经典教材,由Richard L. Burden和J. Douglas Faires共同撰写。
内容概述本教材共分为12个章节,从基础概念开始,逐步介绍各种数值计算方法和技术。
以下是每个章节的简要介绍。
第1章:导论本章介绍了数值分析的基本概念和应用领域。
阐述了数值计算的重要性,并介绍了课程所涉及的主要内容和学习方法。
第2章:误差分析本章讲解了数值计算中的误差类型和误差分析方法。
包括绝对误差和相对误差的定义与计算、舍入误差、截断误差等。
第3章:插值与多项式逼近本章介绍了数值计算中的插值和多项式逼近方法。
包括拉格朗日插值、牛顿插值、三次样条插值等。
讲解了这些方法的原理和实现过程。
第4章:数值积分与数值微分本章讲解了数值计算中的数值积分和数值微分方法。
包括梯形法则、辛普森法则、数值微分的定义和计算过程。
第5章:非线性方程的数值解本章介绍了求解非线性方程的数值解法。
包括二分法、牛顿法、割线法等。
讲解了这些方法的原理和应用。
第6章:线性代数方程组的数值解法本章讲解了求解线性代数方程组的数值解法。
包括高斯消元法、LU分解法、迭代法等。
详细讲解了这些方法的原理和计算过程。
第7章:矩阵特征值问题本章介绍了求解矩阵特征值问题的数值解法。
包括幂法、反幂法、QR方法等。
讲解了这些方法的原理和实现过程。
第8章:常微分方程的数值解本章介绍了求解常微分方程的数值解法。
包括欧拉法、龙格-库塔法、多步法等。
讲解了这些方法的原理和应用。
第9章:偏微分方程的数值解本章讲解了求解偏微分方程的数值解法。
包括有限差分法、有限元法等。
详细讲解了这些方法的原理和实现过程。
第10章:函数逼近与数据拟合本章介绍了函数逼近和数据拟合的方法。
包括最小二乘法、曲线拟合等。
数值分析第五版第5章习题答案
第5章
)矩阵行列式的值很小。
)矩阵的范数小。
)矩阵的范数大。
(7)奇异矩阵的范数一定是零。
答:错误,
∞
•可以不为0。
(8)如果矩阵对称,则|| A||1 = || A||∞。
答:根据范数的定义,正确。
(9)如果线性方程组是良态的,则高斯消去法可以不选主元。
答:错误,不选主元时,可能除数为0。
(10)在求解非奇异性线性方程组时,即使系数矩阵病态,用列主元消去法产生的误差也很小。
答:错误。
对于病态方程组,选主元对误差的降低没有影响。
(11)|| A ||1 = || A T||∞。
答:根据范数的定义,正确。
(12)若A是n n的非奇异矩阵,则
)
(
cond
)
(
cond1-
=A
A。
答:正确。
A是n n的非奇异矩阵,则A存在逆矩阵。
根据条件数的定义有:
1
111111 cond()
cond()()
A A A
A A A A A A A
-
------
=•
=•=•=•
习题
如有侵权请联系告知删除,感谢你们的配合!。
数值分析第五版答案(全)
第一章 绪论1.设0x >,x 的相对误差为δ,求ln x 的误差。
解:近似值*x 的相对误差为*****r e x xe x x δ-=== 而ln x 的误差为()1ln *ln *ln **e x x x e x =-≈进而有(ln *)x εδ≈2.设x 的相对误差为2%,求n x 的相对误差。
解:设()nf x x =,则函数的条件数为'()||()p xf x C f x = 又1'()n f x nx-=, 1||n p x nx C n n-⋅∴== 又((*))(*)r p r x n C x εε≈⋅且(*)r e x 为2]((*))0.02n r x n ε∴≈3.下列各数都是经过四舍五入得到的近似数,即误差限不超过最后一位的半个单位,试指出它们是几位有效数字:*1 1.1021x =,*20.031x =, *3385.6x =, *456.430x =,*57 1.0.x =⨯解:*1 1.1021x =是五位有效数字; *20.031x =是二位有效数字; *3385.6x =是四位有效数字; *456.430x =是五位有效数字; *57 1.0.x =⨯是二位有效数字。
4.利用公式求下列各近似值的误差限:(1) ***124x x x ++,(2) ***123x x x ,(3) **24/x x .其中****1234,,,x x x x 均为第3题所给的数。
解: {*41*32*13*34*151()1021()1021()1021()1021()102x x x x x εεεεε-----=⨯=⨯=⨯=⨯=⨯***124***1244333(1)()()()()1111010102221.0510x x x x x x εεεε----++=++=⨯+⨯+⨯=⨯ ***123*********123231132143(2)()()()()1111.10210.031100.031385.610 1.1021385.6102220.215x x x x x x x x x x x x εεεε---=++=⨯⨯⨯+⨯⨯⨯+⨯⨯⨯≈**24****24422*4335(3)(/)()()110.0311056.430102256.43056.43010x x x x x x xεεε---+≈⨯⨯+⨯⨯=⨯=5计算球体积要使相对误差限为1,问度量半径R 时允许的相对误差限是多少 解:球体体积为343V R π=则何种函数的条件数为23'4343p R V R R C V R ππ===(*)(*)3(*)r p r r V C R R εεε∴≈=又(*)1r V ε=%1:故度量半径R 时允许的相对误差限为εε(ε∗)=13∗1%=13006.设028Y =,按递推公式1n n Y Y -=(n=1,2,…)计算到100Y 27.982≈(5位有效数字),试问计算100Y 将有多大误差解:1n n Y Y -=10099Y Y ∴=9998Y Y =9897Y Y =……10Y Y =依次代入后,有1000100Y Y =- %即1000Y Y =27.982≈, 100027.982Y Y ∴=-*310001()()(27.982)102Y Y εεε-∴=+=⨯100Y ∴的误差限为31102-⨯。
第5章插值法3
( 4) ( ) f ( 4) ( ) k ( x)4! 0 ,
所以
f ( 4) ( ) k ( x) . 4!
f ( 4) ( ) R( x) f ( x) P3 ( x) ( x x0 )(x x1 ) 2 ( x x2 ) , 4!
构造函数
(t ) f (t ) P3 (t ) k ( x)(t x0 )(t x1 ) 2 (t x2 ) ,
显然, ( x) 0, ( x0 ) 0, ( x1 ) 0, ( x2 ) 0 ,且 x1 为
(t ) 的二重零点(共5个零点),反复应用Rolle定理可知, (t ) 在 [ x0 , x2 ] 内至少有4个互异的零点,…, ( 4) (t ) 在
~ Q( x) H 2n1 ( x) H 2n1 ( x) 为次数不超过 2n 1 的多项式,且满足条件 Q( xi ) 0, Q( xi ) 0, i 0,1,, n. 这说明 x xi (i 0,1,, n) 都是 Q ( x) 的二重零点,即 Q( x) 共有 2n 2 个零点,故 Q( x) 0 ,即 ~ H 2n1 ( x) H 2n1 ( x) .
(t ) f (t ) H 2n1 (t ) k ( x) [ (t xi )]2 ,
易知 ( xi ) ( xi ) 0, (i 0,1,, n) 且 ( x) 0 (有 2n 3 个零点). 而由对 f ( x) 的假设及 H 2 n 2 ( x) 知, (t ) 具有 2n 2 阶导数.对 (t )反复应用Rolle定理,可知在 ( a, b) 内至
x
数值分析的一个小结
Interpolation and Polynomial ApproximationXue Jingnan(200805090173)April1,2011AbstractIn this report,we reviewed three different interpolations and polynomial ap-proximations[1]respectively,say,Lagrange Polynomial,Hermite Interpolation and Cubic Spline Interpolation.We introduced their algorithm descriptions, related mathematical deductions and applications to practical problems respec-tively.Moreover,a brief discussion of their advantages and limits are presented at last.Contents1Introduction2 2Interpolation and the Lagrange Polynomial42.1Mathematical deduction (4)2.2Numerical experiments (5)2.2.1Example1 (5)2.2.2Example2 (6)3Hermite Interpolation93.1Mathematical deduction (9)3.2Algorithm description (11)3.2.1pseudocode (11)3.2.2code (12)3.3Numerical experiments (12)3.3.1Example1 (12)3.3.2Example2 (13)4Cubic Spline Interpolation164.1Mathematical deduction (16)4.2Algorithm description (18)4.2.1pseudocode (18)4.2.2code (20)4.3Numerical experiments (21)4.3.1Example1 (21)4.3.2Example2 (21)5Discussion and Conclusion235.1Interpolation and the Lagrange Polynomial (23)5.2Hermite Interpolation (23)5.3Cubic Spline Interpolation (23)1Chapter1IntroductionOne of the most useful and well-known classes of functions mapping the set of real numbers into itself is the class of algebraic polynomials,the set of functions of the formP n(x)=a n x n+a n−1x n−1+···+a1x+a0where n is a nonnegative integer and a0,...,a n are real constants.One reason for their importance is that they uniformly approximate continuous functions. Given any function,defined and continuous on a closed and bounded inter-val,there exists a polynomial that is as”close”to the given function as desired. Another important reason for considering the class of polynomials in the approx-imation of functions is that the derivative and indefinite integral of a polynomial are easy to determine and are also polynomials.For these reasons,polynomials are often used for approximating continuous functions.In this report,we discussed approximating a function using polynomials and piecewise polynomials.The function can be specified by a given defining equation or by providing points in the plane through which the graph of the function passes.A set of nodes x0,x1,···,x n is given in each case,and more information,such as the value of various derivatives,may also be required.We need tofind an approximating function that satisfies the conditions specified by these dataThe interpolating polynomial P(x)is the polynomial of least degree that satisfies,for a function f,P(x i)=f(x i),for each i=0,1,...,n.Although this interpolating polynomial is unique,it can take many different forms.The Lagrange form is most often used for interpolating tables when n is small and for deriving formulas for approximating derivatives and integrals. Neville’s method is used for evaluating several interpolating polynomials for computation and are also used extensively for deriving formulas for solving differential equations.The Hermite polynomials interpolate a function and its2CHAPTER1.INTRODUCTION3 derivative at the nodes.They can be very accurate but require more information about the function being approximated.When there are a large number of nodes,the Hermite polynomials also exhibit oscillation weaknesses.However,polynomial interpolation has the inherent weaknesses of oscillation, particularly if the number of nodes is large.In this case,there are other methods that can be better applied,the most commonly used one of which is piecewise-polynomial interpolation.If function and derivative values are available,piece-wise cubic Hermite interpolation is recommended.This is the preferred method for interpolating values of function that is the solution to a different equation. When only the function values are available,free cubic spline interpolation can be used.This spline forces the second derivative of the spline to be zero at the endpoints.Other cubic splines require additional data.For example,the clamped cubic spline needs values of the derivative of the function at the end-points of the interval.Chapter2Interpolation and the Lagrange Polynomial2.1Mathematical deductionThe problem of determining a polynomial of degree one that passes through the distinct points(x0,y0)and(x1,y1)is the same as approximating a function f for which f(x0)=y0and y(x1)=y1by means of afirst-degree polynomial interpolating,or agreeing with,or agreeing with,the values of f at the given points.Wefirst define the functionsL0(x)=x−x1x0−x1and L1(x)=x−x0x1−x0and then defineP(x)=L0(x)f(x0)+L1(x)f(x1).SinceL0(x0)=1,L0(x1)=0,L1(x0)=0,and L1(x1)=1,we haveP(x0)=1·f(x0)+0·f(x1)=f(x0)=y0andP(x1)=0·f(x0)+1·f(x1)=f(x1)=y1So P is the unique linear function passing through(x0,y0)and(x1,y1).To generalize the concept of linear interpolation,consider the construction of a polynomial of degree at most n that passes through the n+1points(x0,f(x0),(x1,f(x1),...(x n,f(x n).In this case we need to construct,for each k=0,1,...,n,a function L n,k(x) with the property that L n,k(x i)=0when i=k and L n,k(x k)=1.To satisfy4CHAPTER2.INTERPOLATION AND THE LAGRANGE POLYNOMIAL5 L n,k(x i)=0for each i=k requires that the numerator of L n,k(x)contains the term(x−x0)(x−x1)(x−x2)···(x−x k−1)(x−x k+1)···(x−x n).To satisfy L n,k(x)=1,the denominator of L n,k(x)must be equal to this term evaluated at x=x k.Thus,L n,k(x)=(x−x0)(x−x1)(x−x2)···(x−x k−1)(x−x k+1)···(x−x n)(x k−x0)(x k−x1)(x k−x2)···(x k−x k−1)(x k−x k+1)···(x k−x n).The interpolating polynomial is easily described once the form of L n,k is known.This polynomial,called the n th Lagrange interpolating polyno-mial,is defined in the following theorem.Theorem2.1If x0,x1,···,x n are n+1distinct numbers and f is a function whose values are given at these numbers,then a unique polynomial P(x)of degree at most n exists withf(x k)=P(x k),for each k=0,1,...,n.This polynomial is given byP(x)=f(x0)L n,0(x)+···+f(x n)L n,n(x)=nk=0f(x k)L n,k(x),(2.1)where,for each k=0,1,···,n,L n,k(x)=(x−x0)(x−x1)(x−x2)···(x−x k−1)(x−x k+1)···(x−x n) (x k−x0)(x k−x1)(x k−x2)···(x k−x k−1)(x k−x k+1)···(x k−x n)=ni=0i=kx−x ix k−x i.(2.2)We will write L n,k(x)simply as L k(x)when there is no confusion as to its degree2.2Numerical experiments2.2.1Example1Using the numbers(or nodes)x0=2,x1=2.5,and x2=4tofind the second in-terpolating polynomial for f(x)=1/x requires that we determine the coefficient polynomials L0(x),L1(x),and L2(x).In nested form they areL0(x)=(x−2.5)(x−4)(2−2.5)(2−4)=(x−6.5)x+10,L1(x)=(x−2)(x−4)(2.5−2)(2.5−4)=(−4x+24)x−323,CHAPTER 2.INTERPOLATION AND THE LAGRANGE POLYNOMIAL 6andL 2(x )=(x −2)(x −2.5)(4−2)(4−2.5)=(x −4.5)x +53Since f (x 0)=f (2)=0.5,f (x 1)=f (2.5)=0.4,and f (x 2)=f (4)=0.25,we haveP (x )=2k =0f (x k )L k (x )=0.5((x −6.5)x +10)+0.4((−4x +24)x −323)+0.25(x −4.5)x +53=(0.05x −0.425)x +1.15.An approximation to f (3)=1/3isf (3)≈P (3)=0.3252.2.2Example 2For the given functions f (x ),let x 0=0,x 1=0.6,and x 2=0.9.Construct interpolation polynomials of degree at most two to approximate f (0.45),and find the actual error.(1)f (x )=cos x (2)f (x )=√1+x (3)f (x )=ln(x +1)(4)f (x )=tan xAt the beginning,we determined the coefficient polynomials L 0(x ),L 1(x ),and L 2(x ).In nested form they areL 0(x )=(x −0.6)(x −0.9)(0−0.6)(0−0.9)=5027[(x −1.5)x +0.54]+10,L 1(x )=(x −0)(x −0.9)(0.6−0)(0.6−0.9)=−509(x −0.9)x )L 2(x )=(x −0)(x −0.6)(0.9−0)(0.9−0.6)=10027(x −0.6)x (1)f (x )=cos xSince f (x 0)=f (0)=1,f (x 1)=f (0.6)=cos(0.6)≈0.8253,and f (x 2)=f (0.9)≈0.6216,we haveP (x )=2k =0f (x k )L k (x )≈(5027[(x −1.5)x +0.54]+0.8253[−509(x −0.9)x )]+0.6216[10027(x −0.6)x ]≈(−0.4309x −0.0326)x +1CHAPTER2.INTERPOLATION AND THE LAGRANGE POLYNOMIAL7An approximation to f(0.45)=cos(0.45)=0.9004isf(0.45)≈P(0.45)=0.8980And the actual error is f(0.45)−P(0.45)=2.4×10−3(2)f(x)=√1+xSince f(x0)=f(0)=1,f(x1)=f(0.6)≈1.2649, and f(x2)=f(0.9)≈1.3784,we haveP(x)=2k=0f(x k)L k(x)≈(5027[(x−1.5)x+0.54]+1.2649[−509(x−0.9)x)]+1.3784[10027(x−0.6)x]≈(−0.0702x+0.4836)x+1An approximation to f(0.45)=1.2042isf(0.45)≈P(0.45)=1.2034 And the actual error is f(0.45)−P(0.45)=7.955×10−4 (3)f(x)=ln(1+x)Since f(x0)=f(0)=0,f(x1)=f(0.6)≈0.4700,and f(x2)=f(0.9)≈0.6419,we haveP(x)=2k=0f(x k)L k(x)≈0.4700[−509(x−0.9)x)]+0.6419[10027(x−0.6)x]≈(−0.2337x+0.9236)xAn approximation to f(0.45)=0.3716isf(0.45)≈P(0.45)=0.3683 And the actual error is f(0.45)−P(0.45)=3.3×10−3 (4)f(x)=tan xSince f(x0)=f(0)=0,f(x1)=f(0.6)≈0.6841,and f(x2)=f(0.9)≈1.2602,we haveP(x)=2k=0f(x k)L k(x)≈0.6841[−509(x−0.9)x)]+1.2602[10027(x−0.6)x]≈(0.8669x+0.6200)xCHAPTER2.INTERPOLATION AND THE LAGRANGE POLYNOMIAL8An approximation to f(0.45)=0.4830isf(0.45)≈P(0.45)=0.4545And the actual error is f(0.45)−P(0.45)=0.0285Chapter3Hermite InterpolationLet x0,x1,...,x n be n+1distinct numbers in[a,b]and m i be a nonnegative integer associated with x i,for i=0,1,...,n.Suppose that f∈C m[a,b], where m=max0≤i≤n m i.The osculating polynomial approximating f is the polynomial P(x)of least degree such thatd k P(x i) dx k =d k f(x i)dx k,for each i=0,1,...,n and k=0,1,...,nNote that when n=0,the osculating polynomial approximating f is the m0th Taylor polynomial for f at x0.When m i=0for each i,the osculating polynomial is the n th Lagrange polynomial interpolating f on x0,x1,...,x n The case when m i=1,for each i,gives the Hermite polynomials.For a given function f,these polynomials agree with those of f,they have the same ”shape”as the function at(x i,f(x i))in the sense that the tangent lines to the polynomial and to the function agree.We will restrict our study of osculating polynomials to this situation.3.1Mathematical deductionFirstly,consider a theorem that describes precisely the form of the Hermite polynomials.Theorem3.1If f∈C1[a,b]and x0,...,x n∈[a,b]are distinct,the unique polynomial of least degree agreeing with f and f at x0,...,x n is the Hermite polynomial of degree at most2n+1given byH2n+1(x)=nj=0f(x j)H n,j(x)+nj=0f (x j)ˆH n,j(x)whereH n,j(x)=[1−2(x−x j)L n,j(x j)]L2n,j(x)9CHAPTER3.HERMITE INTERPOLATION10andˆHn,j(x)=(x−x j)L2n,j(x)In this context,L n,j(x)denotes the j th Lagrange coefficient polynomial of degree n defined in Chapter2.Moreover,if f∈C2n+2[a,b],thenf(x)=H2n+1(x)+(x−x0)2...(x−x n)2(2n+2)!f2n+2(ξ)for someξwith a<ξ<bAlthough Theorem3.1provides a complete description of the Hermite poly-nomials,it is clear that the need to determine and evaluate the Lagrange poly-nomials and their derivatives makes the procedure tedious even for small values of n.An alternative method for generating Hermite approximations has as its basis the Newton interpolatory divided-difference formula for the Lagrange polynomial at x0,x1,...,x n,P n(x)=f[x0]+nk=1f[x0,x1,...,x k](x−x0)···(x−x k−1)and the connection between the n th divided difference and n th derivative of f.Suppose that the distinct numbers x0,x1,/dots,x n are given together with the values of f and f at these numbers.Define a new sequence z0,z1,...,z2n+1 byz2i=z2i+1=x i,for each i=0,1,...,n,and construct the divided difference table that uses z0,z1,....z2n+1 Since z2i=z2i+1=x i,for each i,we cannot define f[z2i,z2i+1]by the divided difference formula.If we assume that the reasonable substitution in this situation is f[z2i,z2i+1]=f (z2i)=f (x i),we can use the entriesf (x0),f (x1),...,f (x n)in place of the undefinedfirst divided differencesf[z0,z1],f[z2,z3],...,f[z2n,z2n+1]The remaining divided differences are produced as usual,and the appropriate divided differences are employed in Newton’s interpolatory divided-difference formula.The Hermite polynomial is given byH2n+1(x)=f[z0]+2n+1k=1f[z0,...,x k](x−z0)(x−z1)...(x−z k−1)CHAPTER3.HERMITE INTERPOLATION11 3.2Algorithm description3.2.1pseudocodeTo obtain the coefficients of the Hermite interpolating polynomial H(x)on the (n+1)distinct numbers x0,...,x n for the function f:INPUT numbers x0,x1,...,x n;values f(x0),...,f(x n)and f (x0),...,f (x n) OUTPUT the numbers Q0,0,Q1,1,...,Q2n+1,2n+1whereH(x)=Q0,0+Q1,1(x−x0)+Q2,2(x−x0)2+Q3,3(x−x0)2(x−x1) +Q4,4(x−x0)2(x−x1)2+···+Q2n+1,2n+1(x−x0)2(x−x1)2···(x−x n−1)2(x−x n)Step1For i=0,1,...,n do Step2and3Step2Set z2i=x i;z2i+1=x i;Q2i,0=f(x i);Q2i+1,0=f(x i)Q2i+1,1=f (x i)Step3If i=0then setQ2i,1=Q2i,0−Q2i−1,0 z2i−z2i−1Step4For i=2,3,...,2n+1for j=2,3,...,i setQ i,j=Q i,j−1−Q i−1,j−1z i−z i−jStep5OUTPUT(Q0,0,Q1,1...Q2n+1,2n+1) STOPCHAPTER3.HERMITE INTERPOLATION12 3.2.2code3.3Numerical experiments3.3.1Example1Use the Hermite polynomial that agrees with the data in Table3.1tofind an approximation of f(1.5)Table3.1:Example1k x k f(x k)f (x k)11.30.6200860−0.522023221.60.4554022−0.569895931.90.2818186−0.5811571Table3.2shows the entries that are used for determining the Hermite poly-nomial H5(x)for x0,x1,and x2.The entries in Table3.3use the given data.CHAPTER3.HERMITE INTERPOLATION13H5(1.5)=0.6200860+(1.5−1.3)(−0.5220232)+(1.5−1.3)2(−0.0897427) +(1.5−1.3)2(1.5−1.6)(0.0663657)+(1.5−1.3)2(1.5−1.6)2(0.0026663)+(1.5−1.3)2(1.5−1.6)2(1.5−1.9)(−0.0027738)=0.51182773.3.2Example2Use Hermite interpolation to construct an approximating polynomial for the following data The entries in Table3.5use the given data.H5(x)=−0.0247500+(x+0.5)(0.7510000)+(x+0.5)2(2.7510000)+(x+0.5)2(x+0.25)CHAPTER3.HERMITE INTERPOLATION14Table3.2:z f(z)First divided differences Second divideddifferencesz0=x0f[z0]=f(x0)f[z0,z1]=f (x0)z1=x0f[z1]=f(x0)f[z0,z1,z2]f[z1,z2]=f[z2]−f[z1]z2−z1z2=x1f[z2]=f(x1)f[z1,z2,z3]f[z2,z3]=f (x1)z3=x1f[z3]=f(x1)f[z2,z3,z4]f[z3,z4]=f[z4]−f[z3]z4−z3z4=x2f[z4]=f(x2)f[z3,z4,z5]f[z4,z5]=f (x2)z5=x2f[z5]=f(x2)Third divided differences Fourth divideddifferencesFifth divided differencesf[z0,z1,z2,z3]f[z0,z1,z2,z3,z4]f[z1,z2,z3,z4]f[z0,z1,z2,z3,z4,z5]f[z1,z2,z3,z4,z5]f[z2,z3,z4,z5]CHAPTER3.HERMITE INTERPOLATION15Table3.3:1.30.6200860-0.52202321.30.6200860-0.0897427-0.54894600.06636571.60.4554022-0.06983300.0026663-0.56989590.0679655-0.0027738 1.60.4554022-0.02905370.0010020-0.57861200.06856671.90.2818186-0.0084837-0.58115711.90.2818186Table3.4:Example2k x k f(x k)f (x k)1−0.5−0.02475000.75100002−0.250.33493752.1890000301.1010004.0020000Table3.5:-0.5-0.02475000.7510000-0.5-0.0247500 2.75100001.43875001-0.250.3349375 3.001000002.189000010-0.250.3349375 3.501000003.064250010 1.1010000 3.75100004.00200000 1.1010000Chapter4Cubic Spline Interpolation The previous chapter concerned the approximation of arbitrary functions on closed intervals by the use of polynomials.However,the oscillatory nature of high-degree polynomials and the property that afluctuation over a small portion of the interval can induce largefluctuations over the entire rage restricts their use.An alternative approach is to divide the interval into a collection of subin-tervals and construct a(generally)different approximating polynomial on each subinterval.Approximation by functions of this type is called piecewise-polynomial approximationThe most common piecewise-polynomial approximation uses cubic polyno-mials between each successive pair of nodes and is called cubic spline in-terpolation.A general cubic polynomial involves four constants,so there is sufficientflexibility in the cubic spline procedure to ensure that the interpolant is not only continuously differentiable on the interval,but also has a continuous second derivative.The construction of the cubic spline does not,however,as-sume that the derivatives of the interpolant agree with those of the function it is approximating,even at the nodes.4.1Mathematical deductionGiven a function f defined on[a,b]and a set of nodes a=x0<x1</cdots< x n=b,a cubic spline interpolant S for f is a function that satisfies the following conditions:a.S(x)is a cubic polynomial,denoted S j(x),on the subinterval[x j,x j+1]foreach j=0,1,...,n−1;b.S(x j)=f(x j)for each j=0,1,...,n;c.S j+1(x j+1)=S j(x j+1)for each j=0,1,...,n−2;d.S j+1(x j+1)=S j(x j+1)for each j=0,1,...,n−2;16CHAPTER4.CUBIC SPLINE INTERPOLATION17e.S j+1(x j+1)=S j(x j+1)for each j=0,1,...,n−2;f.One of the following sets of boundary conditions is satisfied:(1)S (x0)=S (x n)=0(free or natural boundary)(2)S (x0)=f (x0)and S (x n)=f (x n(clamped boundary)Although cubic splines are defined with other boundary conditions,the con-ditions given in(f)are sufficient for our purposes.When the free boundary conditions occur,the spline is called a natural spline,and its graph approxi-mates the shape that a longflexible rod would assume if forced to go through the data points{(x0,f(x0)),(x1,f(x1)),...,(x n,f(x n))}.In this chapter,we only consider this oneTo construct the cubic spline interpolant for a given function f,the condi-tions in the definition are applied to the cubic polynomialsS j(x)=a j+b j(x−x j)+c j(x−x j)2+d j(x−x j)3for each j=0,1,...,n−1.SinceS j(x j)=a j=f(x j)condition(c)can be applied to obtaina j+1=S j+1(x j+1)=S j(x j+1)=a j+b j(x j+1−x j)+c j(x j+1−x j)2+d j(x j+1−x j)3 for each j=0,1,...,n−2.Since the terms x j+1−x j are used repeatedly in this development,it is convenient to introduce the simpler notationh j=x j+1−x jfor each j=0,1,...,n−1..If we also define a n=f(x n),then the equationa j+1=a j+b j h j+c j h2j+d j h3j(4.1) holds for each j=0,1,...,n−2In a similar manner,define b n=S (x n)and observe thatS j(x)=b j+2c j(x−x j)+3d j(x−x j)2implies S j(x j)=b j,for each j=0,1,...,n−1.Applying condition(d)givesb j+1=b j+2c j h j+3d j h2j,(4.2) for each j=0,1,...,n−2Another relationship between the coefficients of S j is obtained by defining c n=S (x n)/2and applying condition(e).Then,for each j=0,1,...,n−1,c j+1=c j+3d j h j(4.3)CHAPTER4.CUBIC SPLINE INTERPOLATION18 Solving for d j in Eq.(4.3)and substituting this value into Eqs.(4.1)and(4.2) gives,for j=0,1,...,n−1,the new equationsa j+1=a j+b j h j+h2j3(2c j+c j+1)(4.4)andb j+1=b j+h j(c j+c j+1)(4.5)Thefinal relationship involving the coefficients is obtained by solving the appropriate equation in the form of equation(3.4),first for b j,b j=1h j(a j+1−a j)−h j3(2c j+c j+1)(4.6)and then,with a reduction of the index,for b j−1.This givesb j−1=1h j−1(a j−a j−1)−h j−13(2c j−1+c j),Substituting these values into the equation derived from Eq(4.5),with the index reduced by one,gives the linear system of equations.h j−1c j−1+2(h j−1+h j)c j+h j c j+1=3h j(a j+1−a j)−3h j−1(a j−a j−1)(4.7)for each j=1,2,...,n−1.This system involves only the{c j}n j=0as unknownssince the values of{h j}n−1j=0and{a j}n j=0are given,respectively,by the spacingof the nodes{x j}n j=0and the values of f at the nodes.Note that once the values of{c j}n j=0are determined,it is a simple matter tofind the remainder of the constants{b j}n−1j=0from Eq.(4.6)and{d j}n−1j=0fromEq.(4.3),and to construct the cubic polynomials{S j(x)}n−1j=0.The major question that arises in connection with this construction is whether the values of{c j}n j=0can be found using the system of equations given in Eq.(4.7) and,if so,whether these values are unique.The following theorems indicate that this is the case when the free or natural boundary is imposed.As the proof of this theorem require some knowledge we haven’t learned,we decide not to introduce the proof to this report.Theorem4.1If f is defined at a=x0<x1<···<x n=b,then f has a unique natural spline interpolant S on the nodes x0,x1,....x n;that is,a spline interpolant that satisfies the boundary conditions S (a)=0and S (b)=0. 4.2Algorithm description4.2.1pseudocodeTo construct the cubic spline interpolant S for the function f,defined at the numbers x0<x1<···<x n,satisfying S (x0)=S (x n)=0:CHAPTER4.CUBIC SPLINE INTERPOLATION19INPUT n;x0,x1,...,x n;a0=f(x0),a1=f(x1),...,a n=f(x n).OUTPUT a j,b j,c j,d j for j=0,1,...,n−1.Step1For i=0,1,...,n−1set h i=x i+1−x i.Step2For i=1,...,n−1setαi=3h i(a i+1−a i)−3h i−1(a i−a i−1)Step3Set l0=1;u0=0;z0=0;Step4For i=1,2,...,n−1set l i=2(x i+1−x i−1)−h i−1u i−1;u i=h i/l iz i=(αi−h i−1z i−1)/l iStep5Set l n=1;z n=0;c n=0;Step6For j=n−1,n−2,...,0set c j=z j−u j c j+1;b j=(a j+1−a j)/h j−h j(c j+1+2c j)/3;d j=(c j+1−c j)/(3h j).Step7OUTPUT(a j,b j,c j,d j for j=0,1,...,n−1) STOPCHAPTER4.CUBIC SPLINE INTERPOLATION20 4.2.2codeCHAPTER4.CUBIC SPLINE INTERPOLATION21 4.3Numerical experiments4.3.1Example1Table4.1:Example1x0.9 1.3 1.9 2.1 2.6 3.0 3.9 4.4 4.7 5.0 f(x) 1.3 1.5 1.85 2.1 2.6 2.7 2.4 2.15 2.05 2.16.07.08.09.210.511.311.612.012.61313.32.25 2.3 2.25 1.95 1.40.90.70.60.50.40.25Using the codes above to generate the free cubic spline for this data produces the coefficients shown in Table4.2.Table4.2:j x j a j b j c j d j00.9 1.3 5.400.00-0.251 1.3 1.50.42-0.300.952 1.9 1.85 1.09 1.41-2.963 2.1 2.1 1.29-0.37-0.454 2.6 2.60.59-1.040.455 3.0 2.7-0.02-0.500.176 3.9 2.4-0.5-0.030.087 4.4 2.15-0.480.08 1.318 4.7 2.05-0.07 1.27-1.589 5.0 2.10.26-0.160.0410 6.0 2.250.08-0.030.00117.0 2.30.01-0.04-0.02128.0 2.25-0.14-0.110.02139.2 1.95-0.34-0.05-0.011410.5 1.4-0.53-0.10-0.021511.30.9-0.73-0.15 1.211611.0.7-0.490.94-0.841712.00.6-0.14-0.060.041812.60.5-0.180.00-0.451913.00.4-0.39-0.540.604.3.2Example2Construct the free cubic spline for the following data.CHAPTER4.CUBIC SPLINE INTERPOLATION22Table4.3:Example2x f(x)0.1-0.620499580.2-0.283986680.30.006600950.40.24842440Using the codes above to generate the free cubic spline for this data produces the coefficients shown below.Table4.4:j x j a j b j c j d j00.1-0.6205 3.45510-8.995810.2-0.2840 3.1852-2.6987-0.946320.30.0066 2.6171-2.98269.9421Since the coefficients have been determined,the polynomial will also be arrived at easily.Chapter5Discussion and Conclusion In this chapter,we will analyze advantages and limitations of each method re-spectively.5.1Interpolation and the Lagrange Polynomial Among these methods,the Lagrange polynomial is considered the simplest one, meaning that it needs the least workload.However,as the Lagrange polynomial only requires that the values of the interpolating polynomial are the same with those of original function on the given nodes,therefore its accuracy is relative low,compared with Hermite polynomial.Moreover,it has the inherent weakness of oscillation,which limits its application to situation where the number of nodes is large.5.2Hermite InterpolationCompared with the Lagrange Polynomial,Hermite polynomial interpolate a function and its derivative at the nodes,thus it can be expected to be more accurate.However,it also means that more information about the function being appropriated will be required,which limits its application to situations where not enough information about the original polynomial can be provided. And when there are a large of number of nodes,the Hermite polynomial also exhibit oscillation weaknesses.5.3Cubic Spline InterpolationThe most obvious advantage of this interpolation is that it successfully solved the inherent problem,oscillatory nature of high-degree polynomial,within the Hermite Interpolation and the Lagrange Interpolation.However,the workload of this interpolation is somewhat heavier than others.23Bibliography[1]Richard L.Burden and J.Douglas Faires:Numerical Analysis,chapter3(2001)24。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Title Page
(5.5.3)
x − xi+1 , Hi,i(x) = (x − xi) hi , Hi,i+1(x) = (x−xi+1) x − xi hi
2
Page 7 of 9
,
2
Go Back
Full Screen
2
,
Close
Quit
hi = xi+1 − xi for each i = 0, 1, · · · , n − 1.
Title Page
'u¼ê f ©ãS¢õª"
x ∈ [xi, xi+1],
Full Screen
Close
Quit
Theorem 5.5.1 Suppose f ∈ C 2[a, b]. If A1(x), given in (5.5.1), is the piecewise linear interpolating polynomial for f on the nodes a = x0 < x1 < · · · < xn = b, then, for any x ∈ [a, b], h2 |f (x) − A1(x)| ≤ M2, 8 where h = max |xi+1 − xi|,
A1 ( x ) = y i x − xi x − xi+1 + yi+1 , xi − xi+1 xi+1 − xi i = 0, 1, · · · , n − 1, (5.5.1)
Page 5 of 9 Go Back
a = x0 < x1 < · · · < xn = b,
Home Page
yi = f (xi) i = 0, 1, · · · , n.
0≤i≤n−1
(5.5.5)
M4 = max f (4)(x) ,
a≤x≤b
and A3(x) converges uniformly to f (x), as h tends to zero.
½n5.5.2 f ∈ C [a, b]. eA (x) ´'u!X
4 3
Home Page
5.5 Piecewise Polynomial Interpolation
©ãõª¢
5.5.1 Runge’s Phenomenon
9y
Home Page
Title Page
5.5.2 Piecewise Linear Polynomial Interpolation
©ã5õª¢
Page 1 of 9
Title Page
Page 4 of 9
Go Back
Full Screen
Close
Quit
5.5.2 Piecewise Linear Polynomial Interpolation
©ã5õª¢
½Â5.5.1 #¼ê f ½Â3«m[a, b]þ§® f 3: ? ¡©ãõª
Home Page
©ãngDA¢
A3(x) = yiHi,i(x) + yi+1Hi,i+1(x) + yiHi,i(x) + yi+1Hi,i+1(x),
Title Page
'u¼ê f '©ãngDA¢õª§Ù¥
Hi,i(x) = 1 + 2 x − xi hi x − xi+1 hi x − xi hi
(5.5.4)
5.5.3 Piecewise Cubic Hermite Interpolation
½Â5.5.2 ¼ê f ½Â3«m[a, b]þ§3!X ?§® ¡©ãõª
a = x0 < x1 < · · · < xn = b, y i = f (x i ), yi = f (x i ), i = 0, 1, · · · , n.
Home Page Title Page
9y
Page 2 of 9
Go Back
Full Screen
Close
Quit
Mitigations to the problem of Runge’s phenomenon (a) The oscillation can be minimized by using nodes that are distributed more densely towards the edges of the interval. A standard example of such a set of nodes is Chebyshev nodes, for which the maximum error is guaranteed to diminish with increasing polynomial order. (b) The phenomenon demonstrates that high degree polynomials are generally unsuitable for interpolation with equidistant nodes. The problem can be avoided by using piecewise polynomials. When trying to decrease the interpolation error one can increase the number of polynomial pieces instead of increasing the degree of the polynomials used.
Home Page
are given. A piecewise-cubic Hermite interpolating polynomial A3(x) for f is a piecewise polynomial: A3(x) = yiHi,i(x) + yi+1Hi,i+1(x) + yiHi,i(x) + yi+1Hi,i+1(x), where x ∈ [xi, xi+1], for each i = 0, 1, · · · , n − 1, and x − xi Hi,i(x) = 1 + 2 hi Hi,i+1(x) = 1 − 2 x − xi+1 hi x − xi+1 hi x − xi hi
5.5.3 Piecewise Cubic Hermite Interpolation
©ãngDA¢
Go Back
Full Screen
Close
Quit
5.5.1 Runge’s Phenomenon
Example 5.5.1 Consider the function:
9y
1 . 1 + 25x2 Runge found that if this function is interpolated at equidistant points xi between −1 and 1 such that: f (x ) = 2 xi = −1 + i · , for i = 0, 1, · · · , n, n with a polynomial pn(x) of degree ≤ n, the resulting interpolation oscillates toward the end of the interval, i.e. close to −1 and 1. This phenomenon is called Runge’s phenomenon ( ). In the mathematical field of numerical analysis, Runge’s phenomenon is a problem that occurs when using polynomial interpolation with polynomials of high degree. It was discovered by Carl David Tolm´ e Runge when exploring the behavior of errors when using polynomial interpolation to approximate certain functions (Runge 1901).
Quit
5.5.2 Piecewise Linear Polynomial Interpolation
©ã5õª¢ຫໍສະໝຸດ Definition 5.5.1 Given a set of nodes a = x0 < x1 < · · · < xn = b,
Home Page
and a function f defined on [a, b] whose values are given at these numbers, that is, yi = f (xi) for each i = 0, 1, · · · , n. A piecewise linear interpolating polynomial A1(x) for f is a piecewise polynomial: x − xi+1 x − xi + yi+1 , (5.5.1) A1 ( x ) = y i xi − xi+1 xi+1 − xi where x ∈ [xi, xi+1] for each i = 0, 1, · · · , n − 1.
2
x ∈ [xi, xi+1],
i = 0, 1, · · · , n − 1,
(5.5.3)