9
$\begingroup$

I'm building a program that does 2D graphing, and was wondering: How can I determine the default zoom level and x/y extents to display on screen, in such a way as to maximise the 'interesting' parts of a function that are shown?

"Interesting parts" would include:

  • Minimums/maximums/plateaus,
  • Parts of the space where you can actually see the function,
  • Roots,
  • Discontinuities,
  • and anything else that helps understand what the function looks like and what it does.

I am not necessarily looking for a perfect solution, just something that works well for most common cases, hopefully without having to solve the equation the user entered.

Is there a general method I can use? Or a book/reference that might help? Thanks!

  • 0
    The best output I've seen of such an algorithm is what [Wolfram Alpha](http://www.wolframalpha.com/) does when graphing functions. I assume they have all sorts of special cases for most common expressions.2012-03-29

2 Answers 2