Solving for secant and tangent