s
Section 5.4 Functions
385
Indeed, the algorithms we gave for computing the values in such sequences were
pseudocode that computes the function.
Also in Section 3.1, we talked about recursive operations such as a
n
where a
is a fixed nonzero real number and n ≥ 0. This is also simply a function f (n) = a
n
whose domain is N.
The definition of a function includes functions of more than one variable. We
can have a function f: S 1 × S 2 × c × S n S T that associates with each ordered
n-tuple of elements (s 1 , s 2 , …, s n ), s i [ S i , a unique element of T.
example 28
f : Z × N × 51, 26 S Z is given by f (x, y, z) = x
y
+ z. Then f (−4, 3, 1) =
(−4)
3
+ 1 = −64 + 1 = −63.
example 29
In Section 4.1 we defined a unary operation on a set S as associating a unique
member of S, x
#
, with each member x of S. This means that a unary operation on
S is a function with domain and codomain S. We also defined a binary operation
+ on a set S as associating a unique member of S, x + y, with every (x, y) pair of
elements of S. Therefore a binary operation on S is a function with domain S × S
and codomain S.
Again, domain values and codomain values are not always numbers.
example 30
Let S be the set of all character strings of finite length. Then the association that pairs
each string with the number of characters in the string is a function with domain S and
codomain N (we allow the “empty string,” which has zero characters).
example 31
Any propositional wff with n statement letters defines a function with domain
5T, F6
n
and codomain 5T, F6. The domain consists of all n-tuples of T-F values;
with each n-tuple is associated a single value of T or F. The truth table for the wff
gives the association. For example, if the wff is A ~ B′, then the truth table
a
B
B∙
a ~ B′
T
T
F
T
T
F
T
T
F
T
F
F
F
F
T
T
says that the image of the 2-tuple (F, T) under this function is F. If we call this
function f, then f (F, T ) = F.
Précédent

- 402/986

Suivant