Property | Value |
---|---|
Hex Value | $B2 |
Categories | |
Localizations |
|
abs(
Overview
Returns the absolute value of a real number, expression, list, or matrix.
Availability: Token available everywhere.
Syntax
abs(value)
Arguments
Name | Type | Optional |
---|---|---|
value | real|expression|real[]|matrix |
Location
math, NUM
, 1:abs(
Overview
Returns the magnitude of a complex number or list.
Availability: Token available everywhere.
Syntax
abs(complex value)
Arguments
Name | Type | Optional |
---|---|---|
complex value | complex|complex[] |
Location
math, CMPLX
, 5:abs(
Description
abs(x) returns the absolute value of the real number x. Also works on a list or matrix of real numbers.
abs(3)
3
abs(‾3)
3
For complex numbers, abs(z) returns the absolute value (also known as the complex modulus, norm, or a hundred other terms) of the complex number z. If z is represented as x+i_y_ where x and y are both real, abs(z) returns √(_x_²+_y_²). Also works on a list of complex numbers.
abs(3+4i)
5
Optimization
The abs( command, used properly, may be a smaller method of testing if a variable is in some range. For example:
:If 10<X and X<20
can be
:If 5>abs(X-15
In general, the first number, A, in the expression A>abs(X-B) should be half the length of the range, half of 10 in this case, and the second number, B, should be the midpoint of the range (here, 15).
This can be taken to extreme degrees. For example, the following code uses abs( three times to test if X is the getKey keycode of one of the keys 1, 2, 3, 4, 5, 6, 7, 8, or 9:
:If 2>abs(5-abs(5-abs(X-83
For complex numbers given by a separate real and complex part, abs(X+iY) can be optimized to R►Pr(X,Y).
Related Commands
Source: parts of this page were written by the following TI|BD contributors: DarkerLine, GoVegan, kg583, Myles_Zadok, thornahawk, Trenly.
History
Calculator | OS Version | Description |
---|---|---|
TI-82 | 1.0 | abs added |
TI-83 | 0.01013 | Renamed abs to abs( |