Harmonic Oscillator Example

> A := matrix( [ [ 0, 1 ], [ -1/2, -3/2 ] ] );

[Maple Math]

>

> charpoly( A, lambda );

[Maple Math]

> eigenvals( A );

[Maple Math]

With two negative eigenvalues, the origin is a sink for this system.

>

> eigenvects( A );

[Maple Math]

>

The straight-line solutions are:

> Y1 := exp(-t) * matrix( 2, 1, [ -1, 1 ] );

[Maple Math]

> Y2 := exp(-t/2) * matrix( 2, 1, [ -2, 1 ] );

[Maple Math]

>

> ode1 := diff( y(t), t ) = v(t);

> ode2 := diff( v(t), t ) = -1/2*y(t) - 3/2*v(t);

> MODEL := { ode1, ode2 }:

[Maple Math]

[Maple Math]

> VARS := { y(t), v(t) }:

> DOMAIN := t=0..10:

> RANGE := y=-2..2, v=-2..2:

> dirPLOT := DEplot( MODEL, VARS, DOMAIN, RANGE, arrows=MEDIUM ):

> dirPLOT;

>

> IC := [ [ y(0)=0, v(0)=-2 ] ]:

> solPLOT := DEplot( MODEL, VARS, DOMAIN, RANGE, IC, arrows=NONE, stepsize=0.1, linecolor=GREEN ):

> #solPLOT;

>

> ICline := [ [ y(0)=-2, v(0)=2 ], [ y(0)=2, v(0)=-2 ],
[ y(0)=-2, v(0)=1 ], [ y(0)=2, v(0)=-1 ] ]:

> linePLOT := DEplot( MODEL, VARS, DOMAIN, RANGE, ICline, arrows=NONE, linecolor=BLUE ):

> #linePLOT;

>

> display( [ dirPLOT, solPLOT, linePLOT ], title=`Harmonic Oscillator (#16, p. 276)` );

Notice how the solution initially moves (essentially) parallel to the eigenvector for the smaller eigenvalue and then bends until it becomes tangent to the eigenvector for the larger eigenvalue as the solution approaches the equilibrium solution. (Recall that the uniqueness theorem guarantees that the solution cannot cross the straight-line solution.)

>

> yPLOT := DEplot( MODEL, VARS, DOMAIN, RANGE, IC, scene=[t,y], arrows=NONE, stepsize=0.1, linecolor=BLUE ):

> vPLOT := DEplot( MODEL, VARS, DOMAIN, RANGE, IC, scene=[t,v], arrows=NONE, stepsize=0.1, linecolor=GREEN ):

> display( [ yPLOT, vPLOT ], title=`Displacement and Velocity for Harmonic Oscillator (#16, p. 276)` );

>

>