lines 7-51 of file: example/utility/ode_err_control.cpp {xrst_begin ode_err_control.cpp} OdeErrControl: Example and Test ############################### Define :math:`X : \B{R} \rightarrow \B{R}^2` by .. math:: :nowrap: \begin{eqnarray} X_0 (0) & = & 1 \\ X_1 (0) & = & 0 \\ X_0^{(1)} (t) & = & - \alpha X_0 (t) \\ X_1^{(1)} (t) & = & 1 / X_0 (t) \end{eqnarray} It follows that .. math:: :nowrap: \begin{eqnarray} X_0 (t) & = & \exp ( - \alpha t ) \\ X_1 (t) & = & [ \exp( \alpha t ) - 1 ] / \alpha \end{eqnarray} This example tests OdeErrControl using the relations above. Nan *** Note that :math:`X_0 (t) > 0` for all :math:`t` and that the ODE goes through a singularity between :math:`X_0 (t) > 0` and :math:`X_0 (t) < 0`. If :math:`X_0 (t) < 0`, we return ``nan`` in order to inform ``OdeErrControl`` that its is taking to large a step. {xrst_literal // BEGIN C++ // END C++ } {xrst_end ode_err_control.cpp}