Main Content

acos

Symbolic inverse cosine function

Syntax

Description

example

acos(X) returns the inverse cosine function (arccosine function) of X. All angles are in radians.

  • For real values of X in the interval [-1,1], acos(x) returns the values in the interval [0,pi].

  • For real values of X outside the interval [-1,1] and for complex values of X, acos(X) returns complex values with the real parts in the interval [0,pi].

Examples

Inverse Cosine Function for Numeric and Symbolic Arguments

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

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

A = acos([-1, -1/3, -1/2, 1/4, 1/2, sqrt(3)/2, 1])
A =
    3.1416    1.9106    2.0944    1.3181    1.0472    0.5236         0

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

symA = acos(sym([-1, -1/3, -1/2, 1/4, 1/2, sqrt(3)/2, 1]))
symA =
[ pi, pi - acos(1/3), (2*pi)/3, acos(1/4), pi/3, pi/6, 0]

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

vpa(symA)
ans =
[ 3.1415926535897932384626433832795,...
1.9106332362490185563277142050315,...
2.0943951023931954923084289221863,...
1.318116071652817965745664254646,...
1.0471975511965977461542144610932,...
0.52359877559829887307710723054658,...
0]

Plot Inverse Cosine Function

Plot the inverse cosine function on the interval from -1 to 1.

syms x
fplot(acos(x),[-1 1])
grid on

Handle Expressions Containing Inverse Cosine Function

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

Find the first and second derivatives of the inverse cosine function:

syms x
diff(acos(x), x)
diff(acos(x), x, x)
ans =
-1/(1 - x^2)^(1/2)
 
ans =
-x/(1 - x^2)^(3/2)

Find the indefinite integral of the inverse cosine function:

int(acos(x), x)
ans =
x*acos(x) - (1 - x^2)^(1/2)

Find the Taylor series expansion of acos(x):

taylor(acos(x), x)
ans =
- (3*x^5)/40 - x^3/6 - x + pi/2

Rewrite the inverse cosine function in terms of the natural logarithm:

rewrite(acos(x), 'log')
ans =
-log(x + (1 - x^2)^(1/2)*1i)*1i

Input Arguments

collapse all

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

See Also

| | | | | | | | | |

Introduced before R2006a