Recursive Definitions: Sets and Functions - Prof. Dali Wang, Study notes of Discrete Structures and Graph Theory

Recursive definitions, which are used to define sets, equations, or processes by defining a starting point and providing a rule for continuing to build on previously defined items. Recursive definitions consist of a basis and recursion, where the basis defines values for some finite number of elements, and the recursion defines remaining elements based on previously defined items. Two examples are provided for sets and functions, including the natural numbers and the fibonacci sequence.

Typology: Study notes

Pre 2010

Uploaded on 08/16/2009

koofers-user-63f
koofers-user-63f 🇺🇸

5

(1)

10 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Recursive
Section 3.4 Recursive Definitions
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Recursive Definitions: Sets and Functions - Prof. Dali Wang and more Study notes Discrete Structures and Graph Theory in PDF only on Docsity!

Recursive

Section 3.4 Recursive Definitions

Recursive Definitions Recursive form „^ Recursive form

defines a set, an equation,

or a process by defining a starting set orvalue and giving a rule for continuing to buildthe set, equation, or process based onpreviously defined items.

Recursive Definitions Recursive Definition „^ Recursively Defined Functions^ Function,

F , defined on nonnegative integers. To give a recursive definition of

F :

„^ (Basis)

Specify

F (0). „^ (Recursive Step)

Give a rule for defining F ( n +1)

from^ F

evaluated at smaller values.

Recursive Definitions Example „^ Example (set):A recursive definition of N (set of naturalnumbers)1.^ Basis: 0 is in N (0 is the BBB).2.^ Induction: if n is in N then so is n + 1 (how to build newobjects from old: “add one to an old object toget a new one”).

Recursive Definitions Example „^ Example (function):A recursive definition of the

Fibonacci sequence

(Classical): A young pair of rabbits (one for each sex) isplaced on a island. After they are 2 months old, each pairproduces another pair each month. The number of pairsof rabbits after n month is f(n).1.^ Basis: f(0) = f(1) = 1(two initial conditions)2.^ Induction: f(n + 1) = f (n) + f(n - 1)(the recurrence equation).

Recursive Definitions Example „^ Example (set):A recursive definition of the set of strings over a finitealphabet.An^ alphabet

Σ^ is a finite set. A^ string

over^ Σ^

is a finite sequence of symbols from

The set of all strings over

Σ^ is denoted by

The^ empty string

(the string containing no symbols) is the string containing no symbols. Its length is 0 and it isdenoted by

λ. (Note

λ∈ Σ ***** .) wx^ ∈ Σ *****

whenever w

∈ Σ *****^ and x

A^ language

over^ Σ^ is a subset of

Recursive Definitions Example „^ Example: Given the recurrence relation a

n=2an-1^ -a

n-2^ , for n=2, 3,

4, … Determine if sequence {a

n^ } is a solution if,

a=3nn

Recursive Definitions ExampleCompound Interest:On your 21

st^ birthday you get a letter informing you that on

the day you were born, an eccentric rich aunt deposited$100,000 in a bank account earning 4% interestcompounded annually and she now intends to turn theaccount to you (provided that you can figure out thequestions bellow).1). Find out the worth of the account k year after you wereborn using a recursive definition.2). Find a closed-form representation of the account worth(for^ k th year) and prove that it is valid.