Main Content

atan

Symbolic inverse tangent

Description

P = atan(Z) returns the inverse tangent (arctangent) of the elements of Z. All angles are in radians.

  • For real values of Z, atan(Z) returns values in the interval [-pi/2,pi/2].

  • For complex values of Z, atan(Z) returns complex values with the real parts in the interval [-pi/2,pi/2].

example

P = atan(Y,X) returns the four-quadrant inverse tangent of the elements of Y and X. This syntax with two input arguments is the same as atan2(Y,X).

Symbolic arguments X and Y are assumed to be real, and atan(Y,X) returns values in the interval [-pi,pi].

Examples

collapse all

Depending on its arguments, atan returns floating-point or exact symbolic results.

Compute the inverse tangent function for these numbers. Because these numbers are not symbolic objects, atan returns floating-point results.

P = atan([-1, -1/3, -1/sqrt(3), 1/2, 1, sqrt(3)])
P = 1×6

   -0.7854   -0.3218   -0.5236    0.4636    0.7854    1.0472

Compute the inverse tangent function for the numbers converted to symbolic objects. For many symbolic (exact) numbers, atan returns unresolved symbolic calls.

symP = atan(sym([-1, -1/3, -1/sqrt(3), 1/2, 1, sqrt(3)]))
symP = 

(-π4-atan(13)-π6atan(12)π4π3)

Use vpa to approximate symbolic results with floating-point numbers.

vpaP = vpa(symP)
vpaP = (-0.78539816339744830961566084581988-0.32175055439664219340140461435866-0.523598775598298873077107230546580.463647609000806116214256231461210.785398163397448309615660845819881.0471975511965977461542144610932)

Plot the inverse tangent function on the interval from -10 to 10.

syms x
fplot(atan(x),[-10 10])
grid on

Figure contains an axes object. The axes object contains an object of type functionline.

Many functions, such as diff, int, taylor, and rewrite, can handle expressions containing atan.

Find the first and second derivatives of the inverse tangent function.

syms z
D1 = diff(atan(z),z)
D1 = 

1z2+1

D2 = diff(atan(z),z,z)
D2 = 

-2zz2+12

Find the indefinite integral of the inverse tangent function.

I = int(atan(z),z)
I = 

zatan(z)-log(z2+1)2

Find the Taylor series expansion of atan(z).

T = taylor(atan(z),z)
T = 

z55-z33+z

Rewrite the inverse tangent function in terms of the natural logarithm.

R = rewrite(atan(z),'log')
R = 

log(1-zi)i2-log(1+zi)i2

Input Arguments

collapse all

Tangent of angle, specified as a symbolic number, variable, expression, or function, or as a vector, matrix, or array of symbolic numbers, variables, expressions, or functions.

y-coordinates, specified as a symbolic number, variable, expression, or function, or as a vector, matrix, or array of symbolic numbers, variables, expressions, or functions. All numerical elements of Y must be real.

Inputs Y and X must either be the same size or have sizes that are compatible (for example, Y is an M-by-N matrix and X is a scalar or 1-by-N row vector). For more information, see Compatible Array Sizes for Basic Operations.

x-coordinates, specified as a symbolic number, variable, expression, or function, or as a vector, matrix, or array of symbolic numbers, variables, expressions, or functions. All numerical elements of X must be real.

Inputs Y and X must either be the same size or have sizes that are compatible (for example, Y is an M-by-N matrix and X is a scalar or 1-by-N row vector). For more information, see Compatible Array Sizes for Basic Operations.

More About

collapse all

Inverse Tangent

The inverse tangent is defined as

atan(Z)=i2log(1iZ1+iZ).

Four-Quadrant Inverse Tangent

If X ≠ 0 and Y ≠ 0, then

atan(Y,X)=atan(YX)+π2sign(Y)(1sign(X)).

Results returned by atan(Y,X) belong to the closed interval [-pi,pi]. Meanwhile, results returned by atan(Y/X) belong to the closed interval [-pi/2,pi/2].

Version History

Introduced before R2006a

See Also

| | | | | | | | | | |