Skip to content

Cot

Status: Stable

documented, exercised by the test suite and/or worked examples, with no known limitations recorded.

Description

Cot[z]
    gives the cotangent of z. Equivalent to Cos[z] / Sin[z].
Cot is Listable. Singularities at z = k Pi yield ComplexInfinity.

Examples

No verified examples yet for this function.

Implementation notes

Algorithm. builtin_cot (src/trig.c) runs the same cascade as the other trig heads. (1) strip_inverse_call folds Cot[ArcCot[x]] -> x. (2) try_simp_forward_of_inverse handles Cot[ArcTan[x]] -> 1/x. (3) odd_fold uses oddness Cot[-x] -> -Cot[x]. (4) trig_i_fold rewrites Cot[I y] -> -I Coth[y]. (5) Cot[0] -> ComplexInfinity. (6) For a rational multiple of Pi (via extract_pi_multiplier), exact_cot reduces n/d mod π into [0, π/2] with sign tracking and returns the table value (denominators 1,2,3,4,5,6,10,12; ComplexInfinity at multiples of π). (7) Numeric fallback: MPFR via mpfr_cot/mpfr_complex_cot, else get_approx + 1/ctan(c). Otherwise NULL.

Data structures. Expr* trees built with the make_* helpers; Pi multiples carried as int64_t n, d.

Attributes: Listable, NumericFunction, Protected.

Implementation status

Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.

References

Notes & additional examples

Worked examples

In[1]:= Cot[Pi/4]
Out[1]= 1
In[1]:= Cot[Pi/12]
Out[1]= 2 + Sqrt[3]
In[1]:= N[Cot[1], 40]
Out[1]= 0.64209261593433070300641998659426562023026
In[1]:= Series[Cot[x], {x, 0, 5}]
Out[1]= 1/x - 1/3 x - 1/45 x^3 - 2/945 x^5 + O[x]^6
In[1]:= Cot[I]
Out[1]= -I Coth[1]

Notes

Cot[z] is equivalent to Cos[z]/Sin[z]. Singularities at z = k Pi yield ComplexInfinity. Cot is Listable. The Laurent series at the origin exposes the Bernoulli-number coefficients, and imaginary arguments fold onto the hyperbolic cotangent.