def test_compute_residual():
 (t0, k0) = (0, np.array([5.0]))
 results = _compute_fixed_length_solns(model, t0, k0)
 for (integrator, numeric_solution) in results.items():
  (N, T) = (1000, numeric_solution[:, 0][(-1)])
  tmp_grid_pts = np.linspace(t0, T, N)
  tmp_residual = model.compute_residual(numeric_solution, tmp_grid_pts, k=5)
  expected_residual = np.zeros((N, 2))
  actual_residual = tmp_residual
  np.testing.assert_almost_equal(expected_residual, actual_residual)

def test_compute_residual ( ) : ( t0 , k0 ) = ( 0 , np . array ( [ 5.0 ] ) ) results = _compute_fixed_length_solns ( model , t0 , k0 ) for ( integrator , numeric_solution ) in results . items ( ) : ( N , T ) = ( 1000 , numeric_solution [ : , 0 ] [ ( - 1 ) ] ) tmp_grid_pts = np . linspace ( t0 , T , N ) tmp_residual = model . compute_residual ( numeric_solution , tmp_grid_pts , k = 5 ) expected_residual = np . zeros ( ( N , 2 ) ) actual_residual = tmp_residual np . testing . assert_almost_equal ( expected_residual , actual_residual )
testing computation of solution residual .