Absolute (Abs)
What is it?
The absolute value of a number is its numerical value, excluding the sign. This means that the absolute value of 15 is the same as -15, which is 15. A simpler way of thinking of an absolute value is to remove any unary minus from in front of it.
The Abs function, when given a numeric argument, returns the absolute value of that argument.
What is the Syntax?
The syntax for the Abs function is as follows:
Abs( Argument );
Why might I want to use this?
When measuring distances, it is often unnecessary to consider the direction as long as you know the total units of distance being measured. For example, if a swimmer is doing lengths of a pool, they are travelling one length in one direction, then another length in the opposite direction. When they return to their original position after two lengths, the total distance from their original location is zero but they’ve certainly travelled some distance!
Imagine the path of the swimmer as they swim up and down the pool. The diagram below shows the distance and direction of each length, with lengths one way in black, and the return lengths in red to illustrate the opposite direction they are travelling in:
Each arrow represents 50m of swimming distance. If you were to take the distances, including their direction and add them together, you would get a relative, or Vector distance travelled of:
RelativeDistance := 50 + ( -50 ) + 50 + ( -50 ) + 50 + ( -50 )
In relative terms, the distance travelled is 0m.
If we want the absolute value of the distance travelled instead, we would count the distance for each length without the direction considered. In the diagram below, the size of each length is the same, but this time all lengths are considered as positive lengths:
We think of this as the following calculation:
AbsoluteDistance := Abs( 50 ) + Abs( -50 ) + Abs( 50 ) + Abs( -50 ) + Abs( 50 ) + Abs( -50 )
In absolute terms, the distance travelled is 300m.
<< Previous: Minimum (Min) | Next: Get Sign (Sign) >>