Symbolic inverse cosine function
acos( returns the inverse cosine function
(arccosine function) of X)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].
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 0Compute 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 the inverse cosine function on the interval from -1 to 1.
syms x fplot(acos(x),[-1 1]) grid on

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