Definition of

Function

mathematical function

In mathematics, a function refers to the correspondence between the elements of two sets.

The concept of function has its origin in the Latin term functĭo . The word can be used in various areas and with different meanings.

For example, a function is the representation of an artistic work . The theatrical performance is the performance that takes place live in a theater , while the exhibition of a film in movie theaters is also called a performance.

mathematical function

On the other hand, a mathematical function is the correspondence or relationship f of the elements of a set A with the elements of a set B.

A function satisfies the existence condition (all elements of A are related to the elements of B) and the uniqueness condition (each element of A is related to a single element of B).

The concept in computing

In computer science , more precisely in programming languages , a function is a type of subalgorithm that describes a sequence of commands. These commands fulfill a specific task of a larger application.

The function is as essential as it is dispensable in programming, since its existence does not always offer more possibilities to developers, although its good implementation can make a huge difference in the performance of the program. What does this mean? That a function is nothing more than a series of orders that can exist and be executed perfectly individually and independently.

However, the advantages of including them in a function are several. The first of them and the most obvious at first glance is the saving of disk space and, during execution , in RAM memory, because we only have to write them once and simply mention the name of the function each time we want to execute them.

Computing

In the field of programming, a function is a subalgorithm that makes it possible to describe a sequence of commands.

Example of function in programming

Let's look at a practical example below to understand all this, although without going into too technical aspects. Suppose we are programming a video game and we want to give the user the ability to create their own avatars. Each time you do this, some of the steps to follow in the code will be the following: register name and properties such as "type", "name" and "gender"; load three-dimensional model; add to the list of active characters for later management; show your rest animation as soon as it appears on the screen.

In reality, the tasks and lines of code would be many more, but these are enough for the example. If we had to write all this in every part of the program in which the creation of a character was referred to, we would be wasting memory, one of the most precious resources for programmers; If we convert this "recipe" into a function, however, which we call CreateCharacter , it would be enough to write its name and indicate the properties to execute everything described above.

The notion in semiotics, at work and in a system

For semiotics , a function is the set of elements and the relationships between them that are necessary to define a structure .

We also talk about functions to refer to the tasks and responsibilities of a person within a work environment. For example: "The duties of a music manager include promoting the musician and closing contracts for their live performances," "If he continues not to fulfill his duties we will be forced to fire him from the company to prevent him from sinking us all." » .

Finally, a technical function is the passage, through an appropriate device, from a given set of initial states of a system to the desired set of final states. For example: a “water source” system, with an initial state of “impure water” , can use the “water purification” technical function to achieve the final state of “pure water source” .