MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: vertical lines in plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94166] Re: [mg94100] vertical lines in plot
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Sat, 6 Dec 2008 06:15:16 -0500 (EST)
  • References: <200812051028.FAA24836@smc.vnet.net>

Cristina Ballantine wrote:
> In plotting the inverse image of the unit circle under the function B 
> below, I get all kinds of vertical lines. They are obviously jump 
> discontinuities, very likely caused by choices of branch cuts. I there any 
> way of getting rid of the vertical lines without redefining the brunch 
> cuts? I looked at the value of different solutions in sol4 close to a 
> point of discontinuity and it looks like the order of the solutions is 
> switched when t gets to that point. I am not sure if this is just a 
> coincidence. I also tried ExclusionsStyle->Red but there don't seem to be 
> any exclusions. 
> 
> 
> alpha := Pi/3
> r := 2/3
> a := r*Exp[I*alpha]
> n := 3
> 
> B[z] := 1/(z^n)*((Conjugate[a]/a)*(a^2 - z^2)/(1 - (Conjugate[a])^2*z^2))^n
> 
> sol4 := Solve[B[z] == Exp[I*t], z]
> 
> ParametricPlot[Evaluate[{Re[z], Im[z]} /. sol4], {t, 0, 2 Pi}, PlotRange -> All]
> 
> Best regards,
> 
> Cristina

One way would be to go into the Graphics object and remove the (near) 
vertical segments.

After long discussion with Maxim Rytin, we now know how to do this 
during (rather than after) generation of the plot. The issue is to 
locate where parametrized root objects cross over in their real parts, 
because that's when imaginary parts get swapped (or rather, the vertical 
lines arise from root objects switching places).

We will define some auxiliary functions that require a numeric argument.

f[tt_?NumberQ, j_Integer] := f[tt, j] = (z /. sol4[[j]]) /. t -> tt

froots = Table[f[tt, j], {j, 9}]
pairs2 = Subsets[froots, {2}];

x[tt_?NumberQ, j_Integer] := x[tt, j] = Re[z] /. sol4[[j]] /. t -> tt
y[tt_?NumberQ, j_Integer] := y[tt, j] = Im[z] /. sol4[[j]] /. t -> tt

Now we use, for exclusions, places where a pair of differences of 
imaginary parts changes sign (this needs to be posed as claiming they 
are equal, although in fact they are not). Also we insist that real 
parts be almost equal, so that we do not inadvertantly remove values of 
t for which there happen to be a pair with imaginary parts that cross at 
a common value of t, even though real parts may be separated and hence 
the pair poses no threat of a jump.

Finally I note that we need to crank PlotPoints fairly high. At lower 
values it seems that a handful of vertical jumps will persist.

Quiet[ParametricPlot[Evaluate[Table[{x[tt, j], y[tt, j]}, {j, 9}]],
   {tt, 0, 2 Pi}, PlotRange -> All, PlotPoints -> 220,
   Exclusions ->
    Map[{Im[#[[1]]] - Im[#[[2]]] == 0,
       Abs[Re[#[[1]]] - Re[#[[2]]]] < .004} &, pairs2]]]

An entirely different approach to this might be to set up numeric 
differential equations, using nine different initial conditions, in an 
effort to track nine curves numerically.

Another approach might be to use ListPlot, with Joined set to False. 
Then figure out how to join by finding four nearest points to any given 
point on the curve. If it is a "safe" point, the nearest will be on the 
same segment of curve, so you can readily figure out who is your 
successor, given you know which was your predecessor. Else your 
successor is the one that maintains closest approximate derivative as 
did the predecessor, and the others are on a crossing piece of curve. 
This has its problems, in cases of (approximate) tangential crossing, 
multiple (more than two) segments crossing (approximately) at one point, 
or too many points sampled on one such curve segment relative to the 
other (so that none of the nearest points is the correct successor). 
Given the complications, I'd opt for solving numeric ODEs before trying 
this.

Daniel Lichtblau
Wolfram Research



  • Prev by Date: Re: Dynamic Show in Manipulate
  • Next by Date: RE: Re: Mathematica 5,6,7 WeatherData, CityData
  • Previous by thread: vertical lines in plot
  • Next by thread: Re: vertical lines in plot