Download presentation
Presentation is loading. Please wait.
Published byKristian Quinn Modified over 9 years ago
1
Recursion
2
The Fibonacci sequence presented in 1201 by Leonardo Fibonacci is one of the most famous. It looks like this 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,... After the first two numbers each number is the sum of the two numbers that precedes it.
3
The formula a n = a n-1 + a n-2 is an example of a recursive formula. Definition of a recursive formula. A recursive formula has two parts. The value(s) of the first term(s) A recursion equation that shows how to find each term from the term(s) before it.
4
Example 1. Find the first five terms of the sequence in which a 1 = 5 and a n+1 = 2a n + 3, n≥1. a 1 = 5. n=1a 1+1 = 2a n + 3 a 2 = 2(5) + 3 a 2 = 13
5
Example 1. Find the first five terms of the sequence in which a 1 = 5 and a n+1 = 2a n + 3, n≥1. n=1a 1+1 = 2a n + 3 a 2 = 2(5) + 3 a 2 = 13 n=2a 2+1 = 2a 2 + 3 a 3 = 2(13) + 3 a 3 = 29
6
Example 1. Find the first five terms of the sequence in which a 1 = 5 and a n+1 = 2a n + 3, n≥1. n=2a 2+1 = 2a 2 + 3 a 3 = 2(13) + 3 a 3 = 29 n=3a 3+1 = 2a 3 + 3 a 4 = 2(29) + 3 a 4 = 61
7
Example 1. Find the first five terms of the sequence in which a 1 = 5 and a n+1 = 2a n + 3, n≥1. n=3a 3+1 = 2a 3 + 3 a 4 = 2(29) + 3 a 4 = 61 n=4a 4+1 = 2a 4 + 3 a 5 = 2(61) + 3 a 5 = 125
8
Example 1. Find the first five terms of the sequence in which a 1 = 5 and a n+1 = 2a n + 3, n≥1. So the first 5 terms are 5, 13, 29, 61, and 125.
9
Example 2. Find the first three iterates x 1, x 2, x 3, of the function f(x) = 3x + 1 for an initial value of x 0 = 1 x 1 = f(1)= 3(1)+1= 4 x 2 = f(4)= 3(4)+1= 13 x 3 = f(13)= 3(13)+1= 40 The first three iterates are 4,13,40.
10
Example 3. You invest in a savings account that pays 6% interest compounded annually. Find the balance in the account after 3 years. For compounded interest New balance=Old balance+interest b n = b n-1 + 0.06b n-1
11
Example 3. $500 @ 6%, compounded annually, 3 years. b n = b n-1 + 0.06b n-1 b 1 = 500 + 0.06500 b 1 = 530 b 2 = 530 + 0.06530 b 2 = 561.80 b 3 = 561.80 + 0.06561.80 b 3 = 595.51
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.