Slide 9
Slide 9 text
Example: Linear recurrence relation solver
MTH 225: Discrete Structures for Computer Science 1
Sequences and Induction Programming Problem 1: Linear homogeneous recurrence
relation solver
Goal of this problem
In this miniproject, you will write a function in Python called rrsolver that does the following:
The function rrsolver accepts four numbers, which are the coefficients and initial conditions of a linear second-order homogeneous
recurrence relation written in the form
and the input would look like rrsolver(c1, c2, A, B). For example, if the recurrence relation were
then the input would be rrsolver(1, 6, 3, 6). In other words there are four inputs, in this order: The coefficient on , the
coefficient on , the value of , and the value of . We assume that the recurrence relation has been written as above, with
on the left side and everything else on the right side. We are also assuming for this problem that we are only dealing with second-order
equations, not third-order or higher.
As you know from class work, linear homogeneous recurrence relations can be solved using the characteristic root method. What the rrsolver
does with its input depends on how many real-number characteristic roots the recurrence relation has:
http://bit.ly/ctdiscrete