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: Recursive definition Margaret M. Fleck 5 March 2010 In this lecture, we see how to define functions and sets recursively, a math ematical technique that closely parallels recursive function calls in computer programs. 1 Announcements Exams were returned in lecture today. If you missed lecture, well also bring them to discussion sections next week and afterwards you can get them at office hours. 2 Recursive definitions Youve all seen recursive procedures in programming languages. Recursive function definitions in mathematics are basically similar. A recursive definition defines an object in terms of smaller objects of the same type. Because this process has to end at some point, we need to include explicit definitions for the smallest objects. So a recursive definition always has two parts: Base case or cases Recursive formula/step 1 Recursive definitions are sometimes called inductive definitions or (espe cially for numerical functions) recurrence relations. For example, recall that the factorial function n ! is defined by n ! = n ( n 1) . . . 2 1. We can define the factorial function n ! recursively: 0! = 1 n ! = n ( n 1)! The recursive definition gets rid of the annoyingly informal . . . and, therefore, tends to be easier to manipulate in formal proofs or in computer programs. Notice that the base and inductive parts of these definitions arent ex plicitly labelled. This is very common for recursive definitions. Youre just expected to figure out those labels for yourself. Heres another recursive definition of a familiar function: g (1) = 1 g ( n ) = g ( n 1) + n This is just another way of defining the summation n i =1 n . This par ticular recursive function happens to have a nice closed form: n ( n +1) 2 . Some recursivelydefined functions have a nice closed form and some dont, and its hard to tell which by casual inspection of the recursive definition....
View
Full
Document
This note was uploaded on 09/21/2011 for the course CS 173 taught by Professor Erickson during the Spring '08 term at University of Illinois, Urbana Champaign.
 Spring '08
 Erickson

Click to edit the document details