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

> # Uebung 9 Aufgabe 4: Interpolation

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

> # Fehlerabschaetzungen

> #

> restart:

> fehler:=fe = D(D(f))(y)/2*(x-x[i])*(x[i+1]-x);

[Maple Math]

> fehler[ab]:=f < max(fabs(D(D(f))(y)))/2*h/2*h/2;

[Maple Math]

> d:=(D@@2)(sin);

[Maple Math]

> d[max]:=1;

[Maple Math]

> solve(1/8*h^2*d[max]<0.5e-4, h);

[Maple Math]

> h:=0.02;

[Maple Math]

> n:=evalf(Pi/2/h);

[Maple Math]

> # also 79 Abschnitte (78 Werte, da sin(0)=0 und sin(Pi/2)=1 bekannt)

> restart: # jetzt quadratisch

> fehler[ab]:=f < max(fabs(D(D(D(f)))(y)))/6*(x-x[i-1])*(x-x[i])*(x[i+1]-x);

[Maple Math]

> kp:=x->(x+h)*x*(x-h);

[Maple Math]

> plot(subs(h=1,kp(x)), x=-1..1);

> (D@@3)(sin);

[Maple Math]

> d[max]:=1;

[Maple Math]

> kps:=D(kp);

[Maple Math]

> xl:=solve(kps(x)=0, x);

[Maple Math]

> et:=simplify(kp(xl[2]));

[Maple Math]

> et:=evalf(et);

[Maple Math]

> fehler[ab]:=f < d[max]/6*et;

[Maple Math]

> xl:=solve(d[max]/6*et=0.5e-4, h);

[Maple Math]

> h:=xl[3];

[Maple Math]

> n:=evalf(Pi/2/h);

[Maple Math]

> # also 18 Abschnitte (17 Werte, da sin(0)=0 und sin(Pi/2)=1 bekannt)

> restart: # jetzt kubisch

> fehler[ab]:=f < max(fabs((D@@4)(f)(y)))/24*(x-x[i-1])*(x-x[i])*(x[i+1]-x)*(x[i+2]-x);

[Maple Math]

> kp:=x->(x+3/2*h)*(x+1/2*h)*(x-1/2*h)*(x-3/2*h);

[Maple Math]

> plot(subs(h=1,kp(x)), x=-1.5..1.5);

> (D@@4)(sin);

[Maple Math]

> d[max]:=1;

[Maple Math]

> kps:=D(kp);

[Maple Math]

> xl:=solve(kps(x)=0, x);

[Maple Math]

> kp(0); evalf(kp(xl[2]));

[Maple Math]

[Maple Math]

> et:=h^4;

[Maple Math]

> fehler[ab]:=f < (d[max]/24*et);

[Maple Math]

> xl:=solve(d[max]/24*et=0.5e-4, h);

[Maple Math]

> h:=xl[4]; n:=evalf(Pi/2/h);

[Maple Math]

[Maple Math]

> # also 9 Abschnitte (8 Werte, da sin(0)=0 und sin(Pi/2)=1 bekannt)

>