RE: Re: Graphing Abnormalities of Functions

• To: mathgroup at smc.vnet.net
• Subject: [mg29557] RE: [mg29552] Re: Graphing Abnormalities of Functions
• From: "David Park" <djmp at earthlink.net>
• Date: Sun, 24 Jun 2001 22:10:15 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

Ryan,

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

This is one simple approach. Use Epilog to draw the circle after plotting
the function.

Plot[f[x], {x, 0, 5}, Epilog -> Circle[{1, 3}, 0.05],
AspectRatio -> Automatic, PlotRange -> {0, 7},
Axes -> True, AxesLabel -> {x, y},
PlotLabel -> "Function with Discontinuity",
ImageSize -> 350];

The only problem with the above is that the line is drawn through the circle
and for a really nice plot one would want an empty circle. Since the curve
is a straight line at 45 Degrees, we could plot the function in two
segments, up to the circle and beyond the circle. This is the standard
Mathematica way of doing it.

Block[{r = 0.05, \$DisplayFunction = Identity},
plot1 = Plot[f[x], {x, 0, 1 - r/Sqrt[2]},
Epilog -> Circle[{1, 3}, r]];
plot2 = Plot[f[x], {x, 1 + r/Sqrt[2], 5}]];
Show[plot1, plot2, AspectRatio -> Automatic,
PlotRange -> {0, 7}, Axes -> True,
AxesLabel -> {x, y}, PlotLabel ->
"Function with Discontinuity", ImageSize -> 350];

We used Block to temporarily suppress the display of the plots. The Show
statement will only use options from the first plot listed, so Epilog must
be put in plot1.

This could also be done in a slightly more natural manner with my
DrawingPaper package.

Needs["Graphics`DrawingPaper`"]

With[{r = 0.05},
Show[Graphics[
{Draw[f[x], {x, 0, 1 - r/Sqrt[2]}],
Draw[f[x], {x, 1 + r/Sqrt[2], 5}],
Circle[{1, 3}, r]}],
AspectRatio -> Automatic,
PlotRange -> {0, 7}, Background -> Linen,
{Axes -> True, AxesLabel -> {x, y},
PlotLabel -> "Function with Discontinuity",
ImageSize -> 350}]];

David Park

> From: Ryan R. Rosario [mailto:rrosario11 at my-deja.com]
To: mathgroup at smc.vnet.net
>
> Hi-
>
> Thanks for the response :-)
>
> By a hole, I mean a removable discontinuity in a graph. For example,
> the function ((x^2) + x - 2)/(x - 1) is discontinuous because when
> x=1, the function is undefined. I learned that this is called a
> "hole." Perhaps I am using the wrong terminology. If so, silly me LOL
> :-)
>
> In textbooks, this discontinuity is indicated by displaying a hollow
> circle at the point of discontinuity (hole).
>
> Is there a way to tell Mathematica to draw this circle at the point of
> discontinuity rather than simply display a break in the graph?
>
> Thanks Again,
> Ryan
>

• Prev by Date: How do I really get rid of previous results?
• Next by Date: Re: Equality question
• Previous by thread: Re: Re: Graphing Abnormalities of Functions
• Next by thread: .m file to C or Fortran source code