The notion of absolute value is used in the field of mathematics to name the value that a number has beyond its sign. This means that the absolute value, which is also known as module , is the numerical magnitude of the figure regardless of whether its sign is positive or negative.
Let's take the case of the absolute value 5 . This is the absolute value of both +5 (positive 5) and -5 (negative 5). The absolute value, ultimately, is the same in the positive number and in the negative number: in this case, 5 . It should be noted that the absolute value is written between two parallel vertical bars; therefore, the correct notation is |5| .
Characteristics of absolute value
The definition of the concept indicates that the absolute value is always equal to or greater than 0 and is never negative . From what was said above, we can add that the absolute value of the opposite numbers is the same; 8 and -8 thus share the same absolute value: |8| .
The absolute value can also be understood as the distance between the number and 0 . The number 563 and the number -563 are, on a number line, the same distance from 0 . That, therefore, is the absolute value of both: |563| .
The distance between two real numbers , on the other hand, is the absolute value of their difference. Between 8 and 5 , for example, there is a distance of 3 . This difference has an absolute value of |3| .
Vectors and Euclidean space
The concept of absolute value is present in several topics in mathematics, and the vector is one of them; More precisely, it is in the vector norm where we are faced with a similar definition. Before continuing, however, it is necessary to define Euclidean space , since these concepts are combined in this area.
We understand by Euclidean space a kind of geometric space in which Euclid's axioms are satisfied. An axiom is a proposition whose clarity is such that it does not require a demonstration to be admitted; Specifically in the field of mathematics, this is the name given to the fundamental and unprovable principles on which theories are built .
Euclid , for his part, was born in Greece approximately in the year 325 BC. C., and his dedication to numbers earned him the title "Father of Geometry." His most important work is a collection of thirteen books grouped under the title " Elements ", where the aforementioned axioms (also known as Euclid's postulates ) are presented, and which we will see briefly below:
1) if we take any two points, it is possible to join them by means of a line;
2) it is possible to continuously extend all segments, regardless of the direction;
3) circles can originate from any point, which will be taken as their center, and their radius can acquire any value;
4) any pair of right angles is congruent;
5) it is possible to draw a single line parallel to another from a point outside the latter.
Absolute value and modulus of a vector
Having exposed the bases of Euclidean spaces, we can say that vectors can be represented in them in the form of segments that are oriented between any two points. If we take a vector, we can define its norm as the distance between two points, which serve as its limit; So much so, that in a Euclidean space this norm corresponds to the module, that is, to the length of said vector.
Just like the absolute value, the module of a vector is always a positive number or zero , since it represents a length, a distance. In this case, as in many others, associating this magnitude with a sign could cause unnecessary complications.
The notion in video game programming
In the field of video game programming, on the other hand, the absolute value can appear on numerous occasions, depending on the methodology of each developer.
For example, when calculating the current speed of a character we can ignore the direction in which it is moving and simply look at the segment that exists between 0 and the maximum speed, applying acceleration accordingly; Finally, just multiply the resulting value by the direction vector of the character to translate it.