5
$\begingroup$

How can I omit vertical lines in below output? They should not be present in the output and I don't know why does Mathematica show them. One reason could be: functions I am plotting are not Continuous functions. But even in this case, vertical lines shouldn't be present. This is the code which I am using:

r = 2;
d = 1;
dc = 1;
e = 2;
l = 1;
xr = 0;
z = -4;
dk = 1;
A = -1;
ro = 1;
v = 1;
g = 1;
xt = 0;
p1 = Plot[
    Sinh[
     1/2 Log[(1/
           4 (E^(-I t) + E^(I t))^2 (2 r - 3 e l ro + 
             1/2 A e (E^(-2 I t) + E^(2 I t)) l ro)^2 + 
          1/(dk l)  E^(I t))^2 (2 r - 3 e l ro + 
               1/2 A e (E^(-2 I t) + E^(2 I t)) l ro)^2 + 
            1/(dk l)
              4 (1/2 dk e (E^(-I t) - E^(I t))^2 l^2 r ro + 
                1/4 A dk e E^(-4 I t) (-1 + E^(2 I t))^2 (1 + E^(
                   4 I t)) l^2 r ro ]], {t, 0, 
    Pi}, PlotStyle -> ({Blue} & /@ {Large, Medium})];
Show[p1, p2]
$\endgroup$
5
$\begingroup$

Those are probably precision artifacts caused by a denominator in a complicated fraction. Let's define your function:

foo[t_?NumericQ] := 1/(4 l ro) I ...

and investigate it:

{plot, {data}} = Plot[
  foo[t], {t, .9, 1.2}, EvaluationMonitor :> Sow[{t, foo[t]}]
] // Reap;

Select[data, Positive@Chop@#[[2]] &]

{{1.03468, 0.236293}, {1.05918, 0.250562}, {1.16303, 0.303766}, {1.1694, 0.306664}, {1.16009, 0.302416}, {1.19671, 0.318612}, {1.15243, 0.298852}, {1.17089, 0.307335}, ...

Chop @ foo[1.0346814388488432`]

0.236293

Maybe simplification can help:

foo[t_?NumericQ] := Evaluate @ FullSimplify[1/(4 l ro) I ...

Plot[foo[t], {t, 0, Pi}, PlotRange -> All]

enter image description here

It did :)

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