if not solution.success: raise RuntimeError(solution.message) expected = INITIAL_VALUE * np.exp(-DECAY_RATE * sample_times) np.testing.assert_allclose(solution.y[0], expected, rtol=1e-7, atol=1e-9) if not np.isclose(solution.t[-1], time_span[1]): raise RuntimeError("The solver stopped before the final time.") max_abs_error = np.max(np.abs(solution.y[0] - expected)) print(f"time: {np.array2string(solution.t, precision=2)}") print(f"state: {np.array2string(solution.y[0], precision=8)}") print(f"max_abs_error: {max_abs_error:.2e}") print(f"final_time: {solution.t[-1]:.1f}") print(f"solver_message: {solution.message}")