Á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

nyolcadik

> with(CurveFitting);

>

[BSpline, BSplineCurve, Interactive, LeastSquares, PolynomialInterpolation, RationalInterpolation, Spline, ThieleInterpolation]

> expand(PolynomialInterpolation([0,1,2,3],[1,3,-1,2],x,form=Lagrange));

>

>

13/6*x^3-19/2*x^2+28/3*x+1

> lag:=expand(PolynomialInterpolation([0,1,2,3],[1,3,-1,2],x,form=Newton));

>

lag := 13/6*x^3-19/2*x^2+28/3*x+1

> pointplot({[0,1],[1,3],[2,-1],[3,2]},symbolsize=25);

[Plot]

> display(pointplot({[0,1],[1,3],[2,-1],[3,2]},symbolsize=25),plot(lag,x=-1..4,y=-5..5));

[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...

> xi:=[0,1,3,4.2,5,5.8,7,8];

>

xi := [0, 1, 3, 4.2, 5, 5.8, 7, 8]

> yi:=[1,2.5,2.3,5,3.5,4.2,7,10];

yi := [1, 2.5, 2.3, 5, 3.5, 4.2, 7, 10]

> sp1:=Spline(xi,yi,x);

sp1 := PIECEWISE([1.+2.04045418599999984*x-.540454185700000034*x^3, x < 1], [2.080908371+.419091629299999990*x-1.62136255679615826*(x-1)^2+.680908371300000037*(x-1)^3, x < 3], [-4.013625568+2.10454185...

> display(pointplot({[0,1],[1,2.5],[3,2.3],[4.2,5],[5,3.5],[5.8,4.2],[7,7],[8,10]},symbolsize=25),plot(sp1,x,y=-1..12,color=green),plot(lag1,y=-5..12,x=-4..4,color=blue));

[Plot]

> lag1:=expand(PolynomialInterpolation(xi,yi,x,form=Lagrange));

lag1 := 47.66577892*x+59.68279433*x^3-89.75801475*x^2-.2626950677*x^6-18.98393180*x^4+3.147340024*x^5+0.8728350885e-2*x^7+1.000000000

> f:=x->(cos(Pi*x))^3-4*x;

f := proc (x) options operator, arrow; cos(Pi*x)^3-4*x end proc

> xx:=[-1,-1/2,0,1/2,1];

xx := [-1, (-1)/2, 0, 1/2, 1]

> g:=x->A*x^3+B*x^2+C*x+D;

g := proc (x) options operator, arrow; A*x^3+B*x^2+C*x+D end proc

> y1:=map(f,xx);

y1 := [3, 2, 1, -2, -5]

> osszeg:=(A,B,C,D)->sum((y1[i]-(g(xx[i])))^2,i=1..5);

osszeg := proc (A, B, C, D) options operator, arrow; sum((y1[i]-g(xx[i]))^2, i = 1 .. 5) end proc

> DA:=diff(osszeg(A,B,C,D),A);

DA := 17+65*A/16+17*C/4

> DB:=diff(osszeg(A,B,C,D),B);

DB := 4+17*B/4+5*D

> DC:=diff(osszeg(A,B,C,D),C);

DC := 20+17*A/4+5*C

> DD:=diff(osszeg(A,B,C,D),D);

DD := 2+5*B+10*D

> eqA:=DA=0;

>

eqA := 17+65*A/16+17*C/4 = 0

> eqB:=DB=0;

eqB := 4+17*B/4+5*D = 0

> eqC:=DC=0;

eqC := 20+17*A/4+5*C = 0

> eqD:=DD=0;

eqD := 2+5*B+10*D = 0

>

> megold:=solve({eqA,eqB,eqC,eqD},{A,B,C,D});

megold := {C = -4, A = 0, D = 23/35, B = (-12)/7}

> polinom:=subs(megold,g(x));

polinom := 23/35-12/7*x^2-4*x

> LeastSquares(xx,y1,x,curve=A*x^3+B*x^2+C*x+D);

23/35-12/7*x^2-4*x

> with(stats);

[anova, describe, fit, importdata, random, statevalf, statplots, transform]

> with(statplots);

[boxplot, histogram, scatterplot, xscale, xshift, xyexchange, xzexchange, yscale, yshift, yzexchange, zscale, zshift]

> scatterplot(xx,y1,symbolsize=25);

[Plot]

> c:=scatterplot(xx,y1,symbolsize=25):

> display(c,plot(polinom,x=-1..1));

[Plot]

>