Skip to content

General Considerations

Given an ordinary differential equation (ODE) for simulating a quantity f over time t:

df(t)dt=F(f(t),t)

where F is some expression that can depend on f and/or t. Point f(t) can be propagated to the next point f(t+Δt) via explicit Euler method:

f(t+Δt)≈f(t)+Δt⋅F(f(t),t)

where Δt is the time step. The approximation can be quite crude, especially for large Δt. In case of an ODE that converges towards a fixed value, this can lead to overshooting the target, which is why clamping f is often advised. For ODEs of the form below:

df(t)dt=k⋅(f∞−f(t))k>0

with rate constant k and target f∞. The target f∞ gets approached with exponential convergence and the clamped version of explicit Euler can be simplified with linear interpolation (lerp):

ξprogress=min⁡(k⋅Δt, 1) f(t+Δt)≈lerp(f(t), f∞, ξprogress)