Harj. 3 AV ratkaisuja

V3 Ti 3.10. 2000

Teht. 1

> restart:yht:=diff(x(t),t,t)+w0^2*x(t)=0;

Warning, the name changecoords has been redefined

yht := diff(x(t),`$`(t,2))+w0^2*x(t) = 0

> x:=A*cos(w0*t)+B*sin(w0*t);

x := A*cos(w0*t)+B*sin(w0*t)

> vasen:=simplify(diff(x,t,t)+w0^2*x);

vasen := 0

> AEyht:={eval(subs(t=0,x)=x0),eval(subs(t=0,diff(x,t))=v0)};

AEyht := {A = x0, B*w0 = v0}

> solve(AEyht,{A,B});

{A = x0, B = v0/w0}

> assign(%): x;

x0*cos(w0*t)+v0*sin(w0*t)/w0

> A:='A':B:='B':xx:=C*cos(w0*t-delta);

xx := C*cos(w0*t-delta)

> yht:=x=expand(xx);

yht := A*cos(w0*t)+B*sin(w0*t) = C*cos(w0*t)*cos(de...

> coeff(lhs(yht),cos(w0*t))=coeff(rhs(yht),cos(w0*t));
coeff(lhs(yht),sin(w0*t))=coeff(rhs(yht),sin(w0*t));

A = C*cos(delta)

B = C*sin(delta)

Teht. 2, jätetään käsinlaskun varaan

Teht. 3, käsinlasku vain

Teht. 4

> restart: dyht:=diff(x(t),t,t)+4*diff(x(t),t)+13*x(t)=cos(t);

Warning, the name changecoords has been redefined

dyht := diff(x(t),`$`(t,2))+4*diff(x(t),t)+13*x(t) ...

Homogeeniyhtälö (HY) :

> karyht:=lambda^2+4*lambda+13=0: Lambda:=solve(karyht,lambda);

Lambda := -2+3*I, -2-3*I

> alpha:=Re(Lambda[1]): w1:=abs(Im(Lambda[1])):

> xh:=exp(alpha*t)*(A*cos(w1*t)+B*sin(w1*t));

xh := exp(-2*t)*(A*cos(3*t)+B*sin(3*t))

Tarkistus:

> eval(subs(x(t)=xh,lhs(dyht))): simplify(%);

0

HY voitaisiin ratkaista myös suoraan dsolve -komennolla:

> dsolve(lhs(dyht)=0,x(t)): collect(%,exp(-2*t));

x(t) = (_C1*sin(3*t)+_C2*cos(3*t))*exp(-2*t)

EHY:n erityisratkaisu xp:

Yrite:

> xp:=a*cos(t)+b*sin(t); dxp:=diff(xp,t); d2xp:=diff(dxp,t);

xp := a*cos(t)+b*sin(t)

dxp := -a*sin(t)+b*cos(t)

d2xp := -a*cos(t)-b*sin(t)

> yhtalo:=d2xp+4*dxp+13*xp=cos(t);

yhtalo := 12*a*cos(t)+12*b*sin(t)-4*a*sin(t)+4*b*co...

> coeff(lhs(yhtalo),cos(t))=coeff(rhs(yhtalo),cos(t)),coeff(lhs(yhtalo),sin(t))=coeff(rhs(yhtalo),sin(t));

12*a+4*b = 1, 12*b-4*a = 0

> solve({%},{a,b});

{b = 1/40, a = 3/40}

> assign(%);

> xp;

3/40*cos(t)+1/40*sin(t)

> x:=xh+xp;

x := exp(-2*t)*(A*cos(3*t)+B*sin(3*t))+3/40*cos(t)+...

AE:t

> eval(subs(t=0,x))=0,eval(subs(t=0,diff(x,t)))=1;

A+3/40 = 0, -2*A+3*B+1/40 = 1

> solve({%},{A,B});

{B = 11/40, A = -3/40}

> assign(%);

> x;

exp(-2*t)*(-3/40*cos(3*t)+11/40*sin(3*t))+3/40*cos(...

> plot(x,t=0..4*Pi);

[Maple Plot]

> plot([xh,xp],t=0..4*Pi);

[Maple Plot]

> plot(xh,t=2..2*Pi);

[Maple Plot]

Lopuksi annetaan Maplen näyttää osaamisensa:

> x:='x': dsolve({dyht,x(0)=0,D(x)(0)=1},x(t)); combine(%);

x(t) = 1/40*sin(t)+3/40*cos(t)+11/40*exp(-2*t)*sin(...

x(t) = 1/40*sin(t)+3/40*cos(t)+11/40*exp(-2*t)*sin(...

> collect(%,exp(-2*t));

x(t) = (11/40*sin(3*t)-3/40*cos(3*t))*exp(-2*t)+1/4...

Tässä piti vähän kokeilla eri sievennyskomentoja, combine teki hyvää jälkeä.

Teht. 5

> restart:m*diff(x(t),t,t)+k*x(t)=F0*cos(w*t);

Warning, the name changecoords has been redefined

m*diff(x(t),`$`(t,2))+k*x(t) = F0*cos(w*t)

Jaetaan m:llä ==>

> diff(x(t),t,t)+(k/m)*x(t)=(F0*cos(w*t))/m:algsubs(k/m=w^2,%);

diff(x(t),`$`(t,2))+x(t)*w^2 = F0*cos(w*t)/m

Tämä oli vain yhtälön muokkausta ja "tekstinkäsittelyä".

> xp:=t*(a*cos(w*t)+b*sin(w*t));
dyht:=diff(xp,t,t)+w^2*xp=F0*cos(w*t)/m:dyht:=combine(%);

xp := t*(a*cos(w*t)+b*sin(w*t))

dyht := -2*a*sin(w*t)*w+2*b*cos(w*t)*w = F0*cos(w*t...

> {map(coeff,%,cos(w*t)),map(coeff,%,sin(w*t))};

{2*b*w = F0/m, -2*a*w = 0}

> solve(%,{a,b});assign(%):xp;

{a = 0, b = 1/2*F0/(w*m)}

1/2*t*F0*sin(w*t)/(w*m)

> F0:=1:w:=2:m:=1:plot(xp,t=0..40,title="Resonanssivaste");plot([F0*cos(w*t),xp],t=0..40,title="Punainen heräte ja sininen vaste",color=[red,blue]);

[Maple Plot]

[Maple Plot]

>