Sign in to follow this  

Efficient graph plotting techniques

This topic is 2542 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everybody,

I've got a few questions concerning techniques to plot the graphs of functions.
I've written a bunch of libraries which can simplify algebraic equations and what not, and also evaluate user defined functions. When drawing these function however, I come accross several problems:

Right now I'm calculating a new y value say, every 3 pixels. This can take quite a while with longer functions, but still works rather fast since they are in RPN (postfix). Isn't there an easier/more efficient way to draw the graph? I imagine just calculating a few points and then interpolating the curve might work, but I don't know how prone to error that is.

I also have some problems when it comes to limits of functions. If I increase the step size dx for which I always calculate new y values, I might miss a limit, and the result of this can be seen in the second picture (the first picture is a close up):

http://i51.tinypic.com/2gu9px0.jpg

http://i55.tinypic.com/2vi2nw3.jpg

In the second pic, the curve should go all the way out of window, so I'd need to determine a value y1, which will serve as a sort of boundary, after which everything else is interpreted as +/-Infinity. Any ideas?

Cheers,
Chris

Share this post


Link to post
Share on other sites

This topic is 2542 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this