I have two functions $f(x,y),g(x,y)$ and a matrix
$M=\begin{pmatrix}\frac{\partial f}{\partial x} & \frac{\partial f}{\partial y}\\\frac{\partial g}{\partial x} & \frac{\partial g}{\partial y}\end{pmatrix}$.
Because the matrix elements are functions of $x$ and $y$, I expect the eigenvalues of $M$ and the components of the eigenvectors of $M$ to also be functions of $x$ and $y$.
Here's a little bit of code:
f=...;
g=...;
M={{D[f,x],D[f,y]},{D[g,x],D[g,y]}};
(note that I haven't given the explicit expressions for $f$ and $g$ because they're unimportant for the purposes of this question; suffice it to say that they're complicated enough for their partial derivatives to be horrendous).
I can ask Mathematica for the eigenvalues of $M$, and I get a pair of pretty decent (if horrible-looking) answers which are indeed functions of $x$ and $y$. If I attempt to extract the eigenvectors of $M$, however, Mathematica runs for a while and ultimately gives up:
Eigenvectors[M]
Eigenvectors::eivec0: Unable to find all eigenvectors. >>
{{0,0},{0,0}}
I've therefore resorted to graphing the (absolute values of the) components of the eigenvectors for different values of $x$ and $y$, which takes forever but works. Here's my code:
Quiet[
DensityPlot[
Abs[Eigenvectors[M][[1]][[1]]],
{x,x1,x2},{y,y1,y2},
Exclusions->None,
ColorFunction->"Rainbow",
PlotRangePadding->0,
PlotLabel->Row[{Subscript[v,Subscript[1,1]]}],
PlotLegends->Automatic
]
]
and similarly for the other three components. Here's an example of one of the components:
Now, the Mathematica documentation for Eigenvalues
says
If they are numeric, eigenvalues are sorted in order of decreasing absolute value.
and the documentation for Eigenvectors
says
Eigenvectors with numeric eigenvalues are sorted in order of decreasing absolute value of their eigenvalues.
and
For exact or symbolic matrices $m$, the eigenvectors are not normalized.
I therefore have four questions:
If one eigenvalue has a higher absolute value than the other for certain values of $x$ and $y$ but a lower absolute value than the other for other values of $x$ and $y$, does the order change? In other words, if I ask Mathematica to graph the first eigenvector (i.e. that with the highest absolute value, as per the documentation), do I get one eigenvector for certain values of $x$ and $y$ and the other one for the other values of $x$ and $y$?
If the eigenvalues are not normalised, which criterion does Mathematica use to determine which multiples of the normalised eigenvectors to display? (Any linear combination of eigenvectors of a matrix is also an eigenvector of that matrix, so whatever Mathematica returns is $k_1$ times the normalised first eigenvector and $k_2$ times the normalised second eigenvector; how does Mathematica choose the $k_j$? I seem to recall always getting eigenvectors where one of the components equals 1; is this the case? If so, which component is equal to 1?)
Here I will use the word "normalise" in a general sense; I know that the eigenvectors are not normalised to 1 (as per the documentation), but they might be normalised to something else (which may or may not be different for each eigenvector; that is relevant for question 2 but not for this question). If the eigenvectors are indeed normalised, does Mathematica renormalise them for each combination of values of $x$ and $y$? (If so, my graphs of the components of the eigenvectors are meaningless except as a gauge of how large the quotient between the two components is.)
Regardless of whether the eigenvalues of $M$ are functions of $x$ and $y$ or not, if I call them $e_1$ and $e_2$ (in the order in which Mathematica gives them), is there any way of knowing whether the diagonalised expression for $M$ is $\begin{pmatrix}e_1 & 0\\0 & e_2\end{pmatrix}$ or $\begin{pmatrix}e_2 & 0\\0 & e_1\end{pmatrix}$?
I am aware of this question, but that concerns only the relative ordering of eigenvectors to the ordering of eigenvalues, which is already answered in the documentation (and included in the quotes above). I am also aware of this other question, but that appears to be about intentionally reordering the eigenvalues rather than finding out whether Mathematica does it by default or not.
Thanks for any help.
D[{f, g}, {{x, y}}]
is a simpler way to compute your Jacobian. $\endgroup$M
has symmetries according to which you can label the eigenvectors. Then the similarity transformation diagonalizingM
would be a symmetry operation parametrized byx
andy
and could be written down independently. It's impossible to say anything else in the absence of more information aboutM
. $\endgroup$