lines 6-59 of file: example/python/numeric/runge4_step_xam.py # {xrst_begin numeric_runge4_step_xam.py} # {xrst_spell # kutta # rl # } # {xrst_comment_ch #} # # # Example Computing Derivative A Runge-Kutta Ode Solution # ####################################################### # # ODE # *** # # .. math:: # # \partial_t y_i (t, x) = f(t, y, x) \left\{ \begin{array}{rl} # x_0 & {\rm if} \; i = 0 \\ # x_i y_{i-1} (t) & {\rm otherwise} # \end{array} \right. # # with the initial condition :math:`y(0) = 0` # # Solution # ******** # This is a special case for which we know the solution # # .. math:: # # y_i (t, x) = \left\{ \begin{array}{rl} # t x_0 & {\rm if} \; i = 0 \\ # ( t^i / (i+1) ! ) \prod_{j=0}^i x_j & {\rm otherwise} # \end{array} \right. # # Derivative of Solution # ********************** # For this special case, the partial derivative of the solution with respect # to the j-th component of the vector :math:`x` is # # .. math:: # # \partial_{x(j)} y_i (t, x) = \left\{ \begin{array}{rl} # y_i (t, x) / x_j & {\rm if} \; j \leq i \\ # 0 & {\rm otherwise} # \end{array} \right. # # Source Code # *********** # {xrst_literal # # BEGIN_PYTHON # # END_PYTHON # } # # {xrst_end numeric_runge4_step_xam.py}