parameters: (fun, t, y, f, h, A, B, C, E, K)
return_statement: return y_new, f_new, error
docstring: Perform a single Runge-Kutta step.
  
      This function computes a prediction of an explicit Runge-Kutta method and
      also estimates the error of a less accurate method.
  
      Notation for Butcher tableau is as in [1]_.
  
      Parameters
      ----------
      fun : callable
          Right-hand side of the system.
      t : float
          Current time.
      y : ndarray, shape (n,)
          Current state.
      f : ndarray, shape (n,)
          Current value of the derivative, i.e. ``fun(x, y)``.
      h : float
          Step to use.
      A : list of ndarray, length n_stages - 1
          Coefficients for combining previous RK stages to compute the next
          stage. For explicit methods the coefficients above the main diagonal
          are zeros, so `A` is stored as a list of arrays of increasing lengths.
          The first stage is always just `f`, thus no coefficients for it
          are required.
      B : ndarray, shape (n_stages,)
          Coefficients for combining RK stages for computing the final
          prediction.
      C : ndarray, shape (n_stages - 1,)
          Coefficients for incrementing time for consecutive RK stages.
          The value for the first stage is always zero, thus it is not stored.
      E : ndarray, shape (n_stages + 1,)
          Coefficients for estimating the error of a less accurate method. They
          are computed as the difference between b's in an extended tableau.
      K : ndarray, shape (n_stages + 1, n)
          Storage array for putting RK stages here. Stages are stored in rows.
  
      Returns
      -------
      y_new : ndarray, shape (n,)
          Solution at t + h computed with a higher accuracy.
      f_new : ndarray, shape (n,)
          Derivative ``fun(t + h, y_new)``.
      error : ndarray, shape (n,)
          Error estimate of a less accurate method.
  
      References
      ----------
      .. [1] E. Hairer, S. P. Norsett G. Wanner, "Solving Ordinary Differential
             Equations I: Nonstiff Problems", Sec. II.4.
docstring_summary: Perform a single Runge-Kutta step.
docstring_tokens: Perform a single Runge - Kutta step .
function: def rk_step(fun, t, y, f, h, A, B, C, E, K):
      """Perform a single Runge-Kutta step.
  
      This function computes a prediction of an explicit Runge-Kutta method and
      also estimates the error of a less accurate method.
  
      Notation for Butcher tableau is as in [1]_.
  
      Parameters
      ----------
      fun : callable
          Right-hand side of the system.
      t : float
          Current time.
      y : ndarray, shape (n,)
          Current state.
      f : ndarray, shape (n,)
          Current value of the derivative, i.e. ``fun(x, y)``.
      h : float
          Step to use.
      A : list of ndarray, length n_stages - 1
          Coefficients for combining previous RK stages to compute the next
          stage. For explicit methods the coefficients above the main diagonal
          are zeros, so `A` is stored as a list of arrays of increasing lengths.
          The first stage is always just `f`, thus no coefficients for it
          are required.
      B : ndarray, shape (n_stages,)
          Coefficients for combining RK stages for computing the final
          prediction.
      C : ndarray, shape (n_stages - 1,)
          Coefficients for incrementing time for consecutive RK stages.
          The value for the first stage is always zero, thus it is not stored.
      E : ndarray, shape (n_stages + 1,)
          Coefficients for estimating the error of a less accurate method. They
          are computed as the difference between b's in an extended tableau.
      K : ndarray, shape (n_stages + 1, n)
          Storage array for putting RK stages here. Stages are stored in rows.
  
      Returns
      -------
      y_new : ndarray, shape (n,)
          Solution at t + h computed with a higher accuracy.
      f_new : ndarray, shape (n,)
          Derivative ``fun(t + h, y_new)``.
      error : ndarray, shape (n,)
          Error estimate of a less accurate method.
  
      References
      ----------
      .. [1] E. Hairer, S. P. Norsett G. Wanner, "Solving Ordinary Differential
             Equations I: Nonstiff Problems", Sec. II.4.
      """
      K[0] = f
      for s, (a, c) in enumerate(zip(A, C)):
          dy = np.dot(K[:s + 1].T, a) * h
          K[s + 1] = fun(t + c * h, y + dy)
  
      y_new = y + h * np.dot(K[:-1].T, B)
      f_new = fun(t + h, y_new)
  
      K[-1] = f_new
      error = np.dot(K.T, E) * h
  
      return y_new, f_new, error
function_tokens: def rk_step ( fun , t , y , f , h , A , B , C , E , K ) : K [ 0 ] = f for s , ( a , c ) in enumerate ( zip ( A , C ) ) : dy = np . dot ( K [ : s + 1 ] . T , a ) * h K [ s + 1 ] = fun ( t + c * h , y + dy ) y_new = y + h * np . dot ( K [ : - 1 ] . T , B ) f_new = fun ( t + h , y_new ) K [ - 1 ] = f_new error = np . dot ( K . T , E ) * h return y_new , f_new , error