DISCONTINUITIES IN A CURVE



>>>>> "Rupert" == Rupert Swarbrick <rswarbrick at gmail.com> writes:

    Rupert> Raymond Toy <toy.raymond at gmail.com> writes:
    >>>>>>> "Rupert" == Rupert Swarbrick <rswarbrick at gmail.com> writes:
    >> 
    Rupert> Raymond Toy <toy.raymond at gmail.com> writes:
    >> >> This shouldn't be a problem with the current plot2d.  It uses an
    >> >> adaptive plotting algorithm to use more points where the curve is
    >> >> changing too fast.  If, by chance, plot2d tries to evaluate f(1),
    >> >> maxima catches that error and pretends (I think) that there is a
    >> >> discontinuity at that point and tries to add more points in the
    >> >> neighborhood to get a better plot.
    >> >> 
    >> >> Of course, if the discontinuity is very narrow and the number of
    >> >> initial sample points is too sparse, plot2d will never see it and hence
    >> >> never plot it.  No surprise there.
    >> >> 
    >> >> The adaptive plotter isn't used for any other kind of plot such as
    >> >> parametric plots, unfortunately.
    >> 
    Rupert> Well, at least on my machine,
    >> 
    Rupert> f(x) := signum(x) * abs(x)^(-1/n)$
    Rupert> plot2d(f(x), [x, -1, 1.1]), n=10;
    >> 
    Rupert> displayed the expected behaviour. Maybe I've misunderstood what's going
    Rupert> on.
    >> 
    >> Ok, I'm not sure what you expect the behavior to be.  With our
    >> example, I see a curve drawn on the y-axis from about y=-2.25 to
    >> y=2.25.  If I change the plot limits to [x, -1,1], I see the same
    >> curve, except there is no line drawn on the y-axis.
    >> 
    >> Which of these is your expected behavior?  Or were you expecting
    >> something else?
    >> 
    >> Ray

    Rupert> My point was this is a (simple) example of a function where we might be
    Rupert> clever enough to spot a point of discontinuity and not join up the
    Rupert> points at "x = -epsilon" and "x = epsilon".

I think your example would be kind of hard to determine that there's a
discontinuity.

    Rupert> I agree that there's no way to do that with a black-box function, but
    Rupert> most of the time, users will be plotting things like rational functions
    Rupert> so maybe we can do better. I'll have a proper look at the "honest
    Rupert> plotting" paper that Richard Fateman pointed us to before I say much
    Rupert> more though: presumably people have thought about this harder than I!

Rational functions should be doable since allroots/bf_allroots can
(usually) find all of the roots of the denominator.

There's always the question about removable singularities too, like
sin(x)/x.  Maxima warns that the expressioin is non-numeric somewhere.

I think I'm rather pragmatic about plotting.  If it doesn't look
right, plot more points, or change the plot limits to focus on the
area.  If that doesn't work, break out the rest of the tools available
in maxima and actually do some symbolic analysis of the
expression. :-)

Ray