Skip to main content

matrix - How get eigenvectors without phase jump?



I'm using Eigenvectors to get the eigenvectors for some matrixes, but the eigenvectors seems to have some phase jump. Here is an example:


Say we have a 2 by 2 matrix {{2., Exp[I x]}, {Exp[-I x], 2.}} and x is a number. Now if we change x smoothly in some region, we would expect the eigenvector or eigenvalues changes smoothly. But in fact, we see that there are jumps.


eigenVects = 
Table[Eigenvectors[{{2., Exp[I x]}, {Exp[-I x], 2.}}][[1]] /. {a_, b_} -> {a/Sqrt[a^2 + b^2], b/Sqrt[a^2 + b^2]}, {x, π/2 + π/10, 3 π/2 - π/10, π/20}]

We then take the first eigenvector and plot it's real and imaginary part


Row[{ListPlot[Re@Transpose[eigenVects], Joined -> True, 
ImageSize -> 300, Mesh -> All],
ListPlot[Im@Transpose[eigenVects], Joined -> True, ImageSize -> 300,
Mesh -> All]}]


enter image description here


and we see the curves are not smooth but with some jumps in them. These jumps corresponding to a phase factor to the eigenvectors from the Eigenvectors function. Normally, an eigenvector times a phase factor would still be a eigenvector, but in my system, the uncontrollable phase factor from the Eigenvectors give me problems.


For comparison, we take the analytical solution of the eigenvectors for this 2 by 2 matrix


myEigenvectors[{{a_, b_}, {c_, d_}}] := Module[{C1, C2},
C1 = {-((-a + d + Sqrt[a^2 + 4 b c - 2 a d + d^2])/(2 c)), 1};
C2 = {-((-a + d - Sqrt[a^2 + 4 b c - 2 a d + d^2])/(2 c)), 1};
{C1/Norm[C1], C2/Norm[C2]}
]


and also plot the Re and Im part of the first eigenvector


eigenVects2 = 
Table[myEigenvectors[{{2., Exp[I x]}, {Exp[-I x], 2.}}][[
1]] /. {a_, b_} -> {a/Sqrt[a^2 + b^2],
b/Sqrt[a^2 + b^2]}, {x, π/2 + π/10,
3 π/2 - π/10, π/20}];

we see the curves are smooth.


enter image description here


So why there are these phase jumps in the results from Eigenvectors, and how to get the eigenvectors without the jumps? (For large matrix analytical solution is not practical.)




Answer



The phase (and length) of the eigenvectors is completely undetermined unless you specify extra conditions in addition to the eigenvalue equation. Given that you don't have any additional conditions, it's not surprising that there is no well-defined way to plot the real and imaginary parts of each eigenvector component.


A simple condition that makes the answer unique is to require that the first component of each eigenvector be real. Also, we can add the requirement of normalization.


Then the procedure would be as follows:


eigenVects = 
Table[Eigenvectors[{{2., Exp[I x]}, {Exp[-I x], 2.}}][[1]] /. {a_,
b_} -> {a/Sqrt[a^2 + b^2], b/Sqrt[a^2 + b^2]}, {x, Pi/
2 + Pi/10, 3 Pi/2 - Pi/10, Pi/20}];

