program oct1016 real x(2),t,dt,tfinish,xe,f1,f2 integer i,steps x(1)=1 x(2)=-1 dt = 0.02 tfinish=20 steps=tfinish/dt open(unit=13,file="data2.d") do 10 i=1,steps xe=51.0/47.0*cos(sqrt(3.0/2.0)*t)-sqrt(2.0/3.0)* c sin(sqrt(3.0/2.0)*t)-4.0/47.0*cos(5.0*t) write(13,*) t,x(1),x(2),xe f1=x(2) f2=0.5*(4.0*cos(5.0*t)-3.0*x(1)) x(1)=x(1)+f1*dt+0.5*dt**2*f2 x(2)=x(2)+f2*dt+0.5*dt**2*(-1.5*f1-10.0*sin(5.0*t)) t=t+dt 10 continue xe=51.0/47.0*cos(sqrt(3.0/2.0)*t)-sqrt(2.0/3.0)* c sin(sqrt(3.0/2.0)*t)-4.0/47.0*cos(5.0*t) write(13,*) t,x(1),x(2),xe close(13) stop end