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
> x:=A*cos(w0*t)+B*sin(w0*t);
> vasen:=simplify(diff(x,t,t)+w0^2*x);
> AEyht:={eval(subs(t=0,x)=x0),eval(subs(t=0,diff(x,t))=v0)};
> solve(AEyht,{A,B});
> assign(%): x;
> A:='A':B:='B':xx:=C*cos(w0*t-delta);
> yht:=x=expand(xx);
>
coeff(lhs(yht),cos(w0*t))=coeff(rhs(yht),cos(w0*t));
coeff(lhs(yht),sin(w0*t))=coeff(rhs(yht),sin(w0*t));
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
Homogeeniyhtälö (HY) :
> karyht:=lambda^2+4*lambda+13=0: Lambda:=solve(karyht,lambda);
> alpha:=Re(Lambda[1]): w1:=abs(Im(Lambda[1])):
> xh:=exp(alpha*t)*(A*cos(w1*t)+B*sin(w1*t));
Tarkistus:
> eval(subs(x(t)=xh,lhs(dyht))): simplify(%);
HY voitaisiin ratkaista myös suoraan dsolve -komennolla:
> dsolve(lhs(dyht)=0,x(t)): collect(%,exp(-2*t));
EHY:n erityisratkaisu xp:
Yrite:
> xp:=a*cos(t)+b*sin(t); dxp:=diff(xp,t); d2xp:=diff(dxp,t);
> yhtalo:=d2xp+4*dxp+13*xp=cos(t);
> coeff(lhs(yhtalo),cos(t))=coeff(rhs(yhtalo),cos(t)),coeff(lhs(yhtalo),sin(t))=coeff(rhs(yhtalo),sin(t));
> solve({%},{a,b});
> assign(%);
> xp;
> x:=xh+xp;
AE:t
> eval(subs(t=0,x))=0,eval(subs(t=0,diff(x,t)))=1;
> solve({%},{A,B});
> assign(%);
> x;
> plot(x,t=0..4*Pi);
> plot([xh,xp],t=0..4*Pi);
> plot(xh,t=2..2*Pi);
Lopuksi annetaan Maplen näyttää osaamisensa:
> x:='x': dsolve({dyht,x(0)=0,D(x)(0)=1},x(t)); combine(%);
> collect(%,exp(-2*t));
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
Jaetaan m:llä ==>
> diff(x(t),t,t)+(k/m)*x(t)=(F0*cos(w*t))/m:algsubs(k/m=w^2,%);
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(%);
> {map(coeff,%,cos(w*t)),map(coeff,%,sin(w*t))};
> solve(%,{a,b});assign(%):xp;
> 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]);
>