1
$\begingroup$

I'd like to ask you about the way to plot discontinuous function $\frac{2-x}{|x-2|}(x + 2)$.

What Wolfram Alpha produces:

enter image description here

"DIY" version is below. How to achieve similar effect in Mathematica?

enter image description here

$\endgroup$
0

1 Answer 1

4
$\begingroup$

Use Exclusions and Epilog.

Plot[(2 - x) (x + 2)/Abs[x - 2], {x, 0, 4}, Exclusions -> {2}, Epilog -> {Red, Text[○, #] & /@ {{2, 4}, {2, -4}}}] 

or

Plot[f[x], {x, 0, 4}, Exclusions -> {2}, Epilog -> {Red, Text[○, #] & /@ { {2, Limit[f[x], x -> 2, Direction -> 1]}, {2, Limit[f[x], x -> 2, Direction -> -1]}}}] 

enter image description here

$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.