Back in MST121 I learned that the solution of the following first order recurrence equation

$$a_n - 5 a_{n-1}=0 $$

is

$$a_n = a_0 * 5^n.$$

I have been playing around with Mathematica and digging in Discrete Mathematics books and I am now able to solve equations of the type $a_n - c_1 \cdot a_{n-1}=f(n) $, for example if $a_0=1$ the solution of

$$a_n - 5 a_{n-1}=n^2 $$

is

$$a_n = \frac{1}{32}(-8n^2-20n-15+47 \cdot 5^n).$$

Mathematica has a very nice function for solving recurrence equations ( of any order ) which is called RSolve which I only used to verify my own solution. The key to solving recurrence equations of the first order is always finding some sort of sum. Like the sum of the first $n$ integers, which is $\frac{1}{2} n(n+1)$, is in fact the solution of $a_n - a_{n-1} = n$, with $a_0=0$.

13-2016 Open letter to Open Source for You (OSFY)

5 months ago

## No comments:

## Post a Comment