Algosim documentation: abs

abs

Computes absolute values.

Syntax

Description

If x is a real or complex number, abs(x) is the absolute value of x.

If x is a vector or a matrix, abs(x) is the vector or matrix obtained by taking element-wise absolute values. abs(x) is always a real vector or matrix, even if x is a complex vector or matrix.

Examples

abs(10)
10
abs(−10)
10
abs(3 + 4⋅i)
5
abs(❨1, −1, 0❩)
 ⎛1⎞
e⎜1⎟
 ⎝0⎠
abs(❨❨1, i❩, ❨−i, −2❩❩)
⎛1 1⎞
⎝1 2⎠

See also