Sequences and Summations MSUCSE 260 Fall 2009 1
- Slides: 19
Sequences and Summations MSU/CSE 260 Fall 2009 1
Sequences Definition: A sequence is a function whose domain D is a subset of N ={0, 1, 2, …} of the form: n D = { k, k+1, k+2, … }, for some k N, or D = { k, k+1, k+2, …, k + m }, for some k, m N q q Typically, k { 0, 1 }. Terminology: n n In the first case, the sequence is said to be infinite; in the second, it is said to be finite, and of length m. an, is called a term of the sequence and denotes the image of the integer n. {an} denotes the sequence. q q q n Do not confuse the above notation with set notation. This is a “misuse” of the set notation. MSU/CSE 260 Fall 2009 2
A function that generates pseudo random integers. n n n 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 MSU/CSE 260 Fall 2009 3
What are random numbers for? n n 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. ) MSU/CSE 260 Fall 2009 4
Example MSU/CSE 260 Fall 2009 5
Example MSU/CSE 260 Fall 2009 6
Geometric Progression n A geometric progression is a sequence of the form: a, ar 2, …, arn where the initial term, a, and common ratio, r, are real numbers. q A geometric progression is a discrete analogous of the exponential function f (x) = arx. MSU/CSE 260 Fall 2009 7
Examples n n n The sequence {bn}, where bn= (-1)n for n = 1, 2, 3… starts with: -1, 1, … The sequence {cn}, where cn= 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 {dn}, where dn= 6·(1/3)n for n = 1, 2, 3… starts with: 2, 2/3, 2/9, 2/27, … MSU/CSE 260 Fall 2009 8
Arithmetic Progression n An arithmetic progression is a sequence of the form a, a+d, a+2 d, …, a+nd where the initial term, a, and the common difference, d, are real numbers. q A arithmetic progression is a discrete analogous of the linear function f (x) = dx + a. MSU/CSE 260 Fall 2009 9
Examples n n The sequence {sn}, where sn= – 1 + 4 n for n =1, 2, 3… starts with: 3, 7, 11, … The sequence {tn}, where tn= 7 – 3 n for n =1, 2, 3… starts with: 4, 1, -2, … MSU/CSE 260 Fall 2009 10
Strings are sequences of the form a 1 a 2…an, where the codomain is the set of characters n q q The length of the string is the number of its terms The empty string is the string that has no terms MSU/CSE 260 Fall 2009 11
Special Integer Sequences To deduce a possible formula/rule for the terms of a sequence from initial terms, ask the following: n q q q 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? MSU/CSE 260 Fall 2009 12
Examples n Consider the sequence 5, 11, 17, 23, 29, 35, 41, 47, 53, 59… Describe {an} 6 n 6 6 {an} = 5 +6 n n = 0, 1, 2, … MSU/CSE 260 Fall 2009 13
Examples n Consider the sequence 1, 7, 25, 79, 241, 727, 2185, 6559, 19681, Describe {an} 6 18 54 Answer: n q An = 3 n - 2 MSU/CSE 260 Fall 2009 14
Useful Sequences nth Term First 10 Terms n 2 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, … n 3 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, … n 4 1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, … 2 n 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, … n! 1, 2, 6, 24, 120, 720, 5040, 40320, 3628800, … MSU/CSE 260 Fall 2009 15
Summations n n Consider the sequence {ak}. We define the following summation: Terminology: j is called the index of summation, m is the lower limit, n is the upper limit. MSU/CSE 260 Fall 2009 16
Summations… MSU/CSE 260 Fall 2009 17
Worksheet problem: P 103 *35 n n Given two sequences (sets? ) of positive reals {Xj} and {Yj} Define the function F(k) = j=1, 2, … k(Xj * Yj) 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! MSU/CSE 260 Fall 2009 18
Summations… MSU/CSE 260 Fall 2009 19
- Splitting up summations
- Summation
- Summations
- Eece ubc
- Closed form summation
- Tener future conjugation
- 260/280 ratio
- Uomr
- Dos cajas de galletas contienen en total 260 galletas
- Cse 260
- Realidades 3 capitulo 6 el futuro (p. 260)
- Ed 260
- Ucsd cse 260
- Chem 260 umich
- Ucas points
- 260 nm absorbance
- Cse 260 msu
- Reishauer rz 260
- Si9a
- How old is hamlet in act 5