Documentation moved.
This entry is now part of the unified function reference. Open the unified page →
Function
src/index.ts:777nerdamer.abs
nerdamer.abs(x: ExpressionInput): ExpressionComputes the absolute value of an expression. Applies symbolic simplifications where possible: - Even powers are recognised as non-negative (e.g.
`abs(x^2)`returns
`x^2`). - Complex inputs use the modulus:
`abs(a + bi) = sqrt(a² + b²)`. - Fully negative sums are negated (e.g.
`abs(-x - y)`becomes
`x + y`).
Parameters
| Name | Type | Description |
|---|---|---|
x | ExpressionInput | The expression to take the absolute value of. |
Returns
Expression — The absolute value of `x`.
Examples
abs(-5).text() // "5"
abs('3/4').text() // "3/4"
abs('x^2').text() // "x^2"
abs('x').text() // "abs(x)"