       Similar matrices->similar eigenvectors?

• To: mathgroup at smc.vnet.net
• Subject: [mg80371] Similar matrices->similar eigenvectors?
• From: Yaroslav Bulatov <yaroslavvb at gmail.com>
• Date: Mon, 20 Aug 2007 03:38:50 -0400 (EDT)

```In the default implementation of "Eigenvectors", the orientations seem
arbitrary. Changing the matrix slightly could end up flipping the
eigenvectors 180 degrees. A simple fix of telling eigenvectors to
always be on one side of some arbitrary plane doesn't work because it
will flip eigenvectors that are near-parallel to the plane with small
changes in the matrix.

I'm trying to make a demo of multi-dimensional scaling, and the result
is that as I drag the slider, the points flip back and forth
erratically.

Basically I'd like to get a function g[mat] which returns eigenvectors
of mat, and is continuous, what is the simplest way of achieving this?

-----------
distances2points[d_] := (n = Length[d];
(*nxn matrix of ones*)j = Table[1, {n, n}];
(*centering matrix*)h = IdentityMatrix[n] - j/n;
a = -d*d/2;
b = h.a.h;
(*Eigenvectors are returned with arbitrary orientation,
orient them to point in the same halfplane*)
orient[v_, orientvec_] := ((*1,1,1,1 halfplane is often ambiguous,
use random halfplane*)(*SeedRandom;
orientvec=RandomReal[{0,1},Length[v]];*)
If[Round[v, .1].orientvec > 0, -v, v]);
vecs = Eigenvectors[b][[1 ;; 2]];
(*vecs=orient[#,b[]]&/@vecs;*)
vals = Eigenvalues[b][[1 ;; 2]];
Point[Re[#]] & /@ Transpose[vecs*Sqrt[vals]])
Clear[d1, d2, d3, d4, d5, d6]; limits = {{{d1, 0, "1->2"}, 0,
1}, {{d2, 0, "1->3"}, 0, 1}, {{d3, 0, "1->4"}, 0,
1}, {{d4, 0, "2->3"}, 0, 1}, {{d5, 0, "2->4"}, 0,
1}, {{d6, 0, "3->4"}, 0, 1}};
Manipulate[
Graphics[distances2points[{{0, d1, d2, d3}, {d1, 0, d4, d5}, {d2, d4,
0, d6}, {d3, d5, d6, 0}}], PlotRange -> {{-1, 1}, {-1, 1}}],
Evaluate[Sequence @@ limits], LocalizeVariables -> False]

```

• Prev by Date: Re: Mathematica 6 "save as PDF" page size issues
• Next by Date: But is it worth to use Mathematica ?
• Previous by thread: Re: Manipulate with Wrapping SetterBars
• Next by thread: Re: Similar matrices->similar eigenvectors?