if wnew*w < 0 then ! This is code to determine the period let tzero = t+tstep*(0-w)/(wnew-w) ! Note that it prints every half period print "w=0 at time = ";tzero end if