{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lect_19 - Recursive denition Margaret M Fleck 5 March 2010...

This preview shows pages 1–3. Sign up to view the full content.

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, we’ll also bring them to discussion sections next week and afterwards you can get them at office hours. 2 Recursive definitions You’ve 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

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
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 aren’t ex- plicitly labelled. This is very common for recursive definitions. You’re just expected to figure out those labels for yourself. Here’s 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 recursively-defined functions have a nice closed form and some don’t, and it’s hard to tell which by casual inspection of the recursive definition.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 7

lect_19 - Recursive denition Margaret M Fleck 5 March 2010...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online