Functions and operators

tan⁡x=sin⁡xcos⁡x\tan x = \frac{\sin x}{\cos x} Tangent

The tangent function sin/cos; rare in ML papers, and not the same as tanh.

In ML papers

tan⁡x=sin⁡xcos⁡x\tan x = \frac{\sin x}{\cos x} is the tangent of an angle. It is rare in ML papers. When it appears it is usually the inverse, arctan⁡\arctan, turning a ratio back into an angle: a phase, a heading, the angle of a 2D vector.

The far more common function is tanh⁡\tanh (Hyperbolic tangent), the hyperbolic tangent, an activation function. One letter apart, very different behaviour: tan⁡\tan shoots to infinity at ±π2\pm\frac{\pi}{2}, tanh⁡\tanh stays between −1-1 and 11.

How to type it

LaTeXShows
\tantan⁡\tan
\arctan inverse tangentarctan⁡\arctan

A worked example

tan⁡π4=1,arctan⁡1=π4≈0.785\tan\tfrac{\pi}{4} = 1, \quad \arctan 1 = \tfrac{\pi}{4} \approx 0.785

Compare tanh⁡1≈0.762\tanh 1 \approx 0.762.

Common confusions

Related

tanh⁡(x)\tanh(x)Hyperbolic tangentPE(pos,2i)=sin⁡(pos100002i/d)PE_{(pos, 2i)} = \sin\left(\frac{pos}{10000^{2i/d}}\right)Sinecos⁡(u,v)=u⊤v∥u∥ ∥v∥\cos(\mathbf{u}, \mathbf{v}) = \frac{\mathbf{u}^\top \mathbf{v}}{\|\mathbf{u}\| \, \|\mathbf{v}\|}Cosine

Decode this example →