« previous section
 next section »


3.5. Many argument functions

Talking in this lecture about functions we usually had in mind a mapping f:  X ® Y defined  in some set X and we were not interested in the structure of the set X. 

If the set X is a cartesian product of the sets X1,..., Xn, then we consider  f as a many argument function

f : X1 × ... × Xn → Y

that transforms the cartesian product X1 × ... × Xn = Pi ≤ n Xi into the set Y.

All the definitions which we have accepted in the previous parts of this lecture are also valid for the many argument functions, because those functions can be treated as a special type of one-argument functions. If f(x1,..., xn) = y, then xi is called an i-th argument of the function f.

Mathematics and computer science deal with a lot on different kinds of operations. But operations are nothing else than functions. For example the addition of the real numbers is an operation executed on two real arguments, and its result is also a real number. Furthermore, the pair of real numbers is assigned with only one real number.  Hence it is a two-argument function:

+ : R × R → R

In general, each n-argument operation in the set X is an n-argument function, mapping the set  Xinto X.

Example 3.5.1

  1. Let X be a fixed  universe. The operation of the symmetric difference, defined in the set of all subsets of X, is a two-argument function, ⊕ : P(X) × P(X) → P(X), such that for any A, B, ⊕ (A, B) = A\B ∪ B\A. Traditionally, just like in the case of other two argument operations, the symbol of operation is placed between arguments, i.e. instead of  ⊕ (A, B) we write A ⊕ B.
  2. Let S be a set of the PJWSTK students. At the graduation each student gets a mean of all his marks written into his index (credit book). We are dealing here with the n+1-argument function, where n is a number of credited exams, which assignes each student and his marks mark1, ..., markn with the real value equal (mark1, ..., markan )/n.
  3. Let us consider a typical computer science example: a program. Every deterministic program P can be treated as a many-argument (partial) function, which assign result to data, compare Fig. 3.4.3. Data is the sequence of values of the input parameters, result - the sequence of values of output parameters. If we aim to calculate the values of the polynomial
    w(x) = a0 + a1x + ... + anxn,

    for several changing parameters and for different values of argument x, then it is worth of programming in such a way that the coefficients of the polynomial and the value of the variable  x, form a data for the program. If the variable result is treated as the one which stores the value of the polynomial, then the program may be written in a following manner (known as Horner's algorithm)

begin result:= an; i := n; while i>0 do i := i-1; result := result* x + ai od end;

This program defines the (n+2)-argument function f, which assinges the arrangement of arguments (x,a0,a1,..., an) with the value of the polynomial w(x).

Fig. 3.5.1 Program as a mapping transforming data into results.


« previous section
 next section »