Definition of

Variable

Formula

Algorithms, statements, and formulas can include variables.

Derived from the Latin term variabilis , variable is a word that represents that which varies or is subject to some type of change. It is something that is characterized by being unstable , inconstant and changeable .

In other words, a variable is a symbol that identifies an unspecified element within a certain group. This set is usually defined as the universal set of the variable ( universe of the variable , on other occasions), and each piece included in it constitutes a value of the variable.

Examples and uses

Let's look at an example. x is a variable of the universe { 1 , 3 , 5 , 7 }. Therefore, x can be equal to any of the values ​​just mentioned, so it is possible to replace x with any odd number that is less than 8 .

As you can see, variables are elements present in formulas, propositions and algorithms, which can be substituted or can acquire different values, while still belonging to the same universe. It is worth mentioning that the values ​​of a variable can be framed within a range or be limited by membership situations.

Variable types

We can talk about different types of variables: dependent variables , which are those that depend on the value assigned to other phenomena or variables; independent variables , whose changes in values ​​influence the values ​​of another; Random variables are functions that associate a real number with each element of a set E.

Random

The value that the dice can add up to when thrown is a random variable.

In another classification it can be said that there are qualitative variables , which express different qualities, characteristics or modalities, and quantitative variables , which are stated through numerical quantities, among others. Within the qualitative variables there are nominal variables (those that are not numerical and cannot be ordered, such as marital status) and ordinal or quasi-quantitative variables (they are non-numeric but can be ordered, such as exam grades). . For their part, quantitative variables can be discrete (does not allow intermediate values ​​but exact numbers, for example the number of siblings of a person) or continuous (those that accept intermediate values ​​between two numbers, for example measurements of weight or height).

Use of the concept in computing

In the field of programming ( computer science ), variables are data structures that can change their content throughout the execution of a program. These structures correspond to a reserved area in the computer 's main memory.

To each variable the programmer assigns a label that allows him to recognize it from the rest, that way whenever he needs it he can call that variable and it will come with the value that has been assigned to it. For example, if the variable is named "num" and is stored with the number 7. If the programmer wanted to use it, he could program: num = num + 1 and he will get a result that precedes said variable.

In programming, variables are classified differently; there are Boolean, floating-point decimal, array, matrix, and random variables, among others.

Variables are the basis of programming , they respond to a language and allow the programmer to carry out the work in an orderly and efficient manner. The sum of the variables is what results in a certain action in a program and they always respond to the wishes of the programmer. This means that outside of an engine or the code of a certain program, these variables can mean something else and therefore, their sum will be diverse, because each programmer can assign the values ​​they want to each of the variables in their code.

Finally, it is worth mentioning that, in astronomy , variable stars are those that experience significant variations in luminosity.