hatodik
| > | f:=x->x*cos(x); |
| > | 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); |
| > | evalf(z); |
| > | plot(f); |
| > | with(plots); |
Warning, the name changecoords has been redefined
| > | gr1:=plot(f(x),x=0..2*Pi,color=red): |
| > | gr2:=plot(z,x=0..2*Pi,color=green): |
| > | display(gr1,gr2); |
| > | 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; |
| > |
| > | 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)); |
| > | t:=(b+a)/2-(b-a)/2*cos(2*k-1)*Pi/(2*n); |
| > | f2:=x->sin(x)+cos(x); |
| > | t1:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*1-1)*Pi/(2*4)); |
| > | t2:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*2-1)*Pi/(2*4)); |
| > | t3:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*3-1)*Pi/(2*4)); |
| > | t4:=(2*Pi+0)/2-(2*Pi-0)/2*cos((2*4-1)*Pi/(2*4)); |
| > | c:=evalf(interp([t1,t2,t3,t4],[f(t1),f(t2),f(t3),f(t4)],x)); |
| > | 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); |
| > | with(numapprox); |
| > | plot(ChebyshevT(5,x),x=-1..1); |
| > |
![[Plot]](file:///C:/Documents%20and%20Settings/A%20mester/Desktop/images/hatodik_4.gif)
![[Plot]](file:///C:/Documents%20and%20Settings/A%20mester/Desktop/images/hatodik_8.gif)
![[Plot]](file:///C:/Documents%20and%20Settings/A%20mester/Desktop/images/hatodik_23.gif)
![[Plot]](file:///C:/Documents%20and%20Settings/A%20mester/Desktop/images/hatodik_25.gif)

0 Comments:
Megjegyzés küldése
<< Home