Convergence orders
The error of each order of the regime-switching expansion against the numerical solution, as the switching rate grows.
Each line is the absolute error of an approximation to the survival probability at a fixed maturity, against the numerical solution, as the switching rate $\lambda$ runs from 1 to 1000. Both axes are logarithmic, so an error of order $\lambda^{-n}$ is a straight line of slope $-n$. The parameters are those of the survival demo.
At a generic maturity the averaged, first-order and second-order errors fall with slopes $-1$, $-2$ and $-3$, measured over the last decade of $\lambda$ and reported below the chart. A second-order slope visibly shallower than $-3$ at large $\lambda$ would refute the expansion. At small $\lambda$ the lines bend, because the expansion is asymptotic.
The coefficient of $\lambda^{-2}$ in the first-order error depends on the maturity and crosses zero, near $t = 2.0$ from regime 1 and $t = 7.4$ from regime 2. Close to those maturities the $\lambda^{-3}$ term cancels it across the plotted range, so the first-order slope there is not the asymptotic one, and the readout says so.
Errors below about $10^{-12}$ reach the accuracy of the in-browser ODE solver, so the plot stops at $\lambda = 1000$.
Certificate: verify_expansion.py.