1 / 36

Section 8.1 Recursive Thinking Page 409

Section 8.1 Recursive Thinking Page 409. In Chapter One we were given the recurrence relation and had to fill in the table. EXAMPLE: n T n T n = 2n + T n-1 1 10 2 3 4 5. EXAMPLE: Given the following recurrence table find the recurrence relation that forms the table.

allendaniel
Download Presentation

Section 8.1 Recursive Thinking Page 409

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Section 8.1 Recursive Thinking Page 409 In Chapter One we were given the recurrence relation and had to fill in the table. EXAMPLE: n Tn Tn = 2n + Tn-1 1 10 2 3 4 5

  2. EXAMPLE: Given the following recurrence table find the recurrence relation that forms the table. n Tn 1 2 2 6 3 10 4 14 5 18 Hint: A recurrence relation MUST have Tn-1 somewhere in the formula (you must use a previous answer to form the next one.

  3. n Tn 1 2 2 6 3 10 4 14 5 18 “Where do I start?” Ask yourself what am I doing to the previous number to get the next one. Are the numbers getting larger or smaller? Are they increasing by the same amount each time or different amounts? In this example, the numbers are increasing and by the same amount each time (by 4). We are adding 4 to the previous number. So, the recurrence relation is: Tn = Tn-1 + 4 Means “previous number”

  4. n Tn 1 2 2 6 3 10 4 14 5 18 Now, the Closed-form solution. The Closed-form solution is the formula that will give us the value of Tn by plugging in the value for n. This will NEVER have Tn-1 in it. Why do we need to find the closed-form solution? What if we want to find the 200th number on the table? What can I do to the value of n in each row to given me the value for Tn in that same row? For now, we will have to guess and check.

  5. n Tn 1 2 2 6 3 10 4 14 5 18 Let’s try multiply the value of n by 2. n=1 then 1 x 2 = 2 n=2 then 2 x 2 = 4 n=3 then 3 x 2 = 6 n=4 then 4 x 2 = 8 Compare the product on each line to the value of Tn The value of 2n is always less than the value of Tn, so we need to add to Tn. Find a pattern in the amount 2n is less than Tn n Tn 2n 1 2 2 0 less than Tn 2 6 4 2 less than Tn 3 10 6 4 less than Tn 4 14 8 6 less than Tn 5 18 10 8 less than Tn Make a equation using n to form the pattern found.

  6. n Tn 2n+2n - 2 1 2 2+0 2 6 4+2 3 10 6+4 4 14 8+6 5 18 10+8 A pattern of all even numbers of often 2n, 2n - 2 , or 2n + 2 We have 2n + 2n - 2 and we can simplify that to 4n – 2. The closed-form solution is: Tn = 4n – 2. It is possible to come up with different closed-form solution, so check your solution and make sure it does generate the same values as the given chart.

  7. Let Vn be the total number of vertices in a complete binary tree. (A binary tree is complete if each vertex of the tree has either two or no children.) Level 0 will be the root of the tree. a.) Make a table for the levels 0 through 5 (try drawing to tree and counting the vertices.) b.) Find the recurrence relation. c.) Find the closed-form solution.

  8. n Vn 0 1 1 3 2 3 4 b.) The recurrence relation is: Tn = Tn = c.) The closed-form solution is: Tn =

  9. Fixed Point Page 414 The fixed point is value when used in the recurrence relation all of the following values in the table are the same. n Tn Tn = 2 Tn-1 – 4 1 4 2 Fill in the chart. 3 4 5

  10. Finding the fixed point. We want the value for Tn-1 that we can plug into the equation so that Tn and Tn-1 are equal. Set Tn and Tn-1 equal to X and solve for X. If Tn = 2 Tn-1 – 4 , Then Solve

  11. Section 8.2 Finite Differences Page 418 Finding Closed-form solutions n Tn 1 0 2 1 3 3 4 6 5 10 Make a third column (a difference column) by subtract the value of Tn by the value of Tn-1. Keep making difference columns until all the values are the same (they do not have to be ones.)

  12. n Tn D1 D2 1 0 2 1 3 3 4 6 5 10

  13. n Tn D1 D2 1 0 2 1 3 3 4 6 5 10 make into a matrix

  14. For the following sets of numbers find the closed-form solution. (you may want to rewrite them in a table so they look like the other problem) a.) 3, 11, 21, 33, 47, 63, … b.) 1.3, 1.9, 2.5, 3.1, 3.7, 4.3, … c.) 4, 33, 96, 205, 372, 609, …

  15. Number sequencesClosed-form solutions a.) 3, 11, 21, 33, 47, 63, … Tn = b.) 1.3, 1.9, 2.5, 3.1, 3.7, 4.3, … Tn = c.) 4, 33, 96, 205, 372, 609, … Tn = Tn =

  16. Section 8.3 Arithmetic and Page 426 Geometric Recurrence relations Definitions: Arithmetic sequence – a number pattern formed by adding a constant amount to the previous value to find the next value. Common difference – the constant that you are adding in a arithmetic sequence. Geometric sequence – a number pattern formed by multiplying a constant amount to the previous value to find the next value. Common ratio – the amount you are multiplying in a geometric sequence.

  17. Common difference First term Term number we are looking for EXAMPLE: Arithmetic Sequence 5, 9, 13, 17, 21, … The Recurrence relation is: Tn = Tn-1 + 4 “adding 4 to the previous number” The closed-form can be done two ways: 1.) Use matrix method from Section 2 2.) Formula: Tn = t1 + (n – 1) (d) Closed-form: Tn = 5 + (n – 1)(4) or Tn = 4n + 1

  18. EXAMPLE: Geometric Sequence 100, 50, 25, 12.5, 6.25, … The recurrence relation is: Tn = Tn-1 x (.5) “multiply the previous number by .5” it must be what you are multiplying by The closed-form solution uses the following formula: Tn = t1 ( r n-1) Common ratio First term Term we are looking for Tn = 100 (.5 n -1)

  19. EXAMPLE: Find the Arithmetic or Geometric Closed-form solutions and the 100th term. a.) 1, 6, 11, 16, 21, … b.) 52.5, 52.26, 52.02, 51.78, 51.54, … c.) 4, 20, 100, 500, 2500, 12500, … d.) 2.5, 3, 3.6, 4.32, 5.184, 6.2208, …

  20. a.) Tn = T100 = = b.) Tn = T100 = = c.) Tn = T100 = = d.) Tn = T100 = =

  21. A Series is the sum of the first n numbers in a sequence. There are two kinds of series, Arithmetic and Geometric. An Arithmetic series is the sum of the first n numbers in a Arithmetic sequence and a Geometric series is the sum of the first n numbers of a geometric sequence. Arithmetic: Sn = 0.5dn2 + ( t1 – 0.5d)n Common difference First term in sequence Term you are looking for

  22. Geometric: Sn = t1 ( 1 – r n) (1 – r) Term you are looking for Common ratio First term

  23. EXAMPLE: Find the sum of the first 200 terms of each of these sequences. a.) 1, 6, 11, 16, 21, … b.) 52.5, 52.26, 52.02, 51.78, 51.54, … c.) 4, 20, 100, 500, 2500, 12500, … d.) 2.5, 3, 3.6, 4.32, 5.184, 6.2208, …

  24. a.) • b.) • c.) • d.)

  25. Section 8.4 and 8.5 Mixed Recurrence Page 439 Relations A Mixed Recurrence is one that combine the Arithmetic and the Geometric, in other words you are multiplying and adding to form the pattern. n Tn 1 7 2 26 3 83 4 254 5 767 6 2306 For the following sequence find the first three difference columns

  26. n Tn D1 D2 D3 1 7 2 26 3 83 4 254 5 767 6 2306

  27. The formula for MIXED recurrence relations is: Tn = a T n-1 + b “a” if the common multiple we found in the difference columns, in this example a = 3. We will find b by plugging in values from the chart for Tn and T n-1 and a and solving for b. For this example 26 = 3 (7) + b So, the recurrence relation is 26 = 21 + b Tn = 3 T n-1 + 5 5 = b

  28. Find the recurrence relation for the each of the following sequences: a.) 1, 3, 7, 15, 31, … b.) 5000, 4500, 3900, 3180, 2316, … a.) Tn = b.) Tn =

  29. Annuity – an account that makes regular contributions of the same amount on a consistent time basis. EXAMPLE: An account pays 8% annual interest compounded monthly, to which monthly additions are made of $500. The account is started with $300. Month Balance ($) 0 300 1 1.007(300) + 500 = 802.10 2 1.007 (802.10) + 500 = 1307.71 3 1.007( 1307.71) + 500 = 1816.86

  30. What if we want to see how much money we will have in 30 years? Making a chart will take too long. How do we do this in the calculator? Press MODE Change fourth row to SEQ Press y= nMin = (this is the starting number for first column, this will either be a 0 or a 1 depending on whether there is money in the account before we start earning interest) u(n) = (this is where you will enter your recurrence relation) u(nMin) = (this is the first value in the second column of the chart, the starting amount)

  31. EXAMPLE: An account pays 8% annual interest compounded monthly, to which monthly additions are made of $500. The account is started with $300. In the calculator: nMin = 0 u(n) = 1.007*u(n-1) + 500 U(nMin) = {300} This will always be 1.interest rate This will be in every problem Monthly payment Starting money

  32. Looking at the table: Press 2nd and Graph to bring up the table To change the starting n-value of the table: Press 2nd and Window and change the value for Tblstart= How much money did I put in and how much was interest? Multiply number of months by monthly payments to find your amount Now, take your amount minus account total to find out how much was interest.

  33. Credit Cards You owe $25000 and the card has an APR of 12% compounded monthly. You pay $500 a month, how long before the card is paid off in full (if you charge nothing else)

  34. 12% = .12 then divide .12 by 12 = .01 nMin = 0 u(n) = 1.01*u(n-1) – 500 u(nMin) = {25000}

  35. Section 8.5 Mixed Recurence Page 449 Closed-form Solution Tn = (t1 – p)(a n-1) + p t1 = the first term p = the fixed point a = common ratio in the difference column (the same as “a” from the recurrence relation) n = the term you are looking for

  36. Finding the fixed point: Tn = 3 t n-1 + 5 X = 3 x + 5 -3x -3x -2x = 5 X = -2.5 Or p = b 1 – a = 5 1 – 3 p = -2.5 n Tn D1 1 7 -- 2 26 19 3 83 57 4 254 171 5 767 513 6 2306 1539 Tn = (t1 – p)(a n-1) + p (7 - -2.5)(3 n-1) + -2.5 = 9.5(3 n-1) – 2.5 X 3, so a = 3

More Related