|
We're glad you came by, but you might find what you're looking for elsewhere. TI-Basic Developer is not the site it once was. While its information on commands and other calculator features remains almost second-to-none, its forum, archives, and even hosting service, Wikidot, have been decaying for years. The calculator community would love to see what you're working on, or help you in your next coding adventure, but TI-Basic Developer is no longer the place to do it. Instead, you should head over to Cemetech (primarily American) or TI-Planet (primarily international). Both are active, well-established forums with their own archives, chatrooms, reference material, and abundant coding tools and resources. We'll see you there, we hope. |
Returns the absolute value of a real number, and the complex absolute value of a complex number.
abs(value)
Press:
- MATH to access the math menu.
- RIGHT to access the NUM submenu.
- ENTER to select abs(.
Alternatively, press:
- MATH to access the math menu.
- RIGHT twice to access the CPX (complex) submenu.
- 5 to select abs(, or use arrows.
TI-83/84/+/SE/CSE/CE
1 byte
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)
3For 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+iy where x and y are both real, abs(z) returns √(x²+y²). Also works on a list of complex numbers.
abs(3+4i)
5Optimization
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-15In 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-83For complex numbers given by a separate real and complex part, abs(X+iY) can be optimized to R►Pr(X,Y).
Related Commands
.