Nuacht

This is not a programming problem, the problem is that you do not know about trig functions. The tangent function is discontinuous in PI/2 + n*PI, so you should break it to pieces at those intervals.
Graph transformations Given the graph of a common function, (such as a simple polynomial, quadratic or trig function) you should be able to draw the graph of its related function.