5

My understanding is that Mathematica 11 Plot can now handle singularities automatically when plotting. identify-types-of-singularities-and-discontinuitie

I found an a function where Mathematica 11.0.1 gives a 1/0 error message. But still the plot is generated. Here it is 1/(Tan[1/t])

f = 1/Tan[1/t];
Plot[f, {t, - Pi/2, Pi/2}, 
 ExclusionsStyle -> {None, Directive[Red, AbsolutePointSize[5]]}]

Mathematica graphics

It is having hard time with 1/Tan[1/t] The singularities for this function are (using function that finds these, thanks to Edmund and Carl Woll from does-mathematica-have-a-function-to-find-all-singularities-of-an-expression)

singularityDomain[f_, x_] := Module[{res = FunctionDomain[f, x]}, 
  Reduce[! res] /; ! MatchQ[res, _FunctionDomain]]

Clear[x]
singularityDomain[1/Tan[1/x], x]

Mathematica graphics

Is this known, is this a bug?

Nasser
  • 143,286
  • 11
  • 154
  • 359

2 Answers2

10

This is a known bug introduced in 11.0 with the improvements to the Exclusions code. One workaround is

Plot[1/Tan[1/t], {t, - Pi/2, Pi/2}, Exclusions -> None]

eliminates the message but removes the benefits of Exclusions. A better alternative is to specify the Exclusions yourself,

Plot[1/Tan[1/t], {t, - Pi/2, Pi/2}, Exclusions -> {Tan[1/t] == 0}]
rcollyer
  • 33,976
  • 7
  • 92
  • 191
4

Recommend that you avoid any region where you know that a function becomes infinitely dense.

f[t_] = 1/Tan[1/t];

Manipulate[
 reg = ImplicitRegion[
   (ts && -max < t < -min) || min < t < max, t];
 Plot[f[t], t ∈ reg,
  PlotPoints -> 100,
  MaxRecursion -> 15],
 {{ts, True, "two-sided"}, {True, False}},
 {{min, 0.025}, 0.001, 0.1, Appearance -> "Labeled"},
 {{max, Pi/2}, 1.1 min, Pi/2, Appearance -> "Labeled"}]

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198