eigenVects2 = Map[Normalize[#/#[[1]]] &, eigenVects];


Row[{ListPlot[Re@Transpose[eigenVects2], Joined -> True,
ImageSize -> 300, Mesh -> All],
ListPlot[Im@Transpose[eigenVects2], Joined -> True,
ImageSize -> 300, Mesh -> All]}]

plots


The blue lines (for the first component) show that the real part is constant due to normalization, and the imaginary part is zero at all times. There are no longer any phase jumps because the phase has been fixed.


You can come up with an arbitrary number of alternative conditions that would result in different plots.


Edit: Bloch sphere representation



The requirements of normalization and a real-valued first component provide us with two equations relating the $N$ complex components of a non-degenerate eigenvector. Each complex component is a pair of two real numbers. Therefore, we are left with $2N-2$ real numbers to parametrize the eigenvector with the given constraints.


For a two-dimensional vector space over the complex numbers (as in the question), we have $N=2$ and hence we need just two real numbers to identify an eigenvector. It is often convenient to represent such two-dimensional eigenvectors as points on a Bloch sphere. This works because the most general form of a vector satisfying the above constraints is


$$\left( \begin{array}{c} \cos\frac{\theta }{2}\\ e^{i \phi } \sin \frac{\theta }{2} \\ \end{array} \right)$$


with $0\le \phi<2\pi$ and $0\le\theta<\pi$, corresponding to the azimuthal and polar angle of a spherical coordinate system. These angles are the two real parameters I mentioned.


To visualize the list of eigenvectors, we can then trace the motion of the corresponding point on the Bloch sphere, instead of making plots of the eigenvector components as I did earlier. Here is a function that does this visualization:


ClearAll[blochSphere];
blochSphere[ket_] :=
Module[{v = Normalize[N[ket]], vN, θ, ϕ, pt},
vN = Chop[v Exp[-I Arg[First[v]]]];
θ = 2 ArcCos[First[vN]];

Ï• = Arg[Last[vN]];
pt = {Cos[ϕ] Sin[θ], Sin[ϕ] Sin[θ], Cos[θ]};
Graphics3D[{
{Opacity[.5], Sphere[]},
Riffle[
{Blue, Green, Red},
Map[
Arrow[Tube[1.3 {-#, #}]] &, IdentityMatrix[3]
]
],

{Gray, Tube[{{0, 0, 0}, pt}]}, {Glow[White], Sphere[pt, .05]},
Inset[
Framed[
MatrixForm[ket],
Background -> Directive[Opacity[.5], LightBlue],
RoundingRadius -> 5, FrameStyle -> None], pt, {-1.3, 0}]
},
Boxed -> False,
Background -> Darker[Gray], ViewPoint -> {2, 1, 2}
]

]

Apply it to a modified version of the eigenvector list from earlier:


eigenVects = 
Table[Eigenvectors[{{2., Exp[I x]}, {Exp[-I x], Cos[x]}}][[1]], {x,
0, 2 Pi - Pi/20, Pi/20}];

ListAnimate@Map[blochSphere, eigenVects]

animation



Here, I deliberately omitted any phase choice and normalization from the test vectors in eigenVects, because blochSphere is meant to do this automatically. It would for example depict the vectors {1,0} and {I, 0} in exactly the same way because of my requirement that the first component should be real. The vector {10,0} would also look the same because it only differs in its norm.


Comments

Popular posts from this blog

plotting - How to draw lines between specified dots on ListPlot?

I would like to create a plot where I have unconnected dots and some connected. So far, I have figured out how to draw the dots. My code is the following: ListPlot[{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4,13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full] I have thought using ListLinePlot command, but I don't know how to specify to the command to draw only selected lines between the dots. Do have any suggestions/hints on how to do that? Thank you. Answer One possibility would be to use Epilog with Line : ListPlot[ {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {1, 4}, {2, 5}, {3, 6}, {4, 7}, {1, 7}, {2, 8}, {3, 9}, {4, 10}, {1, 10}, {2, 11}, {3, 12}, {4, 13}, {2.5, 7}}, Ticks -> {{1, 2, 3, 4}, None}, AxesStyle -> Thin, TicksStyle -> Directive[Black, Bold, 12], Mesh -> Full, Epilog -> { Line[ ...

dynamic - How can I make a clickable ArrayPlot that returns input?

I would like to create a dynamic ArrayPlot so that the rectangles, when clicked, provide the input. Can I use ArrayPlot for this? Or is there something else I should have to use? Answer ArrayPlot is much more than just a simple array like Grid : it represents a ranged 2D dataset, and its visualization can be finetuned by options like DataReversed and DataRange . These features make it quite complicated to reproduce the same layout and order with Grid . Here I offer AnnotatedArrayPlot which comes in handy when your dataset is more than just a flat 2D array. The dynamic interface allows highlighting individual cells and possibly interacting with them. AnnotatedArrayPlot works the same way as ArrayPlot and accepts the same options plus Enabled , HighlightCoordinates , HighlightStyle and HighlightElementFunction . data = {{Missing["HasSomeMoreData"], GrayLevel[ 1], {RGBColor[0, 1, 1], RGBColor[0, 0, 1], GrayLevel[1]}, RGBColor[0, 1, 0]}, {GrayLevel[0], GrayLevel...

list manipulation - Selecting multiple columns from a matrix?

Sample data: data = { {{2013, 1, 1}, 24.13, 167.67, 231.82}, {{2013, 1, 2}, 32.15, 170.92, 225.99}, {{2013, 1, 3}, 35.43, 172.68, 221.67}, {{2013, 1, 4}, 36.73, 173.05, 218.32}, {{2013, 1, 5}, 58.19, 165.96, 197.05}, {{2013, 1, 6}, 69.99, 163.50, 187.52}, {{2013, 1, 7}, 71.37, 154.21, 175.58}, {{2013, 1, 8}, 72.51, 149.66, 163.25}}; I want a DateListPlot with three graphs, so for a matrix formed by columns 1 and 2, one for columns 1 and 3, and 1 for columns 1 and 4. At the moment I'm using this code: data2 = Transpose[{data[[All, 1]], data[[All, 2]]}]; data3 = Transpose[{data[[All, 1]], data[[All, 3]]}]; data4 = Transpose[{data[[All, 1]], data[[All, 4]]}]; DateListPlot[{data2, data3, data4}, Joined -> True, Filling -> {3 -> {1}}] but I have a hunch that this can be done more efficiently. I don't like the Transpose s in particular. Any ideas? edit (for extra credit) What if I need to multiply the second column by 2, which in my solution is simp...