Calculate secant with sec
sec(x) returns the reciprocal of cosine: 1 / cos(x). It is useful in trigonometric identities and formulas expressed through reciprocal ratios.
Example
sec(0) is 1. See cos for the direct ratio and asec for an inverse principal angle. The identity sec(x)^2 = 1 + tan(x)^2 connects it to tan.
Domain caution
Secant is undefined where cosine is zero, at odd multiples of pi/2. It grows rapidly near those angles, so use pi for exact radians and handle near-pole values deliberately.