MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Plotting discontinuities using Exclusions

  • To: mathgroup at
  • Subject: [mg122748] Plotting discontinuities using Exclusions
  • From: John Accardi <johnaccardi at>
  • Date: Wed, 9 Nov 2011 06:25:48 -0500 (EST)
  • Delivered-to:

Goal: Display the definition of a rational function in factored form
to better see points of discontinuities, like holes and then plot
the function showing the hole.

Example 1:

The following does the graph correctly, showing a gap at x = 2 but
requires an undesirable function definition (I want to specify
the numerator factored).

f = (x^2 - 2 x)/(x - 2)

(-2 x + x^2)/(-2 + x)

Plot[f, {x, 0, 4}, Exclusions -> Reduce[Denominator[f] == 0, x]]

Example 2:

More desirable is to show the function with numerator factored so
students can see the zero of the bottom being the same as the zero
in the top for the hole.  For example, the following shows the function 
as desired but the graph then does not show the gap for the hole:

f = x (x - 2)/(x - 2)


Plot[f, {x, 0, 4}, Exclusions -> Reduce[Denominator[f] == 0, x]]

I suspect that Mathematica does the cancellation (outputting x) and 
loses sight of the discontinuity for the plot.


How can I use the function definition of Example 2 and the plot output
of Example 1 in one sequence?  (I want to prevent the simplification
Mathematica does when processing the function definition.)

Thanks for any insights.

  • Prev by Date: Re: FinancialData - how to find ticker symbols?
  • Next by Date: Graphics << Implicit vs ContourPlot
  • Previous by thread: Re: Change $UserBaseDirectory
  • Next by thread: Re: Plotting discontinuities using Exclusions