Sensitivity of the Duffing Equation

Explore the sensitivity of the Duffing equation to initial conditions.

To simplify the computations that follow, use ParametricNDSolveValue with only the initial conditions as parameters and other values fixed:
The derivatives of the ParametricFunction with respect to a and b are the sensitivities with respect to the initial values for x and its derivative x, respectively:
Show a plot of the solution starting at {0,0} and log plots of the sensitivities:
The enormous sensitivities indicate that even a small change in either of these parameters will lead to a large deviation in the solution. Shown below are the solutions with a small perturbation from the origin in either direction:
Another way to visualize the sensitivity is to locally break it down into components parallel and perpendicular to the direction of the trajectory in the phase plane.
Define a function that gives a vector perpendicular to the trajectory as a function of time:
Now define functions that give the magnitude of the components of the sensitivity with respect to the initial value of x in the parallel and perpendicular directions:
For this equation, the two components grow at comparable rates.
The component breakdown allows a nice visualization in the phase plane. Changing the scaling of the sensitivity makes it possible to see it for different time intervals: