3
$\begingroup$

How can I get rid of red vertical line in below plot? Could any onehelp me?

x = 0.1;
tr = -0.0;
dp = -0.2;
xr = -0;
f = dp Cos[2 theta] + tr;
G = 8 I; 
inside = (xr + G dp x Cos[theta] Sin[theta]^2)/f^2 + (1 - 2 tr /f)^2;
lambda1 = f (1 + inside^0.5); lambda2 = f (1 - inside^0.5);
qq1 = Plot[Re[lambda1], {theta, 0, Pi}, 
   PlotStyle -> ({Red, Dashing[#]} & /@ {Large, Medium})] ;
qq2 = Plot[Re[lambda2], {theta, 0, Pi}, 
   PlotStyle -> ({Red, Dashing[#]} & /@ {Large, Medium})];
$\endgroup$
  • $\begingroup$ See this question and this $\endgroup$ – K.J. Nov 23 '17 at 19:48
  • 1
    $\begingroup$ How can I get rid of red vertical line in below plot? what vertical line? I do not see one. Could you post screen shot showing what you get? here is screen shot from my PC. 11.2 on windows !Mathematica graphics $\endgroup$ – Nasser Nov 23 '17 at 19:48
  • 1
    $\begingroup$ I don't see a vertical line either!? I am using MMA 11.2 on Mac OS 10.11.6. Also, can not see vertical line using MMA 11.1.1 on Mac OS 10.11.6 $\endgroup$ – Joseph Nov 23 '17 at 19:50
  • $\begingroup$ I can see the vertical lines in Mathematica 10.2. $\endgroup$ – K.J. Nov 23 '17 at 19:51
  • 1
    $\begingroup$ @Nasser. Discontinuity exclusion plotting has gotten smatter in recent versions of Mathematica. OP probably using older version. $\endgroup$ – m_goldberg Nov 23 '17 at 19:51
2
$\begingroup$

EDIT: Solution for version 10.3.1

$Version

(* "10.3.1 for Mac OS X x86 (64-bit) (December 9, 2015)" *)

x = 1/10;
tr = 0;
dp = -1/5;
xr = 0;
f = dp Cos[2 theta] + tr;
G = 8 I;
inside = (xr + G dp x Cos[theta] Sin[theta]^2)/f^2 + (1 - 2 tr/f)^2;

Separate lambda1 into its Re and Im components

lambda1 = f (1 + inside^(1/2)) // 
    ComplexExpand[#, TargetFunctions -> {Re, Im}] & // Simplify;

Extracting the Re component

lambda1Re = lambda1 /. I -> 0;

Use FunctionDomain to determine the values for the Exclusions

FunctionDomain[{lambda1Re, 0 <= theta <= Pi}, theta] //
 Simplify[#, 0 <= theta <= Pi] &

enter image description here

lambda2 = f (1 - inside^(1/2));

qq = Plot[{Re[lambda1], Re[lambda2]}, {theta, 0, Pi}, 
     PlotStyle -> ({#, Dashing[Large]} &) /@ {Red, Blue}, 
  Exclusions -> {-2*ArcTan[1 - Sqrt[2]], 2*ArcTan[1 + Sqrt[2]]}]

enter image description here

$\endgroup$
1
$\begingroup$

At least for the first plot qq1 you can find coordinates of discontinuities

root1 = theta /. FindRoot[Re[lambda1], {theta, 0.8}]
root2 = theta /. FindRoot[Re[lambda1], {theta, 2.4}]

and use Exclusions to get rid of the vertical lines

qq1 = Plot[Re[lambda1], {theta, 0, Pi}, 
      PlotStyle -> ({Red, Dashing[#]} & /@ {Large, Medium}), 
      Exclusions -> {{theta == root1}, {theta == root2}}];

However I could not find roots for Re[lambda2]...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.