Maggie Johnson
Handout #36
CS103A
Functions
Key topics:
* Introduction and Definitions
* Types of Functions
* The Growth of Functions
As used in ordinary language, the word
function
indicates dependence of a varying quantity on
another. If I tell you that your grade in this class is a function of the number of thousands of dollars
you pay me, you interpret this to mean that I have a rule for translating a number in thousands into a
letter grade. More generally, suppose two sets of objects are given: set A and set B; and suppose
that with each element of A there is associated a particular element of B. These three things: the two
sets and the correspondence between elements comprise a function.
A
function
f is a mapping from a set D to a set T with the property that for each element d in D, f
maps d to a unique element of T, denoted f(d). Here D is called the
domain
of f, and T is called the
target
or
codomain
. We write f: D > T. We also say that f(d) is the
image
of d under f, and we
call the set of all images the
range
R of f.
A mapping might fail to be a function if it is not defined at every element of the domain, or if it maps
an element of the domain to two or more elements in the range:
Use Word 6.0c or later to
view Macintosh picture.
To define a function f, we must specify its domain D and a rule for how it operates.
Example 1
Let B be the set of all binary numbers, or equivalently all finite strings of 0's and 1's. Let
N
be the set of natural numbers expressed in decimal notation. f, g, h, j are the following
functions:
f(s) = decimal equivalent of s
g(s) = number of bits in s
h(s) = number of ones in s
j(s) = ones bit of s
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
If s = 110010 then f(s) = 50, g(s) = 6, h(s) = 3, j(s) = 0. The range of f, g, h, is
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '07
 Plummer,R
 Computer Science, codomain

Click to edit the document details