RE: ugly Plot Eigenvalues ?
- To: mathgroup at smc.vnet.net
- Subject: [mg39666] RE: ugly Plot Eigenvalues ?
- From: "David Park" <djmp at earthlink.net>
- Date: Sat, 1 Mar 2003 02:47:22 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Pavel,
Here is a routine from my DrawGraphics package that eliminates vertical
lines.
SplitLineOnSlope::usage =
"SplitLineOnSlope[slope] is a rule which will split any Line primitives
\
into multiple lines whenever two points give a slope whose absolute value is
\
greater than the specified slope";
SplitLineOnSlope[slope_] :=
Line[a_] :> Line /@ Split[a, (Abs[Divide @@ Reverse[#2 - #1]] < slope &)]
If you copy it into your notebook, you can then use it the following way...
m1 = {{8., 8, 7}, {0, 5, 5}, {8, 0, 0}};
m2 = {{6., 0, 6}, {10, 8, 3}, {5, 8, 6}};
Show[Graphics[
{(Plot[Evaluate[Re[Eigenvalues[m1 + w*m2]]], {w, -3, 3},
DisplayFunction -> Identity] // First) /.
SplitLineOnSlope[40]}],
Frame -> True,
ImageSize -> 500
Within DrawGraphics the plotting statement would be...
Needs["DrawGraphics`DrawingMaster`"]
Draw2D[
{Draw[Evaluate[Re[Eigenvalues[m1 + w*m2]]], {w, -3, 3}] /.
SplitLineOnSlope[40]},
Frame -> True,
ImageSize -> 500];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Pavel Pokorny [mailto:Pavel.Pokorny at vscht.cz]
To: mathgroup at smc.vnet.net
Dear Mathematica friends,
How can I plot Re Eigenvalues as a function of a parameter
without unwanted ugly connections between branches?
In the example (computed by Mathematica 4.2 for HP-UX PA-RISC)
m1={{8., 8, 7}, {0, 5, 5}, {8, 0, 0}}
m2={{6., 0, 6}, {10, 8, 3}, {5, 8, 6}}
Plot[Evaluate[Re[Eigenvalues[m1+w*m2]]], {w,-3,3}];
for w approximately -0.4 there is an unwanted vertical bar.
This is related to "ordering" of solutions to equation.
Is there a simple nice solution for this and related examples?
(taking exact numbers in the example above avoids the unwanted connection,
but this is not a good solution for a general machine precission problem)
--
Pavel Pokorny
Math Dept, Prague Institute of Chemical Technology
http://staffold.vscht.cz/mat/Pavel.Pokorny