On Oct 16, 2009, at 1:17 PM, kcrisman wrote:

> On Oct 16, 2:29 pm, Francois Maltey <fmal...@nerim.fr> wrote:
>> Hello,
>>
>> Functions plot is fine with singular functions as
>>
>> plot (sin(1/x), x, 0, 5)
>>
>> Plot has also a symbolic option detect_poles=True.
>> But this option isn't designed for theses plots.
>> There are unpleasant vertical lines.
>>
>> plot (floor(10*x), x, 0, 2)
>> plot (x*floor(1/x), x, 0, 2)
>> plot (arctan ((tan(x)^2-1)/(2*tan(x)), x, 0, 2)
>
> These are cool examples!  I believe there is an 'exclude points'
> option in the pipeline, though I can't remember the Trac number.
>
>> I don't think it's too hard to compute about one function call per  
>> pixel,
>> and then the mathematic are more respected !
>
> Well, that's easier said than done - how many points is a pixel?  The
> plotting code doesn't say anything about pixels, I don't believe, and
> setting ridiculously large tolerances is kind of fun to understand how
> the code works.  In general this algorithm does pretty well, though
> plotting tan(x) is annoying still, if you want to fix that without
> using show options.
>
>> It's not pleasant to build a large list of points and then plot  
>> theses
>> points (and not the polygonal line) because the speed isn't  
>> constant for
>> any curves.
>
> I'm not sure what you mean.  Are you suggesting we use some sort of
> curved primitives?

One needs to be very careful with this, as an interpolated curve may  
give false maximums, etc. Safer to stay with lines--there should be  
enough of them that it looks smooth anyways.

Also, some functions are cheap to compute, but others not so much.

> A line with that many points is indistinguishable
> from a curve (which Archimedes wouldn't have liked, but some other
> Greeks argued), at least in a plot.
>
> I think the real issue is that you don't want (nearly) vertical lines
> in step-type functions, and this is a legitimate point of contention.
> I think that at least on this side of the pond, step functions with
> vertical lines are considered a legitimate representation of the
> function.  However, perhaps that should be revisited?  Certainly the
> graphs plot produces in such situations look like not the graphs of
> functions, in a technical sense.  However, note that the list of
> points almost assuredly does not actually violate the vertical line
> test!
>
> Opinions from others?

It's very difficult to (numerically) distinguish between

sage: plot(atan(x), (x, -1e6, 1e6))

and

sage: plot(floor(atan(x)), (x, -1e6, 1e6))

Also, the current behavior leads to more correct (IMHO) pictures of, say

sage: plot(sin(1/x), (x, -1, 1))

- Robert



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to