# Reference: cos

cos(x) returns the cosine of x. x is a real or complex number.
Construct the unit circle
x^2 + y^2 = 1
in R^2. Draw the line from the origin to the point P at this circle, such that the angle to this line, counted from the positive x-axis (anticlockwise is the positive direction) is equal to x. Then cos(x) is the x-coordinate of P.
For a general complex number z, Euler's identity
cos(z) = (1/2) ⋅ (exp(iz) + exp(-iz))
defines cos(z). exp is the complex exponential function, defined such that
exp(z) = e^(Re z) ⋅ (cos (Im z) + i sin (Im z))
where i is the imaginary unit (i^2 = -1) and Re z and Im z are the real and imaginary parts of z, respectively.