abs
The absolute value function
Calling Sequence
Parameters
Description
Examples
abs(x)
x
abs(n, x)
-
expression or rtable
n
positive integer
The abs function returns the absolute value of the expression x.
You can enter the command abs using either the 1-D or 2-D calling sequence. For example, abs(-11) is equivalent to −11.
If x is an rtable (Array, Matrix, or Vector), the abs function applies the abs function to each entry in the table, and returns the resulting rtable.
If x includes a function f, then abs will attempt to execute the procedure abs/f to determine the absolute value of the corresponding part of x. The user can thus easily extend the functionality of abs.
The derivative of abs is denoted by abs(1, x). This is signum(x) for all non-0 real numbers, and is undefined otherwise. Neither first order nor higher order derivatives of abs can be determined if x is an rtable.
Higher order derivatives of abs are denoted by abs(n, x), where n is a positive integer. When n is known, the expression is automatically simplified to the appropriate expression in a derivative of either signum or abs.
abs⁡−11
11
abs⁡cos⁡3
−cos⁡3
evalf⁡
0.9899924966
abs⁡−2⋅10
20
a≔abs⁡2⁢x−3
a≔2⁢x−3
x≔1
a
1
The absolute value of a complex number is the modulus.
abs⁡3−4⁢I
5
expr≔abs⁡sqrt⁡2⁢I⁢u2⁢v
expr≔2⁢u2⁢v
expand⁡expr
2⁢u2⁢v
combine⁡expr,abs
assume⁡u,positive:simplify⁡expr
2⁢u~2⁢v
expr2≔abs⁡b4⁢c2⁢d3
expr2≔b4⁢c2⁢d3
assume⁡0<b,0<c:simplify⁡expr2
b~4⁢c~2⁢d3
int⁡abs⁡y,y
−y22y≤0y220<y
diff⁡abs⁡y,y
abs⁡1,y
diff⁡abs⁡y,y,y
signum⁡1,y
abs⁡2,y
To find the absolute value of a Matrix, use the absolute value function as written in 1-D Math, to avoid confusion between the function abs and the determinant of the Matrix.
abs⁡Array⁡1..2,1..2,−2
2222
abs⁡−1,2,3|−4,5,−6
142536
abs⁡Matrix⁡3,fill=−1
111111111
The derivative of the absolute value of an rtable cannot be determined, so an error results.
abs⁡1,rtable⁡1..2,−1
Error, invalid input: simpl/abs expects its 2nd argument, a2, to be of type algebraic, but received Array(1..2, [-1,-1])
See Also
convert/abs
convert/piecewise
evalc
initialfunctions
piecewise
rtable
signum
Download Help Document