Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sequences and Summations ICS 6D Prof. Sandy Irani.

Similar presentations


Presentation on theme: "Sequences and Summations ICS 6D Prof. Sandy Irani."— Presentation transcript:

1 Sequences and Summations ICS 6D Prof. Sandy Irani

2 Sequences A sequence is a special case of a function in which the domain is a consecutive set of integers: – For example: a person’s height measured in inches on each birthday. (The person for this example if 5 years old). h 0 = 20, h 1 = 30, h 2 = 34, h 3 = 37, h 4 = 40, h 5 = 43 – h 3 is the fourth term of the sequence. – 3 is the index of the term h 3 – {h j } (in curly braces) refers to the entire sequence.

3 Sequences A finite sequence has a finite domain: h 0 = 20, h 1 = 30, h 2 = 34, h 3 = 37, h 4 = 40, h 5 = 43 An infinite sequence has an infinite domain: h 2 = 1, h 3 = 2, h 4 = 4, h 5 = 8, h 6 = 16, h 7 = 32,…..

4 Ways to specify a sequences List the numbers. h 0 = 20, h 1 = 30, h 2 = 34, h 3 = 37, h 4 = 40, h 5 = 43 – Average rainfall in California since 1950. – Average weight of a child in the US by age. Give an explicit formula for the sequence. – Example: Initial index = 1. f n = 2 n + 2n f 1 = 4, f 2 = 8, f 3 = 14, f 4 = 24, f 5 = 42,…..

5 Ways to specify a sequences Recurrence relation Base case: one or more initial values f 0 = 1 f 1 = 1 Recursive rule: a rule for determining the next term in the sequence as a function of terms that appear earlier in the sequence (recurrence relation): f n = f n-1 + f n-2, for n  2

6 Fibonacci Sequence f 0 = 1 f 1 = 1 f n = f n-1 + f n-2, for n  2

7 More recurrence relations: g 0 = 0 g n = g (n div 2) + 1, for n  1. “n div 2” = n/2

8 More recurrence relations: h 1 = 2 h 2 = -1 h 3 = 3 h j+1 = h j + 2h j-1 - 3h j-2, for j  3 Need enough initial values in the base case to specify the sequence

9 Recurrence Relations Useful for modeling dynamical systems: Biology: population growth Finance: market growth or interest accumulation Useful in computer science The number of operations performed by a recursive algorithm on an input of a given size.

10 Fibonacci Sequence f 0 = 1 f 1 = 1 f n = f n-1 + f n-2, for n  2 – Developed by Leonardo Fibonacci to describe the population growth of a colony of rabbits. – How big is the rabbit colony after 100 months? – How long does it take the rabbit colony to reach 1000 rabbits? » Need an explicit formula for f n

11 Solving a Recurrence Given a recurrence relation that defines a sequence – Base case – Recursive Rule Find an explicit formula for the sequence: – f n = a mathematical function that depends only on n and not on earlier terms in the sequence.

12 Geometric Sequence g 0 = a (a = initial value) g n = r · g n-1 (r = common ratio), for n  1. Explicit formula:

13 Geometric Sequence Examples a = 5, r = 2 a = 1, r =.1 a = 2, r = -1 g 0 = 4, g 1 = 12, g 2 = 36, g 3 = 108,….

14 Arithmetic Sequence h 0 = a (a = initial value) h n = d + h n-1 (d = common difference) for n  1. Explicit formula:

15 Arithmetic Sequence Examples a = 5, d = 2 a = 1, d =.1 a = 2, d = -1 g 0 = 4, g 1 = 9, g 2 = 14, g 3 = 19,….

16 Summations Compact expression for the sum of the terms in a mathematical sequence.

17 Summations If the terms in the sequence have an explicit formula, then the value of the sum can be computed: Parentheses are important:

18 Summations If the upper limit is a variable, then the value of the sum is a function of that variable:

19 Summations Sometimes, we need to pull out one or more terms from the summation.

20 Summations A closed form for a summation, expresses the value of the sum (without a summation)

21 Closed form for the sum of terms in a geometric sequence Geometric sequence: Initial value a, common ratio r, n = # of terms:

22 Closed form for the sum of terms in an arithmetic sequence Arithmetic sequence: Initial value a, common difference d, n = # of terms:


Download ppt "Sequences and Summations ICS 6D Prof. Sandy Irani."

Similar presentations


Ads by Google