On Thu, 2003-04-03 at 12:19, Raymond Toy wrote:
> I think I have a solution for 710677 and a possible solution for
> 694770.
Very good.
> But before I go further, I'm soliciting comments.
>
> plot2d tries to be smart and checks for smoothness and adaptively
> increases the sampling rate if the function is not smooth enough.
> Basically if |dy| > |dx| , we add extra sampling points. However, in
> the 694770, dy/dx is 100 or more, so we add about 100 times more
> samples.
It seems to me that this solution is obviously incorrect. It assumes
that x and y are of similar magnitude.
I haven't thought about this problem hard, but it seems to me that the
first derivative isn't even the right thing to consider -- after all, we
plot in straight line segments. The second derivative seems like a more
relevant quantity.
> One solution is the check is to compute each dy is relatively
> constant, we don't try to extra samples. This should make plotting
> fast.
That would be better, but...
> Another solution is to give up trying to be smart. Just plot the
> points according to the number of grid points selected, with no
> adaptation. If the plot doesn't look right, let the user increase the
> grid points or decrease the range.
>
> What do you think about this last alternative? Or should we try to be
> smart about plotting?
I think you are asking the right question. When the dumb approach fails,
it is obvious why and obvious what to do to fix it. Being smart about
plotting is only useful if we are smart enough about it. I am not yet
convinced that we are. What happens if you plot sin(1/x) near x=0?
--Jim