; this script solves numerically prob. 7.1.9 ; from Strogatz "Nonlinear Sys. and Chaos" i = dcomplex(0.0, 1.0d0) one = dcomplex(1.0d0, 0d0) time = 500.d0 & dt = 0.004d0 N = 1L*time/dt pic = complexarr(N+1L) dt05 = 0.5d0*dt ;-----changes in the inteval [0,1] for is = 5,100,5 do begin s = is*0.01d0 pic = 0*pic ; zero the storage r = one ; initial position for k = 0L, N-1L do begin ; 2nd order integrator r0 = r rdot0 = i*(1-r)-s*r/abs(r) ; first r.h.s. evaluation r = r + rdot0*dt ; predictor step rdot1 = i*(1-r)-s*r/abs(r) ; 2nd r.h.s. evaluation r = r0 + (rdot0+rdot1)*dt05 ; corrector step w/averaged r.h.s. pic(k) = r ; store trajectory endfor ;----plot trajectory if(is EQ 5)then plot,real_part(pic(0:N-1)),imaginary(pic(0:N-1)),charsize=2 $ ,psym=3,yrange=[0.,0.7],xrange=[0.,1.1],xtitle='X',ytitle='Y' oplot,real_part(pic(0:N-1)),imaginary(pic(0:N-1)),color=444,psym=4,symsize=0.1 endfor end