Specifically about summation and productive operations, not in general and can not represent your specific case because the order of the operation is important.
There are operations that are done in collections. They are unary functions based on binary operations (vine binary operation), as long as the binary operation itself defines, with the collection of elements, an abelian group (not to confuse group and ensemble, are distinct mathematical objects). And summation and productive are examples of such operations.
I do not have the guarantee of the necessity that the group needs to be abelian, however, as a group alone has no ordination, it seems to me intuitive that op(a,b) = op(b,a)
must be true
The definition of a collection operator is recursive. Be a collection S
(vine bag) an element of C*
(vine kleene star), and C
a set belonging to the group G = {C, op, e}
, where op
defines a commutative operation in C
and e
is the neutral element of op
. We can create a set operator opX
which receives a collection and returns an elmento of C
. Your signature is like this (in Latex it is more elegant, but for the next moment, let’s focus on ASCII):
opX: C* -> C
It means that opX
receives a variable amount of C
(therefore, a collection with repetitions, aka bag) and returns an element of C
. Your return is to climb on C
.
This is the signature of opX
, identifying the types of inputs and their output. The definition of opX
, however, so it is:
opX(S) = e, se S = {}
opX(S) = op(a, opX(S\{a})), a em S, S != {}
The sum is defined this way:
Σ(S) = 0, se S = {}
Σ(S) = +(a, Σ(S\{a})), se a em S, S != {}
And the one about production:
Π(S) = 1, se S = {}
Π(S) = *(a, Π(S\{a})), se a em S, S != {}
It happens that often does not interest to describe all the elements in S
for these operations. Then a set inference is made. To make this inference, you must pass a unary function on X
for mapping (if the domain passed is distinct from the basic operation domain). That is, you need to describe a function of the following signature:
map: X -> C
So you define a collection S'
based on S
applying the function of mastering map
:
S' = {map(s), s em S}
Then, by convention, the following was defined:
Σ(S, map) = Σ(S'), S' = {map(s), s em S}
However, as in most cases the range of integers consists of consecutive numbers, it would be enough to inform the beginning and the end of this range. It is also agreed that it is elegant to show which iteration variable, why it is put i = 0
below the sigma symbol (or pi in the product) and only an arbitrary number above. Example of this notation: here.
In ASCII notation, it would be equivalent to this:
Σ(ini, fim, map) = Σ(S, map) = Σ(S')
S = [ini, fim], S' = {map(s), s em S}
Where [ini, fim]
is the closed interval of the integers between ini
and fim
.
I particularly sometimes write only that the iteration variable is contained in a set. Look at the products.
The algorithm defined in its pseudo-code loop, however, cannot make it an operation in any relevant numerical set (natural/integer/rational/real/complex).
This does not answer the question. Where the Loop was applied in the expression?
– CypherPotato
@Cypherpotato In recursion
– Woss
Where can I specify the beginning, step, and end of recursion in the cited example?
– CypherPotato
@Cypherpotato What you mean by step and end?
– Woss
for inicio = 0; inicio < fim; inicio += passo
– CypherPotato
@Cypherpotato Hum, that level of detail should be in the question already
– Woss
But it’s just below the last equation. I’ll edit it to make it clear.
– CypherPotato
@Cypherpotato, mathematically there is no distinction between loop and recursion. So much so that the functional paradigm, the one that derives directly from mathematics (lambda calculus, being more specific), does not foresee iterations, only recursions.
– Jefferson Quesado