@@ -14,14 +14,14 @@ void exponential_decay(double t, const std::vector<double>& y, std::vector<doubl
1414 dydt[0 ] = -y[0 ];
1515}
1616
17- // 2. Van der Pol oscillator: d²x /dt² - μ (1-x²) dx/dt + x = 0
17+ // 2. Van der Pol oscillator: d^2x /dt^2 - mu* (1-x^2)* dx/dt + x = 0
1818class VanderPolOscillator {
1919public:
2020 explicit VanderPolOscillator (double mu) : mu_(mu) {}
2121
2222 void operator ()(double t, const std::vector<double >& y, std::vector<double >& dydt) {
2323 dydt[0 ] = y[1 ]; // dx/dt = v
24- dydt[1 ] = mu_ * (1 - y[0 ]*y[0 ]) * y[1 ] - y[0 ]; // dv/dt = μ (1-x²) v - x
24+ dydt[1 ] = mu_ * (1 - y[0 ]*y[0 ]) * y[1 ] - y[0 ]; // dv/dt = mu* (1-x^2)* v - x
2525 }
2626
2727private:
@@ -34,9 +34,9 @@ void lorenz_system(double t, const std::vector<double>& y, std::vector<double>&
3434 const double rho = 28.0 ;
3535 const double beta = 8.0 /3.0 ;
3636
37- dydt[0 ] = sigma * (y[1 ] - y[0 ]); // dx/dt = σ (y - x)
38- dydt[1 ] = y[0 ] * (rho - y[2 ]) - y[1 ]; // dy/dt = x(ρ - z) - y
39- dydt[2 ] = y[0 ] * y[1 ] - beta * y[2 ]; // dz/dt = xy - βz
37+ dydt[0 ] = sigma * (y[1 ] - y[0 ]); // dx/dt = sigma* (y - x)
38+ dydt[1 ] = y[0 ] * (rho - y[2 ]) - y[1 ]; // dy/dt = x*(rho - z) - y
39+ dydt[2 ] = y[0 ] * y[1 ] - beta * y[2 ]; // dz/dt = xy - beta*z
4040}
4141
4242// 4. Stiff test problem: Robertson chemical kinetics
@@ -70,7 +70,7 @@ double time_integrator(Integrator& integrator, std::vector<double>& y,
7070 std::cout << std::setw (12 ) << std::scientific << std::setprecision (4 ) << y[i];
7171 if (i < y.size () - 1 ) std::cout << " , " ;
7272 }
73- std::cout << " ] (Time: " << duration.count () << " μs )" ;
73+ std::cout << " ] (Time: " << duration.count () << " us )" ;
7474
7575 if (!completed) {
7676 std::cout << " [TIMEOUT]" ;
@@ -126,8 +126,8 @@ void demonstrate_exponential_decay() {
126126}
127127
128128void demonstrate_van_der_pol () {
129- std::cout << " \n === Van der Pol Oscillator: μ = 5 (moderately stiff) ===" << std::endl;
130- std::cout << " x''(t) - μ (1-x²) x'(t) + x(t) = 0" << std::endl;
129+ std::cout << " \n === Van der Pol Oscillator: mu = 5 (moderately stiff) ===" << std::endl;
130+ std::cout << " x''(t) - mu* (1-x^2)* x'(t) + x(t) = 0" << std::endl;
131131 std::cout << " Initial conditions: x(0) = 1, x'(0) = 0" << std::endl << std::endl;
132132
133133 VanderPolOscillator vdp (5.0 );
@@ -185,8 +185,8 @@ void demonstrate_van_der_pol() {
185185
186186void demonstrate_lorenz_system () {
187187 std::cout << " \n === Lorenz System (Chaotic) ===" << std::endl;
188- std::cout << " dx/dt = σ (y - x), dy/dt = x(ρ - z) - y, dz/dt = xy - βz " << std::endl;
189- std::cout << " σ = 10, ρ = 28, β = 8/3" << std::endl;
188+ std::cout << " dx/dt = sigma* (y - x), dy/dt = x*(rho - z) - y, dz/dt = xy - beta*z " << std::endl;
189+ std::cout << " sigma = 10, rho = 28, beta = 8/3" << std::endl;
190190 std::cout << " Initial conditions: x(0) = 1, y(0) = 1, z(0) = 1" << std::endl << std::endl;
191191
192192 double t_start = 0.0 , t_end = 0.5 , dt = 0.01 ; // Reduced from 5.0 to 0.5 for faster execution
@@ -295,13 +295,13 @@ int main() {
295295 demonstrate_adaptive_features ();
296296
297297 std::cout << " \n === Summary ===" << std::endl;
298- std::cout << " ✓ RK4: Simple, fixed-step 4th order method" << std::endl;
299- std::cout << " ✓ RK23: Adaptive 3rd order with embedded error estimation" << std::endl;
300- std::cout << " ✓ RK45: Adaptive 5th order Dormand-Prince (scipy default)" << std::endl;
301- std::cout << " ✓ DOP853: High-accuracy 8th order for demanding problems" << std::endl;
302- std::cout << " • Radau: Implicit 5th order for stiff systems (not yet implemented)" << std::endl;
303- std::cout << " ✓ BDF: Variable-order implicit multistep for stiff systems" << std::endl;
304- std::cout << " ✓ LSODA: Automatic method switching (Adams ↔ BDF)" << std::endl;
298+ std::cout << " [OK] RK4: Simple, fixed-step 4th order method" << std::endl;
299+ std::cout << " [OK] RK23: Adaptive 3rd order with embedded error estimation" << std::endl;
300+ std::cout << " [OK] RK45: Adaptive 5th order Dormand-Prince (scipy default)" << std::endl;
301+ std::cout << " [OK] DOP853: High-accuracy 8th order for demanding problems" << std::endl;
302+ std::cout << " - Radau: Implicit 5th order for stiff systems (not yet implemented)" << std::endl;
303+ std::cout << " [OK] BDF: Variable-order implicit multistep for stiff systems" << std::endl;
304+ std::cout << " [OK] LSODA: Automatic method switching (Adams <-> BDF)" << std::endl;
305305
306306 } catch (const std::exception& e) {
307307 std::cerr << " Error: " << e.what () << std::endl;
0 commit comments