Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm currently creating a program to plot simple graphs in 2D. In order to draw those properly I have to know if a function graph is continuous between 2 points on the graph.

Assuming the graph for f(x)=tan(x) and two points on the graph P1(1,tan(1)) and P2(2,tan(2)). Is there an algorithmic way to tell if the graph is continuous for 1 <= x <= 2?

thanks

share|improve this question
1  
The famous $\epsilon \text{,} \delta$ method is the algorithm you seek. math.stackexchange.com/search?q=epsilon+delta –  Arjang Dec 22 '10 at 10:47
1  
In floating point arithmetic... it's hard to tell. There is the example $f(x)=3x^2+\frac{\ln((\pi-x)^2)}{\pi^4}+1$. The best you can do is that during the plotting process, ensure that either the slope or distance between two consecutive points on the graph is not "too big". –  J. M. Dec 22 '10 at 10:48
1  
You might also want to look into implementing adaptive subdivision to ensure that glaring discontinuities are easily caught. –  J. M. Dec 22 '10 at 10:59

1 Answer 1

up vote 4 down vote accepted

You can use interval arithmetic to compute reliable plots. See for instance this paper: Jeff Tupper, Reliable Two-Dimensional Graphing Methods for Mathematical Formulae with Two Free Variables, SIGGRAPH 2001. The excellent GrafEq software uses this technique.

share|improve this answer
    
Interval arithmetic is the "guaranteed correct" way of catching discontinuities in a plot; it's not (very) fast, but if the functions to be plotted are simple enough, it's very reliable. –  J. M. Dec 22 '10 at 11:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.