# How to detect an asymptote

So I'm trying to write a program to draw graphs that are entered by the user. The way I draw them is by finding y values at a number of x values across the graph and then connecting them by lines. However, some graphs (like tan(x)) have asymptotes, so the bottom and top values are connected. Is there any mathematical way to detect whether there is a asymptote at a point or not?

-
You could try run the user input through some symbolic analysis program and get the "real" asymptotes, but for your program it will probably be better for you to apply some heuristic such as calling an asymptote anywhere you find the "derivative" ($\frac{\Delta y}{\Delta x}$) is larger than some threshold and the nearby values seem large. –  Alfonso Fernandez Mar 16 '14 at 22:06
I guess that seems like a good idea –  user1152717 Mar 16 '14 at 23:46