Skip to content

Commit 1cf0d28

Browse files
Apply suggestions from code review
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ae391b7 commit 1cf0d28

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

doc/solvers/RungeKuttaIntegrators.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -72,24 +72,24 @@ The 7th stage $k_7 = f(y_5, u, t+h)$ equals the first stage of the next accepted
7272

7373
## Complexity Analysis
7474

75-
| Integrator | RHS evaluations per accepted step | State memory |
76-
|----------------|----------------------------------|----------------|
77-
| RK4 (fixed) | 4 (always) | $O(n_s)$ |
78-
| Dormand-Prince | 6 (with FSAL), 7 on first step | $O(n_s)$ |
75+
| Integrator | RHS evaluations per accepted step | State memory |
76+
|----------------|-----------------------------------|--------------|
77+
| RK4 (fixed) | 4 (always) | $O(n_s)$ |
78+
| Dormand-Prince | 6 (with FSAL), 7 on first step | $O(n_s)$ |
7979

8080
All intermediate stage vectors are stack-allocated. No heap is used. The cost of one step is $O(s \cdot n_s)$ where $s$ is the stage count plus the cost of evaluating $f$.
8181

8282
## Step-by-Step Walkthrough
8383

8484
**Scalar decay** $\dot{x} = -x$, $x(0) = 1$, exact solution $x(t) = e^{-t}$, $h = 0.1$:
8585

86-
| Stage | Formula | Value |
87-
|-------|---------------------------------------------------|-------------|
88-
| $k_1$ | $f(1, 0) = -1$ | $-1$ |
89-
| $k_2$ | $f(1 - 0.05, 0.05) = -0.95$ | $-0.95$ |
90-
| $k_3$ | $f(1 - 0.0475, 0.05) = -0.9525$ | $-0.9525$ |
91-
| $k_4$ | $f(1 - 0.09525, 0.1) = -0.90475$ | $-0.90475$ |
92-
| $x_1$ | $1 + (0.1/6)(-1 - 1.9 - 1.905 - 0.90475)$ | $\approx 0.90484$ |
86+
| Stage | Formula | Value |
87+
|-------|-------------------------------------------|-------------------|
88+
| $k_1$ | $f(1, 0) = -1$ | $-1$ |
89+
| $k_2$ | $f(1 - 0.05, 0.05) = -0.95$ | $-0.95$ |
90+
| $k_3$ | $f(1 - 0.0475, 0.05) = -0.9525$ | $-0.9525$ |
91+
| $k_4$ | $f(1 - 0.09525, 0.1) = -0.90475$ | $-0.90475$ |
92+
| $x_1$ | $1 + (0.1/6)(-1 - 1.9 - 1.905 - 0.90475)$ | $\approx 0.90484$ |
9393

9494
Exact: $e^{-0.1} \approx 0.90484$. Agreement to six significant figures — consistent with $O(h^5)$ local error.
9595

@@ -103,14 +103,14 @@ Exact: $e^{-0.1} \approx 0.90484$. Agreement to six significant figures — cons
103103

104104
## Variants & Generalizations
105105

106-
| Variant | Key Difference |
107-
|------------------------------|---------------------------------------------------------------------------------------|
108-
| **Euler (1st order)** | One stage; $O(h)$ global error; useful only for rough prototyping |
109-
| **RK4 (this)** | Four stages; $O(h^4)$ global error; standard fixed-step workhorse |
110-
| **Dormand-Prince (this)** | Seven stages; $O(h^5)$ propagator with built-in $O(h^4)$ error estimate |
111-
| **Bogacki-Shampine RK23** | Three-stage embedded pair; lower overhead for mildly stiff or smooth problems |
112-
| **Adams-Bashforth** | Multi-step; reuses past evaluations; efficient but requires startup phase |
113-
| **Implicit RK / SDIRK** | Solves a nonlinear system at each stage; suitable for stiff problems at the cost of a linear solve per step |
106+
| Variant | Key Difference |
107+
|---------------------------|-------------------------------------------------------------------------------------------------------------|
108+
| **Euler (1st order)** | One stage; $O(h)$ global error; useful only for rough prototyping |
109+
| **RK4 (this)** | Four stages; $O(h^4)$ global error; standard fixed-step workhorse |
110+
| **Dormand-Prince (this)** | Seven stages; $O(h^5)$ propagator with built-in $O(h^4)$ error estimate |
111+
| **Bogacki-Shampine RK23** | Three-stage embedded pair; lower overhead for mildly stiff or smooth problems |
112+
| **Adams-Bashforth** | Multi-step; reuses past evaluations; efficient but requires startup phase |
113+
| **Implicit RK / SDIRK** | Solves a nonlinear system at each stage; suitable for stiff problems at the cost of a linear solve per step |
114114

115115
## Applications
116116

@@ -134,12 +134,12 @@ graph LR
134134
C2D -.->|"exact linear alternative"| RK
135135
```
136136

137-
| Algorithm | Relationship |
138-
|----------------------------|-----------------------------------------------------------------------------------------------|
139-
| `dynamics/` models | Provide the right-hand side $f(x, u, t)$ that RK integrates |
140-
| Extended Kalman Filter | Uses RK to propagate the state prediction step between measurements |
141-
| MPC Controller | Uses RK to simulate the plant over a prediction horizon |
142-
| ContinuousToDiscrete | Exact matrix-exponential discretization — an alternative for linear, time-invariant systems |
137+
| Algorithm | Relationship |
138+
|------------------------|---------------------------------------------------------------------------------------------|
139+
| `dynamics/` models | Provide the right-hand side $f(x, u, t)$ that RK integrates |
140+
| Extended Kalman Filter | Uses RK to propagate the state prediction step between measurements |
141+
| MPC Controller | Uses RK to simulate the plant over a prediction horizon |
142+
| ContinuousToDiscrete | Exact matrix-exponential discretization — an alternative for linear, time-invariant systems |
143143

144144
## References & Further Reading
145145

0 commit comments

Comments
 (0)