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 $x=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?

There is a limit test at a point $x=a$. So if $\lim_{x\to 0}f(x)=\pm\infty$, then you say $x=a$ is a vertical asymptote. 
