```
using DifferentialEquations
u0 = [1.,0.]
harmonic! = @ode_def HarmonicOscillator begin
dv = -x
dx = v
end
tspan = (0.0,10.0)
prob = ODEProblem(harmonic!,u0,tspan)
function terminate_affect!(integrator)
terminate!(integrator)
end
function terminate_condition(u,t,integrator)
u[2] < 0.5
end
terminate_cb = ContinuousCallback(terminate_condition,terminate_affect!)
julia> sol = solve(prob,callback=terminate_cb)
retcode: Terminated
Interpolation: automatic order switching interpolation
t: 8-element Vector{Float64}:
0.0
0.0009990009990009992
0.010989010989010992
0.07985922249873038
0.2403882280626971
0.48125583199780264
0.7872724750204353
0.7872724750204353
u: 8-element Vector{Vector{Float64}}:
[1.0, 0.0]
[0.9999995009985435, 0.000999000832833342]
[0.9999396214263468, 0.010988789821184269]
[0.9968129466114029, 0.07977436592568168]
[0.9712456180254766, 0.23807970964822978]
[0.8864142948207253, 0.4628927349710369]
[0.7057801319307302, 0.7084309070362929]
[0.7057801319307302, 0.7084309070362929]
```

why is u[2] < 0.5 condition not satisfied here? Am I missing something?