> restart;

> with( DEtools ):

> with( plots ):

>

> VAR := { y(t) }:

> MODEL := diff( y(t), t$2 ) + 2 * y(t) = 3*sin( omega*t );

[Maple Math]

> IC := y(0)=1, D(y)(0)=0;

[Maple Math]

>

> dsolve( { MODEL, IC }, VAR );

[Maple Math]
[Maple Math]

> combine( rhs(%) );

[Maple Math]

> SOLN := collect( %, { cos( sqrt(2)*t ), sin( sqrt(2)*t) } );

[Maple Math]

Note that this solution contains two terms which appear in the homogeneous solution and one term that is a particular solution to the nonhomogeneous equation.

>

> Omega := [ 0, 0.2, 0.4, 0.6, 0.8, 1.0, 1.1, 1.2, 1.3, 1.4 ]:

> P := seq( plot( subs( omega=w, SOLN ), t=0..50 ), w=Omega ):

> display( P, insequence=true );

>

> dsolve( subs( omega=sqrt(2), { MODEL, IC } ), VAR );

[Maple Math]

> simplify( % );

[Maple Math]

>