Question: varying initial conditions

PLEASE HELP ME. I NEED HELP REALLY BAD.

Restrict calculation to real numbers.

Using y' = u, express the oscillator equation: y" + 3y' + 2y = cos(t) as a first order system. 

Plot an approximate solution curve for the specified initial conditions.

[x0=5, y0=1],[x0=-2, y0=-4],[x0=0, y0=.1],

This is what i have so far but i am not sure if its correct.

Eulers modified method: 

with(RealDomain);

x[0] := 0;

y[0] := 5;

t[0]=0

h := .1;

for n to 100 do

x[n] := x[n-1]+h*(x[n-1]+y[n-1]);

k1 := x[n-1]+y[n-1];

k2 := h*k1+x[n]+y[n-1];

k := 1/2*(k1+k2);

y[n] := h*k+y[n-1]

end do;


data := [seq([x[n], y[n]], n = 0 .. 100)];
G1 := plot(data, style = point, color = "blue");
G1;

Please Wait...