5
$\begingroup$

I'm trying to plot a function that doesn't have singular points, but the output displays a line-like disruption where the graph appears discontinuous. My code is here, and the output follows.

c = 2.78; q = 0.16; x0 = -2;
setting1 = {ClippingStyle -> None, ColorFunction -> "Rainbow", 
   Exclusions -> "Singularities", PlotRange -> Automatic, 
   PlotStyle -> Directive[Opacity[0.8], Thick, Red]};
Plot3D[
 -((Sqrt[c/q] (1 - Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))/(
   2 (1 + Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))) + (
  c (1 + Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))/(
  2 Sqrt[c/q] q (1 - Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))
 , {x, -2, 2}, {t, 0.1, 1},
 Evaluate[setting1],
 AxesLabel -> {"x", "t", "U", " "},
 PlotLabel -> "U"]

Unwanted line-like disruption

Upon setting Exclusions to 'None' these disruptions disappear. However, singular points then emerge in the form of pillars, which are also visually bad.

Exclusions to 'None'

So my question is, how to avoid these disruptions without showing singular points? I tried to set MaxRecursion and PlotPoints but it did not work.

$\endgroup$

1 Answer 1

9
$\begingroup$

Your function $-\frac{2 \sqrt{\frac{c}{q}} \tan \left(\frac{1}{2} \sqrt{\frac{c}{q}} (-c t+x+\text{x0})\right)}{\tan ^2\left(\frac{1}{2} \sqrt{\frac{c}{q}} (-c t+x+\text{x0})\right)-1}$ is singulaer if

1/2 Sqrt[c/q] (x - c t + x0) == Pi/4 (2 k - 1), Element[k,Integers]

c = 2.78; q = 0.16; x0 = -2;
setting1 = {ClippingStyle -> None, ColorFunction -> "Rainbow", 
   Exclusions -> 
    Table[ 1/2 Sqrt[c/q] (x - c t + x0) == Pi/4 (2 k - 1) , {k, -10, 
      10}]  , PlotRange -> Automatic, 
   PlotStyle -> Directive[Opacity[0.8], Thick, Red]};
Plot3D[-((Sqrt[
        c/q] (1 - Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))/(2 (1 + 
         Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))) + (c (1 + 
       Tan[1/2 Sqrt[c/q] (-c t + x + x0)]))/(2 Sqrt[
      c/q] q (1 - Tan[1/2 Sqrt[c/q] (-c t + x + x0)])), {x, -2, 
  2}, {t, 0.1, 1}, Evaluate[setting1], 
 AxesLabel -> {"x", "t", "U", " "}, PlotLabel -> "U" 
 ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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