MA/CS 109 DISCUSSION 4 – Brian Borucki

advertisement
MA/CS 109
DISCUSSION 4
Brian Borucki – bborucki@bu.edu
Problem 4
Gen
1 ---------------------
2
6
2 -------------
4
14
8
3 -----
How many people are in a given generation?
2, 4, 8, 16, …
𝟐𝒎 (where m is the generation)
Problem 4
• So the pattern that emerges is this:
M (# of generations)
N (# of people in fam)
1
2
2
6
3
14
4
30
…
…
• Your task is to find two equations:
• One that goes from N -> M
• Another that goes from M -> N
Finding N given M
• Given:
M (# of generations)
N (# of people in fam)
N+2
1
2
4 =4 22
2
6
8 =8 23
3
14
1616
= 24
4
30
3232
= 25
…
…
…
• We notice that every N is consistently 2 away from the
form: 2𝑖
• We can then notice that the exponent is always one more
than the generation
• This gives us: N = 2𝑀+1 − 2
Finding M given N
• Now that we know: N = 2𝑀+1 − 2, all we need to do is
solve for M
𝑁 = 2𝑀+1 − 2
𝑁 + 2 = 2𝑀+1
log 𝑁 + 2 = log 2𝑀+1
log 𝑁 + 2 = 𝑀 + 1
𝑀 = log 𝑁 + 2 − 1
𝑁+2
= log(
)
2
(add 2 to both sides)
(take the log of both sides)
(simplify)
Summing it all up
• How do we compare these functions?
• By how they grow
10
8
6
N^2
(N^2)/2
N
log(N)
4
2
0
0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3
-2
Range: [0,3]
Summing it all up
• How do we compare these functions?
• By how they grow
120
100
80
N^2
(N^2)/2
x
log(x)
60
40
20
0
1
2
3
4
5
6
7
8
Range: [0,10]
9 10
Download