tan

Tangent of an angle in radians.

Category: Mathematics > Elementary Math

Syntax

Y = tan(X)

Returns the tangent of each element of X, with X in radians.

Description

tan(x) is sin(x)./cos(x). It is periodic with period pi and has vertical asymptotes at odd multiples of pi/2. Since pi/2 cannot be stored exactly, tan(pi/2) returns a very large number (about 1.6331e+16) rather than Inf.

To recover the angle of a point from both coordinates, use atan2(y, x), which handles all quadrants, instead of atan(y/x).

Input arguments

X
Angles in radians; real or complex.

Output arguments

Y
Array of the same size as X.

Example

Slopes and the asymptote

tan([0 pi/4 pi/3])
tan(pi/2)
Output
ans = 1×3

         0    1.0000    1.7321
ans = 1.6331e+16

See also

sin cos tand tanh atan2