Previous Page Next Page Contents

rec -- the domain of recurrence equations

Introduction

rec(eq, y(n)) represents a recurrence equation for the sequence y(n).

Call(s)

rec(eq, y(n) <, cond>)

Parameters

eq - an equation or an arithmetical expression
y - the unknown function: an identifier
n - the index: an identifier
cond - a set of initial or boundary conditions

Returns

an object of type rec.

Related Functions

ode, solve, sum

Details

Example 1

The first command defines the homogeneous first order recurrence equation y(n+1) = 2*(n+1)/n*y(n) for the sequence y(n). It is solved by a call to the solve function:

>> rec(y(n + 1) = 2*y(n)*(n + 1)/n, y(n))
                   /            2 y(n) (n + 1)           \
                rec| y(n + 1) - --------------, y(n), {} |
                   \                  n                  /
>> solve(%)
                                        n
                                 {n C1 2 }

Thus, the general solution of the recurrence equation is y(n) = C1*n*2^n, where C1 is an arbitrary constant.

Example 2

In the next example, the homogeneous first order recurrence y(n+1) = 3*(n+1)*y(n) with the initial condition y(0)=1 is solved for the unknown sequence y(n):

>> solve(rec(y(n + 1) = 3*(n + 1)*y(n), y(n), {y(0) = 1}))
                               n
                             {3  gamma(n + 1)}

Thus, the solution is y(n) = 3^n*gamma(n+1) = 3^n*n! for all integers n >=0 (gamma is the gamma function).

Example 3

In the following example, the inhomogeneous second order recurrence y(n+2) - 2*y(n+1) + y(n) = 2 is solved for the unknown sequence y(n). The initial conditions y(0)=-1 and y(1)=m with some parameter m are taken into account by solve:

>> solve(rec(y(n + 2) - 2*y(n + 1) + y(n) = 2, y(n),
             {y(0) = -1, y(1) = m}))
                                      2
                              {m n + n  - 1}

Example 4

We compute the general solution of the homogeneous second order recurrence y(n+2) + 3*y(n+1) + 2*y(n) = 0:

>> solve(rec(y(n + 2) + 3*y(n + 1) + 2*y(n), y(n)))
                                   n          n
                           {C6 (-1)  + C7 (-2) }

Here, C6 and C7 are arbitrary constants.

Example 5

For the following homogeneous third order recurrence with non-constant coefficients, the system only finds the polynomial solutions:

>> solve(rec(n*y(n + 3) = (n + 3)*y(n), y(n)))   
                                  {n C9}

Example 6

The following homogeneous second order recurrence with constant coefficients involves a parameter a. The solution set depends on the value of this parameter, and solve returns a piecewise object:

>> solve(rec(a*y(n + 2) = y(n), y(n)))   
               /               {     /  1   \n       /    1   \n }
      piecewise| {0} if a = 0, { C11 | ---- |  + C10 | - ---- |  }
               |               {     |  1/2 |        |    1/2 |  }
               \               {     \ a    /        \   a    /  }
      
                    \
          if a <> 0 |
                    |
                    /

Example 7

The following homogeneous second order recurrence with non-constant coefficients involves a parameter a. Although it has a polynomial solution for a=2, the system does not recognize this:

>> solve(rec(n*y(n + 2) = (n + a)*y(n), y(n)))   
                                    {0}

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000