« previous section |
next section » |
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 X n into X.
Example 3.5.1
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 » |