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[ ...

equation solving - Invert and fit implicitly defined curve

I need to fit an implicitly defined curve. I thought I could get some data out of Solve , and then using FindFit . Therefore, I would like to find the relation the parametric curve defined by $F(x,y)=0$: Solve[-(1/2) + 1/2 (0.41202 BesselK[0, 0.1 Sqrt[x^2 + y^2]] + (0.101483 x BesselK[1, 0.1 Sqrt[x^2 + y^2]])/Sqrt[x^2 + y^2]) == 0, y] But I can't get an output: Solve was unable to solve the system with inexact coefficients or the system obtained by direct rationalization of inexact numbers present in the system. Since many of the methods used by Solve require exact input, providing Solve with an exact version of the system may help. >> Edit: In particular, I would like to fit the data coming from the curve with the expression of another curve, and not with a function $f(x)$. In particular, since this clearly looks like a cardioid , I would like it to fit to something like it. What other strategies could I try?

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...