Solving an ODE which depends on an external function

That way is fine.