comparison between larange and spline interpolation so sánh larange và spline

9 221 0
comparison between larange and spline interpolation so sánh larange và spline

Đang tải... (xem toàn văn)

Thông tin tài liệu

Comparison between LAGRANGE and Spline Interpolation Univ.Prof. Dr.Ing. habil. Josef BETTEN RWTH Aachen University Mathematical Models in Materials Science and Continuum Mechanics Augustinerbach 420 D52056 A a c h e n , Germany Abstract In this worksheet a comparison between the LAGRANGE and the Spline Interpolation is discused based upon eleven interpolating points. In this case we arrive at a LAGRANGE polynomial of degree ten. Highdegree polynomials have an oscillatory character and are therefore not ever suitable as interpolation functions. An alternative approach is given by a spline interpolation a piecewise approximation. In order to arrive at a smooth interpolation a cubic spline is often used. In the following it has been shown that highdegree splines are similar to LAGRANGE polynomials. A spline of degree = infinity is identical to the LAGRANGE approximation. LAGRANGE Interpolation Given n + 1 distinct points xk, k = 0,1,...,n and the corresponding values f(xk) the LAGRANGE interpolation polynomial is defined as: > restart: > P(x):=Sum(f(xk)Ln,k(x),k=0..n); := () Px ∑ = k 0 n () f x k () L , nkx Where for every k = 0,1,...,n we introduce a LAGRANGE basic function: > restart: > Ln,k(x):=Product((xxi)(xkxi),i=0..n), ki; := () L , nkx , ∏ = i 0 n − xxi − x k x i ≠ ki > Ln,k(xi):=deltaik=piecewise(i=k,1, ik,0); := () L , nkx i = δ ik { 1 = ik 0 ≠ ik 1 Example: Given the following experimental data > restart: > DATA:=xk,yk=0,120,1,139,2,134,3,149, 4,124,5,145,6,118,7,112,8,127,9,125,10,113; DATA , x k y k , 0 120 , 1 139 , 2 134 , 3 149 , 4 124 , 5 145 , 6 118 ,,,,,,, = := , 7 112 , 8 127 , 9 125 , 10 113 ,,, > L10,k(x):=Product((xxi)(xkxi),i=0..10); ki; := () L , 10 k x ∏ = i 0 10 − xxi − x k x i ≠ ki > L10,k(x):=value(%%); () L , 10 k x ()− xx0 ()− xx1 ()− xx2 ()− xx3 ()− xx4 ()− xx5 ()− xx6 ()− xx7 ()− xx8 := ()− xx9 ()− xx10 ()− x k x 0 ()− x k x 1 ()− x k x 2 ()− x k x 3 ()− x k x 4 ()− x k x 5 ()− x k x 6 ( ()− x k x 7 ()− x k x 8 ()− x k x 9 ()− x k x 10 ) > L10,k(xk):=1; := () L , 10 k x k 1 example for k = 4 > L10,4(x):=(%%)(xkx4)(xx4); () L , 10 4 x := ()− xx0 ()− xx1 ()− xx2 ()− xx3 ()− xx5 ()− xx6 ()− xx7 ()− xx8 ()− xx9 ()− xx10 ()− x k x 0 ()− x k x 1 ()− x k x 2 ()− x k x 3 ()− x k x 5 ()− x k x 6 ()− x k x 7 ()− x k x 8 ()− x k x 9 ()− x k x 10 > L10,4(x):= subs({xk=4,seq(xk=k,k=0..3),seq(xk=k,k=5..10)},%); := () L , 10 4 x x()− x 1( ) − x 2( ) − x 3( ) − x 5( ) − x 6( ) − x 7( ) − x 8( ) − x 9( ) − x 10 17280 > L10,4(4):=subs(x=4,%); := () L , 10 4 41 > L10,4(x):=expand(%%); () L , 10 4 x 1 17280 x 10 17 5760 x 9 31 480 x 8 2281 2880 x 7 34343 5760 x 6 163313 5760 x 5 728587 8640 x 4 − + − + − + := 71689 480 x 3 6751 48 x 2 105 2 x − + − Graphical representation of this LAGRANGE function > alias(th=thickness,co=color): > p1:=plot(L10,4(x),x=0..10,th=3,co=black): 2 > p2:=plotstextplot(5,2,`LAGRANGE Basic Function L10,4(x)`): > plotsdisplay(seq(pk,k=1..2)); Further LAGRANGE basic functions are illustrated in the next Figure. > for i from 0 to 10 do L10,i(x):=L10,k(x)(xkxi)(xxi) od: > These functions can be printed, if the doloop is ending with a semicolon. A colon can be used instead of a semicolon if we do not want to see the output,e.g. if you do not need to look at an intermediate result or if an output will be very large. > With values xk,k=0..10 we find: > for i from 0 to 10 do L10,i(x):=subs({xk=xi},{seq(xk=k,k=0..10)}, L10,i(x)) od: > furthermore > for i from 0 to 10 do L10,i(x):=expand(L10,i(x)) od: > graphical representation: > alias(th=thickness,co=color,sc=scaling): > p1:=plot({L10,2(x),L10,4(x),L10,5(x),L10,7(x)}, x=0..10,8..8,th=3,co=black,axes=boxed): > p2:=plotstextplot({5,4,`LAGRANGE Basic Functions`, 5,4,`L10,k(x), k = 2, 4, 5, 7`}): > plotsdisplay(seq(pk,k=1..2)); 3 With these LAGRANGE functions and the values f(xk) = yk we arríve at the following interpolation polynom of degree ten: > P10(x):=Sum(ykappaL10,kappa(x),kappa=0..10); := () P10 x ∑ = κ 0 10 y κ () L , 10 κ x > We read from the dataset > with(linalg): Warning, the protected names norm and trace have been redefined and unprotected > yk:= matrix(1,11,120,139,134,149,124,145,118,112,127,125,113); := y k 120 139 134 149 124 145 118 112 127 125 113 > mean_value:=127.8; := mean_value 127.8 > The LAGRANGE functions can be posted in a matrix with 11 rows and one column,i.e. a columnvector: > L10,k(x):=matrix(11,1,seq(L10,k(x),k=0..10)): > Thus, we find the polynomial P10(x) by the matrix product: > P10(x):=multiply(yk,L10,k(x)); () P10 x := 120 5001539 2520 x 37488433 7200 x 2 496694509 90720 x 3 8922667 8640 x 5 18774473 86400 x 6 218563 7560 x 7 + − + + − + ⎡ ⎣ ⎢ 4 40811 17280 x 8 3923 36288 x 9 3851 1814400 x 10 1116259589 362880 x 4 − + − − ⎤ ⎦ ⎥ > P10(x):=120+(50015392520)x(374884337200)x2+ (49669450990720)x3(1116259589362880)x4+ (89226678640)x5(1877447386400)x6+(2185637560)x7 (4081117280)x8+(392336288)x9(38511814400)x10; () P10 x 120 5001539 2520 x 37488433 7200 x 2 496694509 90720 x 3 8922667 8640 x 5 18774473 86400 x 6 + − + + − := 218563 7560 x 7 40811 17280 x 8 3923 36288 x 9 3851 1814400 x 10 1116259589 362880 x 4 + − + − − This polynomial together with the experimental data is represented in the next Figure. > alias(th=thickness,co=color): > p1:=plot(P10(x),x=0..10,th=3,co=black,axes=boxed): > p2:=plot(rhs(DATA),x=0..10,50..400,ytickmarks=4, style=point,symbol=cross,symbolsize=50,th=3,co=black): > p3:=plot(127.8,x=0..10,linestyle=4,th=2,co=black): > p4:=plotstextplot(5,300,`LAGRANGE Polynom P10(x)`): > plotsdisplay(seq(pk,k=1..4)); The dotted line in this Figure characterizes the mean value 127.8 of the experimental data. Because of its oscillatory character the polynomial P10(x) is less suitable as an interpolation function. In order to arrive at a smooth interpolation a cubic spline should be prefered. Cubic Spline in Comparison with the LAGRANGE Interpolation Polynom P10(x) It is very comfortable to arrive at spline functions by utilizing the Maple progamm Curve 5 Fitting as we can see in the following. > restart: with(stats): with(CurveFitting): > data:=0,120,1,139,2,134,3,149,4,124, 5,145,6,118,7,112,8,127,9,125,10,113; data , 0 120 , 1 139 , 2 134 , 3 149 , 4 124 , 5 145 , 6 118 , 7 112 , 8 127 ,,,,,,,,, := , 9 125 , 10 113 , > datay:=120,139,134,149,124,145,118,112,127,125,113; := datay ,,,,,,,,,, 120 139 134 149 124 145 118 112 127 125 113 > mean_value:=evalf(describemean(datay),4); := mean_value 127.8 > cubic spline S3(x) > S3(x):=Spline(data,x,degree=3); := () S 3 x ⎧ ⎩ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ + − 120 4228519 151316 x 1353515 151316 x 3 < x 1 + − + 6834207 75658 931423 7964 x 6734259 75658 x 2 3135991 151316 x 3 < x 2 − + − 37508351 75658 74325395 151316 x 16271349 75658 x 2 238555 7964 x 3 < x 3 − + − + 4706209 3439 207764503 151316 x 809043 1991 x 2 5915229 151316 x 3 < x 4 − + − 140718485 37829 369695849 151316 x 20719455 37829 x 2 6115195 151316 x 3 < x 5 − + − + 370878155 75658 413082301 151316 x 36838905 75658 x 2 4321847 151316 x 3 < x 6 − + − 174871333 75658 132667187 151316 x 8640219 75658 x 2 731389 151316 x 3 < x 7 − + − 144451013 37829 230407781 151316 x 7810845 37829 x 2 73489 7964 x 3 < x 8 − + − + 106791995 37829 7708249 7964 x 360561 3439 x 2 566545 151316 x 3 < x 9 − + − + 6916961 6878 54791785 151316 x 2839845 75658 x 2 189323 151316 x 3 otherwise The above LAGRANGE interpolation polynom is written as: > P10(x):=120+(50015392520)x(374884337200)x2+ (49669450990720)x3(1116259589362880)x4+ (89226678640)x5(1877447386400)x6+ (2185637560)x7(4081117280)x8+(392336288)x9 (38511814400)x10; () P10 x 120 5001539 2520 x 37488433 7200 x 2 496694509 90720 x 3 1116259589 362880 x 4 8922667 8640 x 5 + − + − + := 6 18774473 86400 x 6 218563 7560 x 7 40811 17280 x 8 3923 36288 x 9 3851 1814400 x 10 − + − + − > The cubic spline, the LAGRANGE polynom, and the data values > are represented in the following Figure. > alias(th=thickness,co=color): > p1:=plot(S3(x),x=0..10,50..400,th=3,co=black): > p2:=plot(P10(x),x=0..10,th=1,co=black,axes=boxed): > p3:=plot(data,style=point,symbol=cross, symbolsize=50,th=3,co=black): > p4:=plot(127.8,x=0..10,linestyle=4,th=2,co=black): > p5:=plotstextplot({5,350,`Cubic Spline S3(x)`, 5,300,`LAGRANGE P10(x)`}): > plotsdisplay(seq(pk,k=1..5)); The dotted line characterizes the mean value 127.8 of the experimental data. This Figure shows the smooth cubic spline and the more or less oscillating LAGRANGE polynomial, which is not suitable as an intepolating function. HighDegree Splines Sn(x) in Comparison with the LAGRANGE Polynom P10(x) As mentioned obove spline functions of arbitrary degree can be easyly found by utilizing the MAPLE program Curve Fitting. > for i in 3,10,15,20,21 do 7 Si(x):=Spline(data,x,degree=i) od: > S3(x):=Spline(data,x,degree=3): > S10(x):=Spline(data,x,degree=10): > S15(x):=Spline(data,x,degree=15): > S20(x):=Spline(data,x,degree=20): > S21(x):=Spline(data,x,degree=21): > > graphical representation in the next Figure > alias(th=thickness,co=color): > p1:=plot({S3(x),S10(x),S15(x),S20(x),S21(x)}, x=0..10,50..400,th=1,co=black): > p2:=plot(P10(x),x=0..10,th=3,co=black): > p3:=plot(data,style=point,symbol=cross,symbolsize=50, th=3,co=black,axes=boxed,ytickmarks=4): > p4:=plot(127.8,x=0..10,linestyle=4,th=2,co=black): > p5:=plotstextplot({5,350,`Splines S3,10,15,20,21(x)`, 5,300,`LAGRANGE P10(x)`}): > plotsdisplay(seq(pk,k=1..5)); This Figure illustrates that by increasing the degree the splines are more and more similar to the LAGRANGE polynom (thick line). A spline of degree = infinity is identical to the LAGRANGE approximation as can be proved by introducing the Ltwo error norm: > L2:=sqrt((110)Int((P10(xi)Sn(xi))2,xi=0..10)); 8 := L 2 1 10 10 d ⌠ ⌡ ⎮ 0 10 ()− () P10 ξ () S n ξ 2 ξ > for i in 3,10,15,20,21 do L2i:= evalf(sqrt((110)int((P10(x)Si(x))2,x=0..10)),4) od; := L 2 3 61.64 := L 2 10 55.30 := L 2 15 27.92 := L 2 20 5.206 := L 2 21 0. > L2infinity:= Limit(sqrt((110)Int((P10(xi)Sn(xi))2,x=0..10)), n=infinity)=0; := L 2 ∞ = lim → n ∞ 1 10 10 d ⌠ ⌡ ⎮ 0 10 ()− () P10 ξ () S n ξ 2 x 0 We see for degree = 21 the spline curve is already identical to the LAGRANGE polynom. Summary This paper is concerned with both the LAGRANGE and the spline interpolation. Based upon a given set of eleven experimental data we arrive at a LAGRANGE interpolation polynom of degree ten. Because of its oscillation property the LAGRANGE polynomial is not suitable to interpolate the given experimental data. Thus, the spline interpolation has been discused as an alternative approach. Especially, the common cubic spline leads to a smooth interpolation. Furthermore, it has been illustrated that highdegree splines are approaching to LAGRANGE polynomials. A spline of degree = infinity is identical to the LAGRANGE approximation. > 9

Comparison between LAGRANGE and Spline Interpolation Univ.-Prof Dr.-Ing habil Josef BETTEN RWTH Aachen University Mathematical Models in Materials Science and Continuum Mechanics Augustinerbach 4-20 D-52056 A a c h e n , Germany Abstract In this worksheet a comparison between the LAGRANGE and the Spline Interpolation is discused based upon eleven interpolating points In this case we arrive at a LAGRANGE polynomial of degree ten High-degree polynomials have an oscillatory character and are therefore not ever suitable as interpolation functions An alternative approach is given by a spline interpolation - a piecewise approximation In order to arrive at a smooth interpolation a cubic spline is often used In the following it has been shown that high-degree splines are similar to LAGRANGE polynomials A spline of degree = infinity is identical to the LAGRANGE approximation LAGRANGE Interpolation Given n + distinct points x[k], k = 0,1, ,n and the corresponding values f(x[k]) the LAGRANGE interpolation polynomial is defined as: > restart: > P(x):=Sum(f(x[k])*L[n,k](x),k=0 n); n P( x ) := ∑ f( x ) L n, k( x ) k k=0 Where for every k = 0,1, ,n we introduce a LAGRANGE basic function: > restart: > L[n,k](x):=Product((x-x[i])/(x[k]-x[i]),i=0 n), ki; n Ln, k( x ) := x − xi ∏x i=0 k − xi ,k≠i > L[n,k](x[i]):=delta[ik]=piecewise(i=k,1, ik,0); Ln, k( xi ) := δik = { 1 i=k i≠k Example: Given the following experimental data > restart: > DATA:=[x[k],y[k]]=[[0,120],[1,139],[2,134],[3,149], [4,124],[5,145],[6,118],[7,112],[8,127],[9,125],[10,113]]; DATA := [ xk, yk ] = [ [ 0, 120 ], [ 1, 139 ], [ 2, 134 ], [ 3, 149 ], [ 4, 124 ], [ 5, 145 ], [ 6, 118 ], [ 7, 112 ], [ 8, 127 ], [ 9, 125 ], [ 10, 113 ] ] > L[10,k](x):=Product((x-x[i])/(x[k]-x[i]),i=0 10); ki; 10 L10, k( x ) := x − xi ∏x i=0 k − xi k≠i > L[10,k](x):=value(%%); L10, k( x ) := ( x − x0 ) ( x − x1 ) ( x − x2 ) ( x − x3 ) ( x − x4 ) ( x − x5 ) ( x − x6 ) ( x − x7 ) ( x − x8 ) ( x − x9 ) ( x − x10 ) ( ( xk − x ) ( xk − x1 ) ( xk − x ) ( xk − x3 ) ( xk − x ) ( xk − x5 ) ( xk − x ) ( xk − x7 ) ( xk − x8 ) ( xk − x9 ) ( xk − x10 ) ) > L[10,k](x[k]):=1; L10, k( xk ) := example for k = > L[10,4](x):=(%%)*(x[k]-x[4])/(x-x[4]); L10, 4( x ) := ( x − x0 ) ( x − x1 ) ( x − x2 ) ( x − x3 ) ( x − x5 ) ( x − x6 ) ( x − x7 ) ( x − x8 ) ( x − x9 ) ( x − x10 ) ( xk − x0 ) ( xk − x1 ) ( xk − x2 ) ( xk − x3 ) ( xk − x5 ) ( xk − x6 ) ( xk − x7 ) ( xk − x8 ) ( xk − x9 ) ( xk − x10 ) > L[10,4](x):= subs({x[k]=4,seq(x[k]=k,k=0 3),seq(x[k]=k,k=5 10)},%); x ( x − ) ( x − ) ( x − ) ( x − ) ( x − ) ( x − ) ( x − ) ( x − ) ( x − 10 ) 17280 > L[10,4](4):=subs(x=4,%); L10, 4( x ) := L10, 4( ) := > L[10,4](x):=expand(%%); L10, 4( x ) := − 17 31 2281 34343 163313 728587 x10 − x + x − x + x − x + x 17280 5760 480 2880 5760 5760 8640 71689 6751 105 x + x − x 480 48 Graphical representation of this LAGRANGE function > alias(th=thickness,co=color): > p[1]:=plot(L[10,4](x),x=0 10,th=3,co=black): > p[2]:=plots[textplot]([5,-2,`LAGRANGE Basic Function L[10,4](x)`]): > plots[display](seq(p[k],k=1 2)); Further LAGRANGE basic functions are illustrated in the next Figure > for i from to 10 L[10,i](x):=L[10,k](x)*(x[k]-x[i])/(x-x[i]) od: > # These functions can be printed, if the doloop is ending with a semicolon A colon can be used instead of a semicolon if we not want to see the output,e.g if you not need to look at an intermediate result or if an output will be very large > # With values x[k],k=0 10 we find: > for i from to 10 L[10,i](x):=subs({x[k]=x[i]},{seq(x[k]=k,k=0 10)}, L[10,i](x)) od: > # furthermore > for i from to 10 L[10,i](x):=expand(L[10,i](x)) od: > # graphical representation: > alias(th=thickness,co=color,sc=scaling): > p[1]:=plot({L[10,2](x),L[10,4](x),L[10,5](x),L[10,7](x)}, x=0 10,-8 8,th=3,co=black,axes=boxed): > p[2]:=plots[textplot]({[5,4,`LAGRANGE Basic Functions`], [5,-4,`L[10,k](x), k = 2, 4, 5, 7`]}): > plots[display](seq(p[k],k=1 2)); With these LAGRANGE functions and the values f(x[k]) = y[k] we arríve at the following interpolation polynom of degree ten: > P[10](x):=Sum(y[kappa]*L[10,kappa](x),kappa=0 10); 10 P10( x ) := ∑y κ L10, κ( x ) κ=0 > # We read from the data-set > with(linalg): Warning, the protected names norm and trace have been redefined and unprotected > y[k]:= matrix(1,11,[120,139,134,149,124,145,118,112,127,125,113]); yk := [120 139 134 > mean_value:=127.8; > > > > 149 124 145 118 112 127 125 113] mean_value := 127.8 # The LAGRANGE functions can be posted in a matrix with 11 rows and one column,i.e a columnvector: L[10,k](x):=matrix(11,1,[seq(L[10,k](x),k=0 10)]): # Thus, we find the polynomial P[10](x) by the matrix product: P[10](x):=multiply(y[k],L[10,k](x)); P10( x ) := 5001539 37488433 496694509 8922667 18774473 218563 ⎡ ⎢⎢ 120 + x− x + x + x − x + x 2520 7200 90720 8640 86400 7560 ⎣ 40811 3923 3851 10 1116259589 ⎤ x + x − x − x ⎥⎥ ⎦ 17280 36288 1814400 362880 > P[10](x):=120+(5001539/2520)*x-(37488433/7200)*x^2+ (496694509/90720)*x^3-(1116259589/362880)*x^4+ (8922667/8640)*x^5-(18774473/86400)*x^6+(218563/7560)*x^7(40811/17280)*x^8+(3923/36288)*x^9-(3851/1814400)*x^10; − P10( x ) := 120 + + 5001539 37488433 496694509 8922667 18774473 x− x + x + x − x 2520 7200 90720 8640 86400 218563 40811 3923 3851 10 1116259589 x − x + x − x − x 7560 17280 36288 1814400 362880 This polynomial together with the experimental data is represented in the next Figure > alias(th=thickness,co=color): > p[1]:=plot(P[10](x),x=0 10,th=3,co=black,axes=boxed): > p[2]:=plot(rhs(DATA),x=0 10,50 400,ytickmarks=4, style=point,symbol=cross,symbolsize=50,th=3,co=black): > p[3]:=plot(127.8,x=0 10,linestyle=4,th=2,co=black): > p[4]:=plots[textplot]([5,300,`LAGRANGE Polynom P[10](x)`]): > plots[display](seq(p[k],k=1 4)); The dotted line in this Figure characterizes the mean value 127.8 of the experimental data Because of its oscillatory character the polynomial P[10](x) is less suitable as an interpolation function In order to arrive at a smooth interpolation a cubic spline should be prefered Cubic Spline in Comparison with the LAGRANGE Interpolation Polynom P[10](x) It is very comfortable to arrive at spline functions by utilizing the Maple progamm Curve Fitting as we can see in the following > restart: with(stats): with(CurveFitting): > data:=[0,120],[1,139],[2,134],[3,149],[4,124], [5,145],[6,118],[7,112],[8,127],[9,125],[10,113]; data := [ 0, 120 ], [ 1, 139 ], [ 2, 134 ], [ 3, 149 ], [ 4, 124 ], [ 5, 145 ], [ 6, 118 ], [ 7, 112 ], [ 8, 127 ], [ 9, 125 ], [ 10, 113 ] > datay:=[120,139,134,149,124,145,118,112,127,125,113]; datay := [ 120, 139, 134, 149, 124, 145, 118, 112, 127, 125, 113 ] > mean_value:=evalf(describe[mean](datay),4); mean_value := 127.8 > # cubic spline S[3](x) > S[3](x):=Spline([data],x,degree=3); ⎧ 4228519 1353515 ⎪ x− x 120 + ⎪ 151316 151316 ⎪ ⎪ 6834207 931423 6734259 3135991 ⎪ + x− x + x ⎪ 75658 7964 75658 151316 ⎪ ⎪ ⎪ 37508351 74325395 16271349 238555 ⎪ − x + x − x ⎪ 75658 151316 75658 7964 ⎪ ⎪ 4706209 207764503 809043 5915229 ⎪ + x− x + x ⎪ − ⎪ 3439 151316 1991 151316 ⎪ ⎪ 140718485 369695849 20719455 6115195 ⎪ x+ x − x − ⎪ 37829 151316 37829 151316 ⎪ S3( x ) := ⎨⎪ 36838905 4321847 ⎪ 370878155 413082301 x− x + x + ⎪− ⎪ 75658 151316 75658 151316 ⎪ ⎪ 174871333 132667187 8640219 731389 ⎪ x x − x − + ⎪ 75658 151316 75658 151316 ⎪ ⎪ 144451013 230407781 7810845 73489 ⎪ − x+ x − x ⎪ ⎪ 37829 151316 37829 7964 ⎪ ⎪ 106791995 7708249 360561 566545 ⎪ − + x− x + x ⎪ 37829 7964 3439 151316 ⎪ ⎪ 6916961 54791785 2839845 189323 ⎪ − + x− x + x ⎪ 6878 151316 75658 151316 ⎩ x > The dotted line characterizes the mean value 127.8 of the experimental data This Figure shows the smooth cubic spline and the more or less oscillating LAGRANGE polynomial, which is not suitable as an intepolating function High-Degree Splines S[n](x) in Comparison with the LAGRANGE Polynom P[10](x) As mentioned obove spline functions of arbitrary degree can be easyly found by utilizing the MAPLE program Curve Fitting > for i in [3,10,15,20,21] > > > > > > > > > > > > > > S[i](x):=Spline([data],x,degree=i) od: S[3](x):=Spline([data],x,degree=3): S[10](x):=Spline([data],x,degree=10): S[15](x):=Spline([data],x,degree=15): S[20](x):=Spline([data],x,degree=20): S[21](x):=Spline([data],x,degree=21): # graphical representation in the next Figure alias(th=thickness,co=color): p[1]:=plot({S[3](x),S[10](x),S[15](x),S[20](x),S[21](x)}, x=0 10,50 400,th=1,co=black): p[2]:=plot(P[10](x),x=0 10,th=3,co=black): p[3]:=plot([data],style=point,symbol=cross,symbolsize=50, th=3,co=black,axes=boxed,ytickmarks=4): p[4]:=plot(127.8,x=0 10,linestyle=4,th=2,co=black): p[5]:=plots[textplot]({[5,350,`Splines S[3,10,15,20,21](x)`], [5,300,`LAGRANGE P[10](x)`]}): plots[display](seq(p[k],k=1 5)); This Figure illustrates that by increasing the degree the splines are more and more similar to the LAGRANGE polynom (thick line) A spline of degree = infinity is identical to the LAGRANGE approximation as can be proved by introducing the L-two error norm: > L[2]:=sqrt((1/10)*Int((P[10](xi)-S[n](xi))^2,xi=0 10)); 10 ⌠ ⎮ ( P ( ξ ) − S ( ξ ) )2 dξ ⎮ 10 n ⌡ L2 := 10 10 > for i in [3,10,15,20,21] L[2][i]:= evalf(sqrt((1/10)*int((P[10](x)-S[i](x))^2,x=0 10)),4) od; L2 := 61.64 L2 := 55.30 10 L2 := 27.92 15 L2 := 5.206 20 L2 := 21 > L[2][infinity]:= Limit(sqrt((1/10)*Int((P[10](xi)-S[n](xi))^2,x=0 10)), n=infinity)=0; 10 L2 := lim 10 ∞ n → ∞ 10 ⌠ ⎮ ( P ( ξ ) − S ( ξ ) )2 dx = 10 n ⎮ ⌡ We see for degree = 21 the spline curve is already identical to the LAGRANGE polynom Summary This paper is concerned with both the LAGRANGE and the spline interpolation Based upon a given set of eleven experimental data we arrive at a LAGRANGE interpolation polynom of degree ten Because of its oscillation property the LAGRANGE polynomial is not suitable to interpolate the given experimental data Thus, the spline interpolation has been discused as an alternative approach Especially, the common cubic spline leads to a smooth interpolation Furthermore, it has been illustrated that high-degree splines are approaching to LAGRANGE polynomials A spline of degree = infinity is identical to the LAGRANGE approximation >

Ngày đăng: 23/04/2017, 18:53

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan