# When checking the stability of a solution, how much should I perturb the state variable?

I'm studying a system of coupled ODEs, and one of my state variables seems to have settled into a final value. I want to check the stability of this value, so I wrote a function that stops the ode solver, and I use the final values from this first call to the solver as the initial conditions for a 2nd call to the solver. In this way, in the initial conditions, I can perturb my state variable of interest by changing its initial value, before evolving the model forward in time.

My question is: how much do I need to perturb the state variable's final value by, in order to conclude whether the solutions are stable / unstable? Is there a common benchmark to shoot for? 5%? 10%? What exactly is a "small" perturbation that the state variable should be able to withstand, if its final value is indeed stable?

Also, should I perturb the other state variables to determine stability of solutions of the one state variable that I am interested in, or is that not necessary?

Thanks,

The fact that one of your state variables converges (settles) to a fixed value, is itself a sign that this state is stable, in some sense: if it were unstable, then the flow would have never brought you there.

It seems most likely that not only the state variable you're interested in converges to this fixed value, but that all the other state variables converge to a fixed value as well. It's worthwhile to check this, though: it could be that some other state variables are converging to an oscillatory motion. From the dynamical systems point of view, the former situation would indicate the presence of a stable equilibrium or stable fixed point of the system; the latter situation would correspond to a stable limit cycle.

On the amplitude of the 'test' perturbation: strictly speaking, if a state (equilibrium, limit cycle) is not stable, then any perturbation, however small, will not decrease in time. However, there is a difference between being not stable and being unstable. Take for example the pendulum, hanging down without swinging. If you give it a push, however small, the pendulum will start to swing, with a very small amplitude. Obviously, in the numerical setting, such oscillatory solutions with extremely small amplitude are very hard to discover, especially when the oscillation amplitude is less than the grid spacing, for example.

A steady state is stable if any arbitrarily small perturbation of that state decreases in time. That means that, if you want to test for stability, you indeed have to perturb all the state variables. Again, from the fact that the system seems to settle in this state, it's already quite likely that this state is stable, as the flow is (locally) towards this state.

Lastly, even though you only have to check stability against arbitrarily small perturbations, it can be very useful from the practical point of view to try larger perturbations, i.e. to test the robustness of the steady state you're interested in. Keep in mind that the system might (actually, will) be more sensitive to perturbations in certain state variables, and less sensitive to perturbations in others. This also gives very valuable information on the behaviour of the system 'around' the steady state.

• Hi @FritsVeerman, thanks so much for this wonderful answer. I will go ahead and manually perturb all of my state variables, as you have suggested. Can I ask you a quick follow-up question? How long do you think I should run my solver for? Typically, when I just want a glance at what the trajectories look like, I run it for a time scale of [0 10] in matlab. I've heard that matlab doesn't know what "units" means. So, to my mind, I am running the solver for 10 "seconds". – D.Hutchinson Oct 25 '17 at 2:06
• When I found that the state variables were settling to fixed values (very exciting find), I ran the solver for even longer -- for a time scale of [0 30], i.e., 30 "seconds", and, the solutions remain fixed, which I had hoped for. Now, do you feel I should run the solver for an even longer period of time? Maybe for time scale [0 50]? Thanks, @FritsVeerman, – D.Hutchinson Oct 25 '17 at 2:06
• I would definitely experiment with run times. To get evidence for the system to go to a steady state (instead of to some slowly evolving state), it can be useful to try longer run times. Feel free to accept the answer, btw. – Frits Veerman Oct 25 '17 at 15:41
• Ok, just accepted -- thanks again! – D.Hutchinson Oct 26 '17 at 1:06