Harj. 8 AV

5.11.02, päivitetty 4.11.02

Lisänä käsinkirjoitettuja prujuja Astridin huoneen ovenpielessä.

Alustukset

>    with(LinearAlgebra):

1.

>    v1:=<-3,1>; v2:=<-1,1>;

v1 := Vector(%id = 138663384)

v2 := Vector(%id = 138781384)

>    lambda[1]:=4: lambda[2]:=2;

lambda[2] := 2

>    Y:=t->C1*exp(4*t)*v1+C2*exp(2*t)*v2;

Y := proc (t) options operator, arrow; C1*exp(4*t)*v1+C2*exp(2*t)*v2 end proc

>    Y(0);

C1*Vector(%id = 138663384)+C2*Vector(%id = 138781384)

>    A0:=<v1|v2>;

A0 := Matrix(%id = 136604060)

>    Ceet:=LinearSolve(A0,<-1,6>);

Ceet := Vector(%id = 138912808)

>    Yaa:=subs(C1=Ceet[1],C2=Ceet[2],Y(t));

Yaa := -5/2*exp(4*t)*Vector(%id = 138663384)+17/2*exp(2*t)*Vector(%id = 138781384)

>    y1y2:=evalm(Yaa); # koordinaattimuodossa

y1y2 := vector([15/2*exp(4*t)-17/2*exp(2*t), -5/2*exp(4*t)+17/2*exp(2*t)])

Kuvia ei vaadittu, mutta piirretän tässä. Huomaa parametripiirron syntaksi. (Kts. L12maple ja myös [HAM]-kirja)

>    plot([y1y2[1],y1y2[2],t=0..2]);

[Maple Plot]

Tästä kuvasta ei paljon näy. view -optio on välttämätön:

>    plot([y1y2[1],y1y2[2],t=0..2],view=[-1..10,-10..10]);

[Maple Plot]

>    plot([y1y2[1],y1y2[2],t=0..2],view=[10..200,-40..10]);

[Maple Plot]

>   

2.

>    restart: with(LinearAlgebra):

Warning, the name changecoords has been redefined

>    dyht:=diff(y(t),t,t)+0.125*diff(y(t),t)+y(t)=0;

dyht := diff(y(t),`$`(t,2))+.125*diff(y(t),t)+y(t) = 0

Merkitään y[1]  = y, y[2]  = y' , jolloin saadaan yhtälösysteemi:

                y[1]  ' = y[2]

                y[2] ' = -y[1]-.125*y[2]  

>    A:=<<0,-1>|<1,-.125>>; A:=convert(A,rational);

A := Matrix(%id = 137589236)

A := Matrix(%id = 135388048)

>    (Lambda,ov):=Eigenvectors(A);

Lambda, ov := Vector(%id = 135916640), Matrix(%id = 137690356)

>    v1:=ov[1..-1,1]: v2:=ov[1..-1,2]:

>    y:=C1*exp(Lambda[1]*t)*v1+C2*exp(Lambda[2]*t)*v2;

y := C1*exp((-1/16+1/16*I*255^(1/2))*t)*Vector(%id = 135987452)+C2*exp((-1/16-1/16*I*255^(1/2))*t)*Vector(%id = 137592360)

Tässä on kompleksimuoto. Reaaliseen kantaan pääsemiseksi voidaan tehdä vanhat temput:

>    lambda:=Lambda[1]; w:=ov[1..-1,1];

lambda := -1/16+1/16*I*255^(1/2)

w := Vector(%id = 137779344)

>    u:=map(Re,w); v:=map(Im,w);

u := Vector(%id = 136055724)

v := Vector(%id = 137618748)

Kaavan johto lienee helpompi tehdä käsin kuin Maplella. Tässä on senverran hankalat lukuarvot, että on parempi johtaa yleisillä symboleilla:

>    alpha:='alpha': beta:='beta':

>    lambda:=alpha+I*beta;

lambda := alpha+beta*I

>    u:='u': v:='v':

>    yr:=Re(exp(lambda*t)*(u+I*v)); yr:=evalc(%);

yr := Re(exp((alpha+beta*I)*t)*(u+v*I))

yr := exp(t*alpha)*cos(t*beta)*u-exp(t*alpha)*sin(t*beta)*v

