Příklad číslo 2 > with(CurveFitting): > P:=PolynomialInterpolation([9,3,4.5,10,5.5,12.5],[9+sin(9),3+sin( 3),4.5+sin(4.5),10+sin(10),5.5+sin(5.5),12.5+sin(12.5)],x,form=La grange); P 0.003023431595 ( )+9 ( )sin 9 ( )-x 3 ( )-x 4.5 ( )-x 10 ( )-x 5.5 ( )-x 12.5:= 0.0006683375104 ( )+3 ( )sin 3 ( )-x 9 ( )-x 4.5 ( )-x 10 ( )-x 5.5 ( )-x 12.50.01186016795 ( )-x 9 ( )-x 3 ( )-x 10 ( )-x 5.5 ( )-x 12.5+ 0.002308802309 ( )+10 ( )sin 10 ( )-x 9 ( )-x 3 ( )-x 4.5 ( )-x 5.5 ( )-x 12.50.01739486503 ( )-x 9 ( )-x 3 ( )-x 4.5 ( )-x 10 ( )-x 12.50.002671037186 ( )-x 9 ( )-x 3 ( )-x 4.5 ( )-x 10 ( )-x 5.5+ > expand(evalf(P)); 3.09117021 x 2.21991775 x2 0.545203518 x3 0.0513743551 x4 - + 0.00166192229 x5 2.88384950+ + > plot([x+sin(x),P],x=0..15,color=[blue,red],thickness=3,legend=["P ůvodní funkce","Lagrangeův polynom"]); Příklad číslo 3 - pomocné výpočty > with(linalg): > A:=linalg[matrix](4,4,[1,1,1,1,1024,256,64,16,5,4,3,2,1280,256,48 ,8]); :=A 1 1 1 1 1024 256 64 16 5 4 3 2 1280 256 48 8 > B:=inverse(A); :=B -4 27 -7 864 1 9 1 144 13 9 1 18 -1 -1 24 -40 9 -25 288 8 3 1 16 112 27 17 432 -16 9 -1 36 > a:=linalg[matrix](4,1,[2,-5,-2,1]); :=a 2 -5 -2 1 > linalg[multiply](B,a); -407 864 329 72 -3953 288 5023 432 Příklad číslo 4 - pomocné výpočty > C:=linalg[matrix](6,6,[1,1,0,0,0,0,0,0,1,1,1,1,0,0,27,9,3,1,3,1,- 3,-2,-1,0,6,0,-6,-2,0,0,0,0,18,2,0,0]); :=C 1 1 0 0 0 0 0 0 1 1 1 1 0 0 27 9 3 1 3 1 -3 -2 -1 0 6 0 -6 -2 0 0 0 0 18 2 0 0 > c:=linalg[matrix](6,1,[-1/2,1/2,1/10,0,0,0]); :=c -1 2 1 2 1 10 0 0 0 > C1:=inverse(C); :=C1 -1 6 -1 12 1 12 1 6 1 9 -1 18 7 6 1 12 -1 12 -1 6 -1 9 1 18 1 12 1 24 -1 24 -1 12 1 36 1 9 -3 4 -3 8 3 8 3 4 -1 4 -1 2 23 12 11 24 -11 24 -23 12 23 36 5 9 -5 4 7 8 1 8 5 4 -5 12 -1 6 > linalg[multiply](C1,c); 1 20 -11 20 -1 40 9 40 -31 40 43 40 Na příslušném intervalu: > with(plots): > multiple(plot,[1/(1+x^2),x=0..3,color=red,thickness=3,legend="Pův odní funkce"],[1- 11/20*x+1/20*x^3,x=0..1,color=blue,thickness=3,legend="S_0"],[43/ 40-31/40*x+9/40*x^2- 1/40*x^3,x=1..3,color=green,thickness=3,legend="S_1"]); Mimo něj: > multiple(plot,[1/(1+x^2),x=5..7,color=red,thickness=3,legend="Původní funkce"],[1- 11/20*x+1/20*x^3,x=- 5..4,color=blue,thickness=3,legend="S_0"],[43/40- 31/40*x+9/40*x^2-1/40*x^3,x=- 2..7,color=green,thickness=3,legend="S_1"]); >