{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lect_14 - Functions Margaret M Fleck 19 February 2010 This...

This preview shows pages 1–3. Sign up to view the full content.

Functions Margaret M. Fleck 19 February 2010 This lecture starts the material in section 2.3 of Rosen. It discusses functions and introduces the concepts of one-to-one and onto. 1 Announcements Another reminder of the upcoming midterm. Remember to bring your ID. (But we do have a backup plan if one or two of you forget.) This lecture is brought to you by the number 65535. (This is 2 16 1, i.e. the largest number you can store in a 16-bit unsigned integer variable.) Another useful fact is that 1000 is approximately equal to 2 10 . This is helpful when determining how large a number you will get when trying to access locations in computer memory, especially for big memory sizes. 2 Functions We all know roughly what functions are, from high school and (if you’ve taken it) calculus. You’ve mostly seen functions whose inputs and outputs are numbers, defined by an algebraic formula such as f ( x ) = 2 x + 3. We’re going to generalize and formalize this idea, so we can talk about functions with other sorts of input and output values. Suppose that A and B are sets, then a function f from A to B (shorthand: f : A B ) is an assignment of exactly one element of B (i.e. the output value) to each element of A (i.e. the input value). A is called the domain of f and B is called the co-domain . For example, let’s define g : Z Z by the formula g ( x ) = 2 x . The domain and co-domain of this function are both Z . 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Notice that the domain and co-domain are part of the definition of the function, just like the input/output type declarations for a function in a programming language. Suppose we define h : N N such that h ( x ) = 2 x . This is a different function from g because the declared domain and co- domain are different. Two functions are equal if they have the same domain, the same co- domain, and assign the same output value to each input value. The inputs and outputs to functions don’t have to be numbers and a function doesn’t have to be defined by an algebraic formula. It’s sufficient to describe a clear, explicit procedure for finding the output value, given the input value. For example, we can define s : {
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

lect_14 - Functions Margaret M Fleck 19 February 2010 This...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online