#252 plot2d evaluates outside range

closed
Lisp Core (471)
5
2003-05-25
2003-03-11
No

plot2d evaluates the function being plotted outside the
given range.

Try:

f(x):= if (x>1) then 0 else x^2$

plot2d(f,[x,0,1])

The plot shows the function dropping to 0 at x=1+eps.

This is bad for three reasons:

1) I explicitly asked for the range [0,1]. I do not want to
see the behavior for x>1.

2) I don't want the y-range to be distorted by an outlier at
x=1+eps.

3) the function may not be well-defined, and may cause
errors, outside the range I gave. (This is how I
discovered the issue.)

Plot2d also evaluates the function at twice as many
values as it uses (to check for smoothness) -- I'd think
we could do better than that, but maybe not.

Discussion

  • Raymond Toy

    Raymond Toy - 2003-04-03

    Logged In: YES
    user_id=28849

    I agree. This is very annoying.

    I think the reason is due to round off and the way extra
    samples are taken.

    I have a fix for this so we don't go outside the range, and
    every computed point is used in the plot instead of throwing
    away half the points.

    Needs work.

    I think we should give up on being smart.

     
  • Raymond Toy

    Raymond Toy - 2003-04-03
    • labels: --> Lisp Core
    • assigned_to: nobody --> rtoy
     
  • Raymond Toy

    Raymond Toy - 2003-05-25

    Logged In: YES
    user_id=28849

    Should be fixed now.

     
  • Raymond Toy

    Raymond Toy - 2003-05-25
    • status: open --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks