5void exponential_decay(
double t,
const std::vector<double>& y, std::vector<double>& dydt) {
10 std::cout <<
"Testing RK4 only..." << std::endl;
13 std::vector<double> y = {1.0};
15 integrator.set_time(0.0);
16 integrator.integrate(y, 0.1, 1.0);
17 std::cout <<
"RK4 result: " << y[0] <<
" (expected: " << std::exp(-1.0) <<
")" << std::endl;
18 std::cout <<
"[PASS] RK4 test passed!" << std::endl;
19}
catch (
const std::exception& e) {
20 std::cout <<
"[FAIL] RK4 test failed: " << e.what() << std::endl;
Classical 4th-order Runge-Kutta integrator.
Modern C++ ODE Integration Library with Real-time Signal Processing.