Returns the arctangent of its argument.


y = atan(x)

x (NxK matrix or N-dimensional array) –


y (NxK matrix or N-dimensional array) – containing the arctangents of x in radians.


** Create a sequence with 5 elements starting at -pi and
** increasing by pi/2
x = seqa(-pi, pi/2, 5);
y = atan(x);

print "x = " x;
print "y = " y;

After the code above:

-3.142      -1.263
   -1.571      -1.004
x = 0.000  y =  0.000
    1.571       1.004
    3.142       1.263


y will be the same size as x, containing the arctangents of the corresponding elements of x.

For real x, the arctangent of x is the angle whose tangent is x. The result is a value in radians in the range \(-π/2\) to \(+π/2\). To convert radians to degrees, multiply by \(180/π\).

For complex x, the arctangent is defined everywhere except i and -i. If x is complex, y will be complex.

See also

Functions atan2(), sin(), cos(), pi(), tan()