Given an n x n matrix “A”, with one or more unknown parameters, I’d like to show a plot of which values produce stability (negative Eigenvalues).

For example, say you have a simple mass-spring-damper system by:

ClearAll[“Global`*”]

A = {{0, 1}, {-k, -c}}

eigA = Eigenvalues[A]

Is it possible to generate a plot showing c values in terms of k, or vise-versa?

I’ve attempted methods such as

Solve[First[eigA]==0,k],

Solve[First[eigA]==0,k],

Reduce[First[eigA]<0 && eigA[[2]]<0,k],
etc. but these outputs nothing? What am I doing wrong?
Ultimately I'd like to have a color coded plot, showing areas of stability and instability, if this is possible in Mathematica.
=================
=================
1 Answer
1
=================
I can't exactly understand what you're asking for, but is this roughly what you are looking for?
A = {{0, 1}, {-k, -c}};
eigA = Eigenvalues[A];
RegionPlot[Min[eigA] < 0, {c, -4, 4}, {k, -2, 2},
FrameLabel -> {“c”, “k”}] // Quiet

As another amusing example of a two-parameter matrix stability diagram (where blue indicates stability, and red instability):

$A[k_, c_] := Eigenvalues[N@( {

{1, 0, Sin[k]},

{0, 1 + Sin[c], Cos[c k]},

{Sin[k], Cos[c k], 1}

} )];

Image[hue[Table[Min[$A[k, c]], {k, -4, 4, 0.01}, {c, -4, 4, 0.01}]],

ColorSpace -> Hue]

where

hue = Compile[{{z, _Complex}}, {(1.0 Arg[-z] + \[Pi])/(2 \[Pi]),

Exp[1 – Max[Abs[z], 1]], Min[Abs[z], 1]},

CompilationTarget -> “C”, RuntimeAttributes -> {Listable}];

That is exactly what I’m looking for, however picking some test values the region does not seem accurate? Such as k=1,c=1 is outside of the region but still provides negative Eigenvalues. Perhaps we must only specify the real part as negative?

– gKirkland

Nov 4 ’14 at 16:45

@gKirkland: I’m not sure what you’re talking about. k=c=1k=c=1 produces eigenvalues which are the primitive third roots of unity, which are not negative, as the diagram correctly shows.

– DumpsterDoofus

Nov 4 ’14 at 16:49

Hmmm… if k=c=1 then A={{0,1},{-1,-1,}}. Eigenvalues are {-0.5-0.866025 I,-0.5+0.866025 I} are they not?

– gKirkland

Nov 4 ’14 at 16:56

@gKirkland: Yes. They are not negative. Are they supposed to be considered as stable because the real part is negative? If so, I can modify my answer to reflect that.

– DumpsterDoofus

Nov 4 ’14 at 16:58

The imaginary part is not, corrrect, but looking for stability I’m only interested in the real part. I changed to RegionPlot[Re[eigA[[1]]] < 0 && Re[eigA[[2]]] < 0,...] and this seems to be producing what I need. Thanks for the help! – gKirkland Nov 4 '14 at 17:00