>    yi:=Im(exp(lambda*t)*(u+I*v)); yi:=evalc(%);
             

yi := Im(exp((alpha+beta*I)*t)*(u+v*I))

yi := exp(t*alpha)*sin(t*beta)*u+exp(t*alpha)*cos(t*beta)*v

Perun heti puheeni. Kun sievennykset tehdään yleisillä symboleilla, menemättä vektorien komponentteihin, kaikki sujuu kuin rasvattu.

>    u:=map(Re,w); v:=map(Im,w);lambda:=Lambda[1]: alpha:=Re(lambda); beta:=Im(lambda);

u := Vector(%id = 136981192)

v := Vector(%id = 134871396)

alpha := -1/16

beta := 1/16*255^(1/2)

>    yr;

exp(-1/16*t)*cos(1/16*t*255^(1/2))*Vector(%id = 136981192)-exp(-1/16*t)*sin(1/16*t*255^(1/2))*Vector(%id = 134871396)

>    yi;

exp(-1/16*t)*sin(1/16*t*255^(1/2))*Vector(%id = 136981192)+exp(-1/16*t)*cos(1/16*t*255^(1/2))*Vector(%id = 134871396)

>    y:=C1*yr+C2*yi;

y := C1*(exp(-1/16*t)*cos(1/16*t*255^(1/2))*Vector(%id = 136981192)-exp(-1/16*t)*sin(1/16*t*255^(1/2))*Vector(%id = 134871396))+C2*(exp(-1/16*t)*sin(1/16*t*255^(1/2))*Vector(%id = 136981192)+exp(-1/16*...
y := C1*(exp(-1/16*t)*cos(1/16*t*255^(1/2))*Vector(%id = 136981192)-exp(-1/16*t)*sin(1/16*t*255^(1/2))*Vector(%id = 134871396))+C2*(exp(-1/16*t)*sin(1/16*t*255^(1/2))*Vector(%id = 136981192)+exp(-1/16*...

>    y:=evalm(y);

y := vector([C1*exp(-1/16*t)*cos(1/16*t*255^(1/2))+C2*exp(-1/16*t)*sin(1/16*t*255^(1/2)), C1*(-1/16*exp(-1/16*t)*cos(1/16*t*255^(1/2))-1/16*exp(-1/16*t)*sin(1/16*t*255^(1/2))*255^(1/2))+C2*(-1/16*exp(-...
y := vector([C1*exp(-1/16*t)*cos(1/16*t*255^(1/2))+C2*exp(-1/16*t)*sin(1/16*t*255^(1/2)), C1*(-1/16*exp(-1/16*t)*cos(1/16*t*255^(1/2))-1/16*exp(-1/16*t)*sin(1/16*t*255^(1/2))*255^(1/2))+C2*(-1/16*exp(-...

>    y:=map(simplify,y);

y := vector([exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C2*sin(1/16*t*255^(1/2))), -1/16*exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C1*sin(1/16*t*255^(1/2))*255^(1/2)+C2*sin(1/16*t*255^(1/2))-C2*cos(1/16*t*255...
y := vector([exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C2*sin(1/16*t*255^(1/2))), -1/16*exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C1*sin(1/16*t*255^(1/2))*255^(1/2)+C2*sin(1/16*t*255^(1/2))-C2*cos(1/16*t*255...

>    y1:=y[1];

y1 := exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C2*sin(1/16*t*255^(1/2)))

>    y2:=y[2];

y2 := -1/16*exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C1*sin(1/16*t*255^(1/2))*255^(1/2)+C2*sin(1/16*t*255^(1/2))-C2*cos(1/16*t*255^(1/2))*255^(1/2))

>    #dyht:=diff(y(t),t,t)+0.125*diff(y(t),t)+y(t)=0;

>    diff(y1,t,t)+0.125*diff(y1,t)+y1;

.9960937500*exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C2*sin(1/16*t*255^(1/2)))+exp(-1/16*t)*(-255/256*C1*cos(1/16*t*255^(1/2))-255/256*C2*sin(1/16*t*255^(1/2)))

>    simplify(%);

0.

>    diff(y1,t), y2;

-1/16*exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C2*sin(1/16*t*255^(1/2)))+exp(-1/16*t)*(-1/16*C1*sin(1/16*t*255^(1/2))*255^(1/2)+1/16*C2*cos(1/16*t*255^(1/2))*255^(1/2)), -1/16*exp(-1/16*t)*(C1*cos(1/16*t...
-1/16*exp(-1/16*t)*(C1*cos(1/16*t*255^(1/2))+C2*sin(1/16*t*255^(1/2)))+exp(-1/16*t)*(-1/16*C1*sin(1/16*t*255^(1/2))*255^(1/2)+1/16*C2*cos(1/16*t*255^(1/2))*255^(1/2)), -1/16*exp(-1/16*t)*(C1*cos(1/16*t...

>    diff(y1,t)- y2: simplify(%);

0

Nuo kaksi nollaa kertovat kaiken. Systeemin ratkaisun 1. komponenttifunktio y1 toteuttaa dyht:n. Toinen komponentti on ensimmöisen derivaatta.

Ehkä hiukan huonosti harkittu käsinlaskuksi.

3.

>    A:=<<-2/25,2/25>|<1/50,-2/25>>;

A := Matrix(%id = 137592048)

>    (lambda,V):=Eigenvectors(A);

lambda, V := Vector(%id = 136839460), Matrix(%id = 135201732)

>    v1:=V[1..-1,1]: v2:=V[1..-1,2]:

>    y:=t->C1*exp(lambda[1]*t)*v1+C2*exp(lambda[2]*t)*v2;

y := proc (t) options operator, arrow; C1*exp(lambda[1]*t)*v1+C2*exp(lambda[2]*t)*v2 end proc

>    y(0)=<25,0>;

C1*Vector(%id = 137842300)+C2*Vector(%id = 137847044) = Vector(%id = 137451820)

>    A0:=<<1,-2> | <1,2>>;

A0 := Matrix(%id = 137950060)

>    Ceet:=LinearSolve(A0,<2.5,0>);

Ceet := Vector(%id = 135692620)

>    Y:=subs(C1=Ceet[1],C2=Ceet[2],y(t));

Y := 1.25000000000000000*exp(-3/25*t)*Vector(%id = 137842300)+1.25000000000000000*exp(-1/25*t)*Vector(%id = 137847044)

>    ykoord:=evalm(Y);

ykoord := vector([1.25000000000000000*exp(-3/25*t)+1.25000000000000000*exp(-1/25*t), -2.500000000*exp(-3/25*t)+2.500000000*exp(-1/25*t)])
ykoord := vector([1.25000000000000000*exp(-3/25*t)+1.25000000000000000*exp(-1/25*t), -2.500000000*exp(-3/25*t)+2.500000000*exp(-1/25*t)])

>    ykoord[1]=ykoord[2];

1.25000000000000000*exp(-3/25*t)+1.25000000000000000*exp(-1/25*t) = -2.500000000*exp(-3/25*t)+2.500000000*exp(-1/25*t)

>    tsama:=solve(%,t);

tsama := 13.73265361

>    plot([ykoord[1],ykoord[2]],t=0..30);

[Maple Plot]

>    evalf(tsama);

13.73265361

>   

4.

>    restart:

Warning, the name changecoords has been redefined

>    with(plots): with(LinearAlgebra): with(linalg):

Warning, the previous binding of the name GramSchmidt has been removed and it now has an assigned value

Warning, the protected names norm and trace have been redefined and unprotected

>    A:=<<2,-1>|<3,-2>>;

A := Matrix(%id = 135435108)

>    (lambda,V):=Eigenvectors(A);

lambda, V := Vector(%id = 135759520), Matrix(%id = 139461844)

>    v1:=V[1..-1,1]; v2:=V[1..-1,2];

v1 := Vector(%id = 135360308)

v2 := Vector(%id = 135918048)

>    y:=t->C1*exp(lambda[1]*t)*v1+C2*exp(lambda[2]*t)*v2;

y := proc (t) options operator, arrow; C1*exp(lambda[1]*t)*v1+C2*exp(lambda[2]*t)*v2 end proc

>    y(0);

C1*Vector(%id = 135360308)+C2*Vector(%id = 135918048)

>    A0:=<<-3,1>|<-1,1>>;

A0 := Matrix(%id = 136016400)

>    Ceet:=LinearSolve(A0,<3,2>);

Ceet := Vector(%id = 135988248)

>    yAA:=subs(C1=Ceet[1],C2=Ceet[2],y(t));

yAA := -5/2*exp(t)*Vector(%id = 135360308)+9/2*exp(-t)*Vector(%id = 135918048)

>    arrow([v1,v2],shape=arrow);

[Maple Plot]

Ominaisvektorin v1 suunnalla trajektori kulkee poispäin O:sta, v2:n suunnalla O:oon päin.

>    y(t);

C1*exp(t)*Vector(%id = 135360308)+C2*exp(-t)*Vector(%id = 135918048)

>    Ys:=map(eval,subs(t=log(s),y(t)));

Ys := C1*s*Vector(%id = 135360308)+C2/s*Vector(%id = 135918048)

Selvästi hyperbelejä.

>    YY:=evalm(Ys);

YY := vector([-3*C1*s-C2/s, C1*s+C2/s])

>    parvi:=seq(seq([YY[1],YY[2],s=0..4],C2=-2..2),C1=-2..2):

>    plot([parvi]);

[Maple Plot]

>    display(%,arrow([v1,v2]),view=[-5..5,-5..5]);

[Maple Plot]

>    kuva:=%:

>    y1:='y1':y2:='y2':

>    with(DEtools):

Warning, the name adjoint has been redefined

>    display(kuva,DEplot([D(y1)(t)=2*y1(t)+3*y2(t),D(y2)(t)=-y1(t)-2*y2(t)],
[y1(t),y2(t)],t=-5..2,y1=-5..5,y2=-5..5,color=grey),title="Satula");

[Maple Plot]

>   

5.

>    restart:

Warning, the name changecoords has been redefined

>    with(plots): with(LinearAlgebra): with(linalg):

Warning, the previous binding of the name GramSchmidt has been removed and it now has an assigned value

Warning, the protected names norm and trace have been redefined and unprotected

>    A:=<<7,3>|<-1,3>>;

A := Matrix(%id = 135168552)

>    (lambda,V):=Eigenvectors(A);

lambda, V := Vector(%id = 134814188), Matrix(%id = 138324280)

>    v1:=V[1..-1,1]; v2:=V[1..-1,2];

v1 := Vector(%id = 134829864)

v2 := Vector(%id = 134831912)

>    y:=t->C1*exp(lambda[1]*t)*v1+C2*exp(lambda[2]*t)*v2;

y := proc (t) options operator, arrow; C1*exp(lambda[1]*t)*v1+C2*exp(lambda[2]*t)*v2 end proc

>    y(0);

C1*Vector(%id = 134829864)+C2*Vector(%id = 134831912)

>    A0:=<<1,3>|<1,1>>;

A0 := Matrix(%id = 138331780)

>    Ceet:=LinearSolve(A0,<3,2>);

Ceet := Vector(%id = 134837528)

>    yAA:=subs(C1=Ceet[1],C2=Ceet[2],y(t));

yAA := -1/2*exp(6*t)*Vector(%id = 134829864)+7/2*exp(4*t)*Vector(%id = 134831912)

>    arrow([v1,v2],shape=arrow);

[Maple Plot]

Trajektorit  kulkevat  poispäin O:sta..

>    y(t);

C1*exp(6*t)*Vector(%id = 134829864)+C2*exp(4*t)*Vector(%id = 134831912)

>    Ys:=map(eval,subs(t=log(s),y(t)));

Ys := C1*s^6*Vector(%id = 134829864)+C2*s^4*Vector(%id = 134831912)

>    YY:=evalm(Ys);

YY := vector([C1*s^6+C2*s^4, C1*s^6+3*C2*s^4])

>    parvi:=seq(seq([YY[1],YY[2],s=0..4],C2=-2..2),C1=-2..2):

>    plot([parvi]);

[Maple Plot]

>    display(%,arrow([v1,v2]),view=[-5..5,-5..5]);

[Maple Plot]

>    kuva:=%:

>    y1:='y1':y2:='y2':

>    with(DEtools):

Warning, the name adjoint has been redefined

>    display(kuva,DEplot([D(y1)(t)=7*y1(t)-y2(t),D(y2)(t)=3*y1(t)+3*y2(t)],
[y1(t),y2(t)],t=-5..2,y1=-5..5,y2=-5..5,color=grey),title="Lähde");

[Maple Plot]

>   

>   

>