An arithmetic function is a discrete analogue of a

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: metic function is a discrete analogue of a linear function dx+a. 6 Strings The data type of a string is nothing but a sequence of finite length. 7 Recurrence Relations 8 Recurrence Relation A recurrence relation for a sequence {an} expresses the term an in terms of previous terms of the sequence. The initial conditions for a recursively defined sequence specify the terms before the recurrence relation takes effect. A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation. 9 Example Let {an} be the sequence defined by the initial condition a0=2 and the recurrence relation an = an-1 + 3 Then a1 =2+3=5, a2=5+3=8, a3=8+3=11,... 10 Fibonacci Sequence Recall that the Fibonacci sequence is defined by the initial conditions: f0=0 and f1=1 and the recurrence relation fn = fn-1+fn-2 for n >= 2. Hence, {fn} = {0,1,1,2,3,5,8,13,...} 11 Solving Recurrence Relations We say that we have solved a recurrence relation if we can find an explicit formula, called a closed formula, for the terms of the sequence. Example: For th...
View Full Document

Ask a homework question - tutors are online