0
$\begingroup$
f[k_] = {{-0.001 - 2 I k, 1, -0.001, -0.501}, {0.001, -0.5 - I k, 0.001, 0.001},
     {-0.001, -0.501, -0.001 + 2 I k, 1.}, {0.001, 0.001, 0.001, -0.5 + I k}};

y[k_] = Im[Eigenvalues[f[k]][[3]]];
Plot[y[k], {k, -1, 1}]

3rd and 4th eigenvalues are complex conjugates, as we can see from the graph the program mixed them, there are lots of jump discontinuities from the one with negative imaginary part to the one with positive. I suspect that the program sometimes takes as the 3rd eigenvalue (or root) the one with positive "Im" and sometime the one with negative "Im".

Please help me to resolve this problem by a general approach (of course for this case one can take the Max of two as k>0 and Min otherwise to obtain the imaginary part of the desired eigenvalue).

$\endgroup$
1
$\begingroup$

I'm not sure exactly which eigenvalues you wish to display, but you can sort them in order to choose. For instance, to plot the largest eigenvalue, you can

f[k_] := {{-0.001 - 2 I k, 1, -0.001, -0.501}, {0.001, -0.5 - I k, 
    0.001, 0.001}, {-0.001, -0.501, -0.001 + 2 I k, 1.}, {0.001, 
    0.001, 0.001, -0.5 + I k}};

y[k_] := Sort[Im[Eigenvalues[f[k]]]][[3]];
Plot[y[k], {k, -1, 1}]

which gives

enter image description here

Sort also takes an optional second argument which can be used to pick out which of the eigenvalues you want plotted.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy