# Is there any way to reveal a removable singularity in a plot? [duplicate]

Let's say we have a function $f(x)=\dfrac{2^x-2}{x-1}$. The graph of the function in Mathematica looks like this:

The function in question is obviously not continuous at $x=1$, but that doesn't show in the plot.

Is there an option to make Mathematica draw a hole at those points where a function is discontinuous, and if so, can I make this the default option?

• If you define it to be equal to its limit, it is in fact continuous in 1. The left and right limits exist and are equal. Commented Jul 12, 2015 at 21:22
• You could tell MMA manually where it is also Plot[f[x], {x, -10, 10}, Exclusions -> {x == 1}, ExclusionsStyle -> {Disk[], PointSize -> 0.015}] Commented Jul 12, 2015 at 21:23
• FunctionDomain can be useful to try to detect points like these. Generally, I don't think there's a good automatic and reliable way to detect such points though. Commented Jul 12, 2015 at 21:26
• @Cristopher "But f(1) is not defined" <-- it is not a good idea to treat Mathematica as a mathematician. Computer algebra systems will readily simplify things such as ((x - 1) (x - 2))/(x - 1) and won't care about the fact that technically that function should be undefined at x==1. Trying to handle these details would make them much too impractical and probably slow. The conclusion is: it is up to you do decide whether you consider that function defined at x==1 or not, in the strict mathematical sense, and keep this in mind during symbolic manipulations. Mathematica will ignore ... Commented Jul 12, 2015 at 22:02
• Related, possible duplicates: (6), (5770), (11361) Commented Jul 13, 2015 at 17:11

You can combine parts of @Julian comment and @Szabolcs comment in the original post to have it marked automatically.

f[x_] := (2^x - 2)/(x - 1)

Plot[f[x], {x, -10, 10},
Exclusions -> {Reduce[! FunctionDomain[f[x], x]]},
ExclusionsStyle -> {Disk[], PointSize -> 0.015}]


The inequalities that are returned by FunctionDomain negated to get the region not in the function's domain. The Reduce is used to combine inequalities where needed. Exclusions prevents points in the region from being plotted and ExclusionsStyle marks the points.

Hope this helps.

## Update

Try it with Manipulate.

Manipulate[
Plot[h[x], {x, -10, 10},
Exclusions -> {Quiet@Reduce[! FunctionDomain[h[x], x]]},
ExclusionsStyle -> {Disk[], PointSize -> 0.015},
PlotRange -> {{-10, 10}, Automatic}],
{{c, 1}, -9.5, 9.5},
Initialization :> {h[x_] := (2^x - 2)/(x - c);},
TrackedSymbols :> {c}]

• Nice! Thank you very much :) Thanks everyone who commented, too. Commented Jul 13, 2015 at 1:51
• Just a comment on ExclusionsStyle -> {Disk[], PointSize -> 0.015}: Disk[] doesn't do anything here, this might as well be ExclusionsStyle -> {None, PointSize -> 0.015}. The first items sets the style of the inside of the exclusion and the second one sets the boundaries, check e.g. Plot[HeavisideTheta[x - 1], {x, 0, 2}, ExclusionsStyle -> {Green, Directive[Red, PointSize[0.02]]}]. Here the inside is infinitely small so it's not visible. Commented Jul 13, 2015 at 6:10
• Now tweak the style to draw a hollow circle in the same color as the graph, instead of a solid black dot, and you'll have a +1 from this Mathematica newbie. :) Commented Jul 13, 2015 at 8:47
• @IlmariKaronen See the answer, mathematica.stackexchange.com/a/5779, by Jens for the solution you request. Commented Jul 13, 2015 at 17:09