Calculate cosine values with cos
cos(x) returns the cosine of an angle x, interpreted in radians. On the unit circle, cosine is the horizontal coordinate, making it a natural tool for periodic motion, rotations, projections, and triangles.
Radian input and common values
cos(0) is 1, cos(pi / 2) is 0, and cos(pi) is -1. Convert degrees to radians before calling cosine: 60 degrees is pi / 3. The matching sin function gives the vertical coordinate, while tan is their ratio where cosine is not zero.
Useful applications
For a point moving around a circle of radius r, the horizontal position can be written r * cos(t). In vector work, cosine relates to angle and projection; combine dot, norm, and inverse acos when calculating an angle between vectors.
Domain and precision
Cosine accepts real and complex inputs, and for every real angle its result is between -1 and 1. Values very close to special angles may display tiny rounding residues rather than exact zero; use round for presentation, not to change the underlying model. Do not confuse cos with cosh, the hyperbolic cosine, which has a different definition and behavior.