Function

nerdamer.arccos

src/index.ts:746
nerdamer.arccos(x: ExpressionInput): Expression

Computes the arccosine (inverse cosine) of an expression. Returns exact symbolic values involving π for well-known inputs:

`0 → π/2`

,

`1/2 → π/3`

,

`1/√2 → π/4`

,

`√3/2 → π/6`

,

`1 → 0`

. Uses the identity

`acos(-x) = π − acos(x)`

for negative arguments. For numeric inputs outside

`[-1, 1]`

, returns a complex result via

`π/2 + asin(|x|)`

with the appropriate sign adjustment.

throws

UndefinedError If

`x`

is

`±∞`

.

Parameters

NameTypeDescription
xExpressionInputThe input expression (domain `[-1, 1]` for real results).

Returns

Expression — The arccosine of `x` in radians.

Examples

acos(1).text()                    // "0"
acos(0).text()                    // "1/2*pi"
acos('1/2').text()                // "1/3*pi"
acos('sqrt(2)^(-1)').text()       // "1/4*pi"
acos(-1).text()                   // "pi"

// Symbolic
acos('x').text()                  // "acos(x)"