app2 - APPENDIX 2 MATHEMATICAL BACKGROUND A2. 1...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
APPENDIX 2 MATHEMATICAL BACKGROUND A2. 1 INTRODUCTION Mathematics is one of the outstanding accomplishments of the human mind. Its abstract models of real-life phenomena have fostered advances in every field of science and engineering. Most of computer science is based on mathematics, and this book is no exception. This appendix provides an introduction to those mathematical concepts referred to in the chapters. Some exercises are given at the end of the appendix, so that you can practice the skills while you are learning them. A2.2 FUNCTIONS AND SEQUENCES An amazing aspect of mathematics, first revealed by Whitehead and Russell [1910], is that only two basic concepts are required. Every other mathematical term can be built up from the primitives set and element . For example, an ordered pair < a , b > can be defined as a set with two elements: <a, b> = {a, {a, b}} The element a is called the first component of the ordered pair, and b is called the second component . Given two sets A and B , we can define a function f from A to B , written f: A B as a set of ordered pairs < a , b >, where a is an element of A , b is an element of B , and each element in A is the first component of exactly one ordered pair in f . Thus no two ordered pairs in a function have the same first element. The sets A and B are called the domain and co-domain , respectively. 175
Background image of page 1

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

View Full DocumentRight Arrow Icon
For example, f = { < -2, 4>, <-1, 1>, <0, 0>, <1, 1>, <2, 4> } defines the "square" function with domain { -2, -1, 0, 1, 2 } and co-domain { 0, 1, 2, 4 }. No two ordered pairs in the function have the same first component, but it is legal for two ordered pairs to have the same second component. For example, the pairs <-1, 1> and <1, 1> have the same second component, namely, 1. If < a , b > is an element of f , we write f(a) = b . This gives us a more familiar description of the above function: the function f is defined by f(i) = i 2 , for i in -2. ..2. Another name for a function is a map . This is the term used in Chapters 12, 14 and 15 to describe a collection of elements in which each element has a unique key part and a value part. There is, in effect, a function from the keys to the values, and that is why the keys must be unique. A finite sequence t is a function such that for some positive integer k , called the length of the sequence, the domain of t is the set { 0, 1, 2, . .., k-1 } . For example, the following defines a finite sequence of length 4: t(0) = "Karen" t(1) = "Don" t(2) = "Mark" t(3) = "Courtney" Because the domain of each finite sequence starts at 0, the domain is often left implicit, and we write 176
Background image of page 2
t = "Karen", "Don", "Mark", "Courtney" A2.3 SUMS AND PRODUCTS Mathematics entails quite a bit of symbol manipulation. For this reason, brevity is an important consideration. An example of abbreviated notation can be found in the way that sums are represented. Instead of writing x 0 + x 1 + x 2 + . .. + x n-1 we can write n-1 Σ x i i=0 This expression is read as "the sum, as i goes from 0 to
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This test prep was uploaded on 04/21/2008 for the course CS 103 taught by Professor Billcollins during the Spring '08 term at Lafayette.

Page1 / 29

app2 - APPENDIX 2 MATHEMATICAL BACKGROUND A2. 1...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online