Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

RE: Plotting problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35349] RE: Plotting problem
  • From: "David Park" <djmp at earthlink.net>
  • Date: Tue, 9 Jul 2002 06:48:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Steven,

The Mathematica Plot routine is not quite as sophisticated as you were
hoping for. For 2D plots Mathematica uses an adaptive algorithm that samples
the points and tries to pick points to minimize the bending of the curve
between adjacent pairs of points. So, chances are that it will never even
hit the singular points in your function. So you just get a straight line
because that is what your curve is except for the singular point. If, by
chance, Mathematica does hit a singular point it will issue a warning
message.

You have to find the singular points yourself and add them to the plot. You
could do this using Epilog.

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

Plot[f[x], {x, -2, 3},
    Epilog -> {AbsolutePointSize[4], Point[{1, Limit[f[x], x -> 1]}]}];

In more complicated cases, you could write a routine to find the zeros in
the denominator. (Just to keep things short I am restricting to cases where
they also occur in the Numerator. We should really add code to check for
this.)

f[x_] := (24*x - 50*x^2 + 35*x^3 - 10*x^4 + x^5)/
   (3 - 4*x + x^2)

Solve[Denominator[f[x]] == 0] // Flatten
pointlist = Limit[{x, f[x]}, #] & /@ %
{x -> 1, x -> 3}
{{1, 3}, {3, -3}}

Plot[f[x], {x, -2, 4},
    Epilog -> {AbsolutePointSize[5], Point /@ pointlist}];

In my answers I have used the Limit routine, pure functions (Function) and
the Map command, which you should look up in Help.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/



> From: Steven Hodgen [mailto:shodgen at mindspring.com]
To: mathgroup at smc.vnet.net
>
> Hello,
>
> I'm a total Mathematica newbie, and I'm trying to get it to plot a simple
> rational eq. in such a way that it indicates where missing points are.
> Since I'm not sure how you'd prefer the eq. expressed, I've typed
> in in the
> parents so there can be no question of where the denominator is,
> as well as
> a cell expression.
>
> (3 x^2 - 5 x + 2)/(x - 1)
>
> Cell[BoxData[
>     FractionBox[
>       RowBox[{
>         RowBox[{"3",
>           SuperscriptBox["x", "2"]}], "-",
>         RowBox[{"5", "x"}], "+", "2"}],
>       RowBox[{"x", "-", "1"}]]], "Input"]
>
> When I Plot[], this is just draws a straight line.  There is no indication
> where the hole is. How can I get this "fully correct" graph?
>
> Thanks
> --Steven
>
>
>



  • Prev by Date: RE: Strange Behavior of AxisOrigin
  • Next by Date: Re: entering problem
  • Previous by thread: Re: Plotting problem
  • Next by thread: Re: Plotting problem