Chapter 23 Quiz: Ordinary Differential Equations
Twenty questions to check your grasp of initial-value problems, Euler, RK4, adaptivity, systems, the method of lines, and stiffness. Aim for 16/20; below that, reread the section named in the "Topics to review" map at the end. Answers and one-line rationales are in the key.
1. An initial-value problem is specified by: - (a) an ODE alone - (b) an ODE plus a boundary value at each end of an interval - (c) an ODE $y' = f(t, y)$ plus an initial condition $y(t_0) = y_0$ - (d) a value and a derivative at the same point, with no equation
2. Euler's method has global order: - (a) $0$ (b) $1$ (c) $2$ (d) $4$
3. RK4 has global order: - (a) $1$ (b) $2$ (c) $4$ (d) $5$
4. (True/False, justify.) Euler's local truncation error is $O(h^2)$, so its error over a fixed interval is also $O(h^2)$.
5. How many evaluations of the RHS $f$ does one classical RK4 step require? - (a) 1 (b) 2 (c) 4 (d) 6
6. The RK4 final combination is $y_{n+1} = y_n + \tfrac{h}{6}(k_1 + 2k_2 + 2k_3 + k_4)$. The weights sum to: - (a) $\tfrac12$ (b) $1$ (c) $\tfrac{h}{6}$ (d) $6$
7. (What does this print?) For $f(t, y) = y$, $y_0 = 1$:
y = 1.0_dp + 1.0_dp * (1.0_dp) ! one Euler step, h = 1
print '(f6.3)', y
8. (True/False, justify.) Because RK4 costs four RHS evaluations per step and Euler costs one, Euler reaches any given accuracy with less total work.
9. In an adaptive integrator, a step is rejected when: - (a) the estimated local error exceeds the tolerance - (b) the step size grows - (c) the RHS returns zero - (d) the solution is negative
10. Step doubling estimates local error by comparing: - (a) two different RHS functions - (b) a step of size $h$ against two steps of size $h/2$ - (c) Euler against RK4 - (d) the solution against its initial condition
11. (Short answer.) Write the reduction of the second-order ODE $y'' = -y$ to a first-order system.
12. The method of lines turns a time-dependent PDE into: - (a) a single algebraic equation - (b) a boundary-value problem - (c) a large system of ODEs, one per grid point - (d) a stochastic process
13. (True/False, justify.) In the method of lines, both the spatial and the time derivatives are replaced by finite differences before you begin.
14. Applying explicit Euler to the method-of-lines heat system produces: - (a) an implicit scheme requiring a linear solve - (b) the explicit forward-time, centered-space heat stepping scheme - (c) a spectral method - (d) a symplectic integrator
15. A system is stiff when: - (a) the RHS is nonlinear - (b) it has widely separated time scales, forcing tiny stability-limited steps - (c) the solution grows without bound - (d) it has more than two components
16. Backward (implicit) Euler applied to $y' = \lambda y$ gives $y_{n+1} =$ - (a) $(1 + h\lambda)\,y_n$ - (b) $y_n / (1 - h\lambda)$ - (c) $y_n\,e^{h\lambda}$ - (d) $(1 - h\lambda)\,y_n$
17. (What does this print?) Explicit Euler on $y' = -y$, one step, $h = 3$, $y_0 = 1$:
y = 1.0_dp + 3.0_dp * (-1.0_dp * 1.0_dp)
print '(f5.1)', y
Is the result stable (decaying) or not?
18. (True/False, justify.) Backward Euler is stable for $y' = \lambda y$ ($\lambda < 0$) at any positive step size.
19. (Short answer.) Why do long-duration orbital integrations often prefer a symplectic integrator (leapfrog) over RK4, even though RK4 is more accurate per step?
20. The main reason to pass the RHS $f(t, y)$ to your integrator as a procedure argument is: - (a) it runs faster - (b) it uses less memory - (c) one hardened integrator then works for any equation — you change only the RHS - (d) the standard requires it
Answer Key
| # | Answer | One-line rationale |
|---|---|---|
| 1 | c | An IVP is an ODE together with the state at a starting time. |
| 2 | b | Euler is first order: global error $O(h)$. |
| 3 | c | Classical RK4 is fourth order: global error $O(h^4)$. |
| 4 | False | Reaching a fixed $T$ takes $N \propto 1/h$ steps; $N$ local errors of $O(h^2)$ sum to global $O(h)$. |
| 5 | c | Four stages $k_1, k_2, k_3, k_4$, one $f$-evaluation each. |
| 6 | b | $\tfrac16 + \tfrac26 + \tfrac26 + \tfrac16 = 1$, so a constant slope integrates exactly. |
| 7 | 2.000 |
$y = 1 + 1\cdot 1 = 2$. |
| 8 | False | Fourth order needs far fewer, larger steps; RK4 reaches a given accuracy with thousands of times less total work. |
| 9 | a | The controller shrinks $h$ and retries when the error estimate exceeds tolerance. |
| 10 | b | The full step and the two half-steps differ by an amount proportional to the local error. |
| 11 | — | $y_1 = y,\ y_2 = y'$; then $y_1' = y_2,\ y_2' = -y_1$. |
| 12 | c | Discretize space, keep time continuous: one ODE per grid point. |
| 13 | False | Only spatial derivatives are discretized; time is left continuous (that is the whole idea). |
| 14 | b | $\mathbf{u}^{n+1} = \mathbf{u}^n + \Delta t\,\alpha(\text{2nd diff})$ is the explicit heat scheme. |
| 15 | b | Stiffness = separated time scales forcing stability-limited (not accuracy-limited) steps. |
| 16 | b | $y_{n+1} = y_n + h\lambda y_{n+1} \Rightarrow y_{n+1} = y_n/(1 - h\lambda)$. |
| 17 | -2.0, unstable |
$|1 + h\lambda| = |1 - 3| = 2 > 1$; the numerical solution grows: $-2, 4, -8, \dots$ |
| 18 | True | $1 - h\lambda > 1$ for $\lambda < 0$, so $|y_{n+1}| < |y_n|$ for every $h > 0$ (A-stability). |
| 19 | — | RK4 slowly drifts energy, so orbits spiral over eons; symplectic methods conserve a nearby energy exactly, keeping the orbit closed. |
| 20 | c | A procedure-argument RHS decouples the solver from the equation — the Chapter 6 payoff. |
Topics to review by question
| If you missed… | Reread |
|---|---|
| 1, 2, 4, 7 | §23.1 The initial-value problem and Euler's method |
| 3, 5, 6, 8 | §23.2 Runge-Kutta and RK4 |
| 9, 10 | §23.3 Adaptive step-size control |
| 11, 12, 13, 14, 20 | §23.4 Systems and the method of lines |
| 15, 16, 17, 18 | §23.5 Stiffness and implicit methods |
| 19 | §23.4 (energy drift) and §23.6 (orbital motion) |