> #==================================

> # Uebung 9 Aufgabe 5: Interpolation

> #=================================

> # Aitken - Fehlerabschaetzungen

> #

> restart:with(linalg):

Warning, new definition for norm

Warning, new definition for trace

> n:=3; x:=vector([0.0,0.5,1.0,1.5]); f:=vector([0.0,0.47943,0.84147,0.99750]);

[Maple Math]

[Maple Math]

[Maple Math]

> X:=0.75; NT:=matrix(n+1,n+1): for id from 1 to n+1 do NT[id,1]:=f[id]: od: for jd from 1 to n do for id from 1 to n+1 - jd do h:=x[id+jd]-x[id]: NT[id,jd+1]:=NT[id+1,jd]+(x[id+jd]-X)/h*(NT[id,jd]-NT[id+1,jd]): od:od:

[Maple Math]

> for id from 1 to n+1 do printf(`%9.6f | `,x[id]); for jd from 1 to n+2-id do printf(`%9.6f `, NT[id,jd]); od; printf(`\n`); od;

0.000000 | 0.000000 .719145 .675124 .680663

.500000 | .479430 .660450 .686201

1.000000 | .841470 .763455

1.500000 | .997500

> # sin(0.75) ist also ungefaehr 0.680663

> (D@@4)(sin); # kubisch, alse 4. Ableitung fuer Fehler, Faktor 1/4!

[Maple Math]

> fe < 1/24*1*(0.75-0)*(0.75-0.5)*(1-0.75)*(1.5-0.75); # sin(x) <= 1

[Maple Math]

> # Teil b)

> restart:with(linalg):

Warning, new definition for norm

Warning, new definition for trace

> # Symmetrie gewinnt! sin(x) = -sin(-x)

> n:=3; x:=vector([-0.5,0.0,0.5,1.0]); f:=vector([-0.47943,0.0,0.47943,0.84147]);

[Maple Math]

[Maple Math]

[Maple Math]

> X:=0.25; NT:=matrix(n+1,n+1): for id from 1 to n+1 do NT[id,1]:=f[id]: od: for jd from 1 to n do for id from 1 to n+1 - jd do h:=x[id+jd]-x[id]: NT[id,jd+1]:=NT[id+1,jd]+(x[id+jd]-X)/h*(NT[id,jd]-NT[id+1,jd]): od:od:

[Maple Math]

> for id from 1 to n+1 do printf(`%8.5f | `,x[id]); for jd from 1 to n+2-id do printf(`%9.5f `, NT[id,jd]); od; printf(`\n`); od;

-.50000 | -.47943 .23972 .23972 .24705

0.00000 | 0.00000 .23972 .25439

.50000 | .47943 .29841

1.00000 | .84147

> fe < 1/24*sin(1.0)*(0.25+0.5)*(0.25)*(0.5-0.25)*(1.0-0.25);

[Maple Math]

>