Harj. 4 AV

8.20.02  HA

1.

>    with(plots):

>    Lka:=y->seq((y[k-1]+y[k]+y[k+1])/3,k=2..nops(y)-1);

Lka := proc (y) options operator, arrow; seq(1/3*y[k-1]+1/3*y[k]+1/3*y[k+1],k = 2 .. nops(y)-1) end proc

>    y:=[9,5,7,3,2,4,6,5,7,6,8,10,9,5,7];

y := [9, 5, 7, 3, 2, 4, 6, 5, 7, 6, 8, 10, 9, 5, 7]

>    z:=[Lka(y)];

z := [7, 5, 4, 3, 4, 5, 6, 6, 7, 8, 9, 8, 7]

>   

>    ykuva:=plot([seq([k,y[k]],k=1..nops(y))],color=blue):

>    yrinkulat:=plot([seq([k,y[k]],k=1..nops(y))],style=point,symbol=circle,symbolsize=18,color=blue):

>    zkuva:=plot([seq([k+1,z[k]],k=1..nops(z))],color=red):

>    zrinkulat:=plot([seq([k+1,z[k]],k=1..nops(z))],style=point,symbol=circle,symbolsize=15,color=red):

>    display(ykuva,yrinkulat,zkuva,zrinkulat);

[Maple Plot]

>    display(array([[ykuva],[zkuva]]));

[Maple Plot]

>   

2.

>    r^2-a*(1+b)*r+a*b=0;

r^2-a*(1+b)*r+a*b = 0

>    solve(%,r);

1/2*a+1/2*a*b+1/2*(a^2+2*a^2*b+a^2*b^2-4*a*b)^(1/2), 1/2*a+1/2*a*b-1/2*(a^2+2*a^2*b+a^2*b^2-4*a*b)^(1/2)

>    subs(a=0.9,b=4/9,[%]);

[.8000000000, .5000000000]

>   

3.

>    restart:

Warning, the name changecoords has been redefined

>    with(LinearAlgebra):

>    P:=<<.95,.05>|<.45,.55>>;

P := Matrix(%id = 136544396)

>    ma:=<.8,.2>;

ma := Vector(%id = 136534596)

>    ti:=P.ma;

ti := Vector(%id = 136689648)

>    ke:=P.ti;

ke := Vector(%id = 136379688)

>    P.P.<1,0>;

Vector(%id = 136847944)

>   

4.

5.

>    restart:

Warning, the name changecoords has been redefined

>    with(LinearAlgebra):alias(Id=IdentityMatrix):

>    alias(rref=ReducedRowEchelonForm):alias(ref=GaussianElimination):

>    <<Demokraateilta>|<Republikaaneilta>|<Liberaaleilta>>;

>     P:=<<.7,.2,.1>|<.1,.8,.1>|<.3,.3,.4>>;

Matrix(%id = 138525132)

P := Matrix(%id = 134635216)

>     X[0]:=<.55,.40,.05>;
 for j from 0 to 10 do X[j+1]:=P.X[j]: end do:
 seq(X[j],j=7..10);

X[0] := Vector(%id = 134651332)

Vector(%id = 135184772), Vector(%id = 135293972), Vector(%id = 135257180), Vector(%id = 135284048)

>    P-Id(3);

Matrix(%id = 137362232)

>    REF:=ref(%);

REF := Matrix(%id = 135636208)

>    rref(%%);

Matrix(%id = 138532288)

Huom! rref meni väärin . Rutiini tulkitsi alkion [3,3] nollasta poikkeavaksi ja jatkoi kylmästi pivotointia. Selvästi kyseessä on pyöristysvirheistä

aiheutuva "jäte", joka pitää tulkita nollaksi.

>    REF[3,3]:=0: REF;

Matrix(%id = 135636208)

>    rref(REF);

Matrix(%id = 135504572)

>    x3:=t: x2:=3.75*x3: x1:=2.25*x3: T:=solve(x1+x2+x3=1,t);

T := .1428571429

>    X:=subs(t=T,<x1,x2,x3>);

X := Vector(%id = 135669136)

>   

6.

>   

>