Árpád apánk

Blog. ennyi. semmi több. megtalalsz itt jó pár infót rólam, az életemről, meg néhány érdekes dolgot is, csak épp fejlesszem ki. addig is türelem kispajtás :)

2008/05/20

hatodik

> f:=x->x*cos(x);

f := proc (x) options operator, arrow; x*cos(x) end proc

> z:=interp([0,2*Pi/3,4*Pi/3,2*Pi],[f(0),f(2*Pi/3),f(4*Pi/3),f(2*Pi)],x);

z := 27*x^3/(16*Pi^2)-27*x^2/(8*Pi)+x

> evalf(z);

.1709794973*x^3-1.074295866*x^2+x

> plot(f);

[Plot]

> with(plots);

Warning, the name changecoords has been redefined

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, cylinderplot, densityplot, display, disp...

> gr1:=plot(f(x),x=0..2*Pi,color=red):

> gr2:=plot(z,x=0..2*Pi,color=green):

> display(gr1,gr2);

[Plot]

> lagrange:=proc(x,y,a)
local n,v,i,j,t;

v:=0;

n:=nops(x);

for i from 0 to n-1 do

t:=y[i+1];

for j from 0 by 1 to i-1 do

t:=t*(a-x[j+1])/(x[i+1]-x[j+1]);

end do;

for j from i+1 to n-1 do

t:=t*(a-x[j+1])/(x[i+1]-x[j+1]);

end do;

v:=v+t;

end do;

end proc;

>

lagrange := proc (x, y, a) local n, v, i, j, t; v := 0; n := nops(x); for i from 0 to n-1 do t := y[i+1]; for j from 0 to i-1 do t := t*(a-x[j+1])/(x[i+1]-x[j+1]) end do; for j from i+1 to n-1 do t :=...lagrange := proc (x, y, a) local n, v, i, j, t; v := 0; n := nops(x); for i from 0 to n-1 do t := y[i+1]; for j from 0 to i-1 do t := t*(a-x[j+1])/(x[i+1]-x[j+1]) end do; for j from i+1 to n-1 do t :=...lagrange := proc (x, y, a) local n, v, i, j, t; v := 0; n := nops(x); for i from 0 to n-1 do t := y[i+1]; for j from 0 to i-1 do t := t*(a-x[j+1])/(x[i+1]-x[j+1]) end do; for j from i+1 to n-1 do t :=...lagrange := proc (x, y, a) local n, v, i, j, t; v := 0; n := nops(x); for i from 0 to n-1 do t := y[i+1]; for j from 0 to i-1 do t := t*(a-x[j+1])/(x[i+1]-x[j+1]) end do; for j from i+1 to n-1 do t :=...lagrange := proc (x, y, a) local n, v, i, j, t; v := 0; n := nops(x); for i from 0 to n-1 do t := y[i+1]; for j from 0 to i-1 do t := t*(a-x[j+1])/(x[i+1]-x[j+1]) end do; for j from i+1 to n-1 do t :=...lagrange := proc (x, y, a) local n, v, i, j, t; v := 0; n := nops(x); for i from 0 to n-1 do t := y[i+1]; for j from 0 to i-1 do t := t*(a-x[j+1])/(x[i+1]-x[j+1]) end do; for j from i+1 to n-1 do t :=...

> expand(lagrange([0,2*Pi/3,4*Pi/3,2*Pi],[f(0),f(2*Pi/3),f(4*Pi/3),f(2*Pi)],x));

27*x^3/(16*Pi^2)-27*x^2/(8*Pi)+x

> t:=(b+a)/2-(b-a)/2*cos(2*k-1)*Pi/(2*n);

t := b/2+a/2-1/4*(b-a)*cos(2*k-1)*Pi/n

> f2:=x->sin(x)+cos(x);

f2 := proc (x) options operator, arrow; sin(x)+cos(x) end proc

> t1:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*1-1)*Pi/(2*4));

t1 := Pi-Pi*cos(Pi/8)

> t2:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*2-1)*Pi/(2*4));

t2 := Pi-Pi*cos(3*Pi/8)

> t3:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*3-1)*Pi/(2*4));

t3 := Pi+Pi*cos(3*Pi/8)

> t4:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*4-1)*Pi/(2*4));

t4 := Pi+Pi*cos(Pi/8)

> c:=evalf(interp([t1,t2,t3,t4],[f(t1),f(t2),f(t3),f(t4)],x));

c := 1.247370174*x+.1908355625*x^3-1.199055202*x^2+0.16e-7

> gr1:=plot(f(x),x=0..2*Pi,color=red):

> gr2:=plot(z,x=0..2*Pi,color=green):

> gr3:=plot(c,x=0..2*Pi,color=blue):

> display(gr1,gr2,gr3);

[Plot]

> with(numapprox);

[chebdeg, chebmult, chebpade, chebsort, chebyshev, confracform, hermite_pade, hornerform, infnorm, laurent, minimax, pade, remez]

> plot(ChebyshevT(5,x),x=-1..1);

[Plot]

>