Presentation is loading. Please wait.

Presentation is loading. Please wait.

MSU/CSE 260 Fall 20091 1 Sequences and Summations.

Similar presentations


Presentation on theme: "MSU/CSE 260 Fall 20091 1 Sequences and Summations."— Presentation transcript:

1 MSU/CSE 260 Fall 20091 1 Sequences and Summations

2 MSU/CSE 260 Fall 2009 2 2 Sequences Definition: A sequence is a function whose domain D is a subset of N ={0, 1, 2, …} of the form:  D = { k, k+1, k+2, … }, for some k  N, or  D = { k, k+1, k+2, …, k + m }, for some k, m  N Typically, k  { 0, 1 }. Terminology:  In the first case, the sequence is said to be infinite; in the second, it is said to be finite, and of length m.  a n, is called a term of the sequence and denotes the image of the integer n.  {a n } denotes the sequence. Do not confuse the above notation with set notation. This is a “misuse” of the set notation.

3 MSU/CSE 260 Fall 2009 3 A function that generates pseudo random integers. Choose some prime P, say 11 Choose some starting value S, say 5. Choose a “generator”G, say 7. F(1) = 5 (= S) F(k) = F(k-1) * 7 modulo 11 (F(k-1)*G mod P)) Worksheet: Run the sequence for 11, 7, 5

4 MSU/CSE 260 Fall 2009 4 What are random numbers for? Assigning probabilities for events in games or simulations. Generating unbiased test data. Creating novel graphics, etc. Typical random number generator generates random bits or maps integers into the “reals” in the interval [0, 1). (See MATLAB or C rand.)

5 MSU/CSE 260 Fall 2009 5 5 Example

6 MSU/CSE 260 Fall 2009 6 6 Example

7 MSU/CSE 260 Fall 2009 7 7 Geometric Progression A geometric progression is a sequence of the form: a, ar, ar 2, …, ar n where the initial term, a, and common ratio, r, are real numbers.  A geometric progression is a discrete analogous of the exponential function f (x) = ar x.

8 MSU/CSE 260 Fall 2009 8 8 Examples The sequence {b n }, where b n = (-1) n for n = 1, 2, 3… starts with: -1, 1, -1, 1, … The sequence {c n }, where c n = 2 n for n = 0, 1, 2, 3… starts with: 1, 2, 4, 8, 16, … (Consider the number of nodes in a perfect binary tree.) The sequence {d n }, where d n = 6 · (1/3) n for n = 1, 2, 3… starts with: 2, 2/3, 2/9, 2/27, …

9 MSU/CSE 260 Fall 2009 9 9 Arithmetic Progression An arithmetic progression is a sequence of the form a, a+d, a+2d, …, a+nd where the initial term, a, and the common difference, d, are real numbers.  A arithmetic progression is a discrete analogous of the linear function f (x) = dx + a.

10 MSU/CSE 260 Fall 2009 10 Examples The sequence {s n }, where s n = – 1 + 4n for n =1,2,3… starts with: 3, 7, 11, … The sequence {t n }, where t n = 7 – 3n for n =1, 2, 3… starts with: 4, 1, -2, …

11 MSU/CSE 260 Fall 2009 11 Strings Strings are sequences of the form a 1 a 2 …a n, where the codomain is the set of characters  The length of the string is the number of its terms  The empty string is the string that has no terms

12 MSU/CSE 260 Fall 2009 12 Special Integer Sequences To deduce a possible formula/rule for the terms of a sequence from initial terms, ask the following:  Are there runs of the same value?  Are terms obtained from previous terms by adding the same amount or an amount that depends on the position in the sequence?  Are terms obtained from previous terms by multiplying by a particular amount?  Are terms obtained by combining previous terms in a certain way?  Are there cycles among the terms?

13 MSU/CSE 260 Fall 2009 13 Examples Consider the sequence 5, 11, 17, 23, 29, 35, 41, 47, 53, 59… Describe {a n } {a n } = 5 +6n n = 0, 1, 2,… 666

14 MSU/CSE 260 Fall 2009 14 Examples Consider the sequence 1, 7, 25, 79, 241, 727, 2185, 6559, 19681, Describe {a n } Answer:  A n = 3 n - 2 61854

15 MSU/CSE 260 Fall 2009 15 Useful Sequences nth TermFirst 10 Terms n2n2 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, … n3n3 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, … n4n4 1, 16, 81,256,625,1296,2401,4096,6561,10000,… 2n2n 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, … n!n!1,2,6,24,120,720,5040,40320,362880,3628800,…

16 MSU/CSE 260 Fall 2009 16 Summations Consider the sequence {a k }. We define the following summation: Terminology: j is called the index of summation, m is the lower limit, n is the upper limit.

17 MSU/CSE 260 Fall 2009 17 Summations…

18 MSU/CSE 260 Fall 2009 18 Worksheet problem: P 103 *35 Given two sequences (sets?) of positive reals {X j } and {Y j } Define the function F(k) =  j=1, 2, … k (X j * Y j ) Show that this function is maximized when both sets are sorted into ascending order. (Note here that we are changing the order in the sequences.) Consider the “student credit default swap” problem/solution!

19 MSU/CSE 260 Fall 2009 19 Summations…


Download ppt "MSU/CSE 260 Fall 20091 1 Sequences and Summations."

Similar presentations


Ads by Google