This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 3. RECURRENCE 120 3. Recurrence 3.1. Recursive Definitions. To construct a recursively defined function: 1. Initial Condition(s) (or basis): Prescribe initial value(s) of the function. 2. Recursion: Use a fixed procedure (rule) to compute the value of the function at the integer n + 1 using one or more values of the function for integers n . To construct a recursively defined set: 1. Initial Condition(s) (or basis): Prescribe one or more elements of the set. 2. Recursion: Give a rule for generating elements of the set in terms of previously prescribed elements. Discussion In computer programming evaluating a function or executing a procedure is often accomplished by using a recursion . A recursive process is one in which one or more initial stages of the process are specified, and the n th stage of the process is defined in terms of previous stages, using some fixed procedure. In a computer program this is usually accomplished by using a subroutine, such as a For loop, in which the same procedure is repeated a specified number of times; that is, the procedure calls itself . Example 3.1.1 . The function f ( n ) = 2 n , where n is a natural number, can be defined recursively as follows: 1. Initial Condition: f (0) = 1 , 2. Recursion: f ( n + 1) = 2 f ( n ) , for n . For any particular n , this procedure could be programmed by first initializing F = 1 , and then executing a loop For i = 1 to n , 2 * F = F . Here is how the definition gives us the first few powers of 2: 2 1 = 2 0+1 = 2 2 = 2 2 2 = 2 1+1 = 2 1 2 = 2 2 = 4 2 3 = 2 2+1 = 2 2 2 = 4 2 = 8 3. RECURRENCE 121 3.2. Recursive Definition of the Function f ( n ) = n ! . Example 3.2.1 . The factorial function f ( n ) = n ! is defined recursively as follows: 1. Initial Condition: f (0) = 1 2. Recursion: f ( n + 1) = ( n + 1) f ( n ) Discussion Starting with the initial condition, f (0) = 1, the recurrence relation, f ( n + 1) = ( n + 1) f ( n ), tells us how to build new values of f from old values. For example, 1! = f (1) = 1 f (0) = 1, 2! = f (2) = 2 f (1) = 2, 3! = f (3) = 3 f (2) = 6, etc. When a function f ( n ), such as the ones in the previous examples, is defined recursively, the equation giving f ( n + 1) in terms of previous values of f is called a recurrence relation . 3.3. Recursive Definition of the Natural Numbers. Definition 3.3.1 . The set of natural numbers may be defined recursively as fol- lows. 1. Initial Condition: N 2. Recursion: If n N , then n + 1 N . Discussion There are a number of ways of defining the set N of natural numbers recursively. The simplest definition is given above. Here is another recursive definition for N ....
View Full Document
This note was uploaded on 11/27/2011 for the course MCH 108 taught by Professor Penelopekirby during the Fall '08 term at FSU.
- Fall '08