Solving Difference Equations with
Mathematica and Future Directions

Ünal Gökta\(s\+~\)
Wolfram Research, Inc.
unalg@wolfram.com
April 10, 2003

Introduction

In 5.0, we are going to have a new System function RSolve,  for solving difference (recursion) equations. RSolve has up-to-date core solvers and is modular and easy to plug new methods into as they become available.

Overview

Parser

Single Equation (also system looking independent equations)

ODE and also ODE alike PDEs

First Order

Standard Methods

Linear

Riccati

Trigonometric Power Solutions

Exp Equation

Cos Equation

Sin Equation

Tan Equation

Cot Equation

Sec Equation

Csc Equation

Transformations

y[x+dord] -> a*(b+c*y[x]^n+...+y[x+j]^n+...)^(1/n) with z[x] -> y[x]^n

y[x+1] -> F with z[x] -> Log[y[x]]

y[x+1] -> F with z[x] -> 1/y[x]

y[x+1] -> F with z[x] -> y[x+1]-y[x]

y[x+1] -> F with z[x] -> y[x+1]-x*y[x]

Symmetry Patterns

ξ=a*y[x]+b[x]

ξ=Sqrt[a*y[x]+b[x]]

ξ=a[x]*Exp[y[x]]

Second/Higher Order

Linear

Standard Methods

Constant Coefficients

Exact

To First Order

Special Functions

BesselJ - BesselY

BesselI - BesselK

GegenbauerC

ChebyshevT - ChebyshevU

LegendreP - LegendreQ

HermiteH

Hypergeometric0F1

Hypergeometric0F1Regularized

Hypergeometric1F1

Hypergeometric1F1Regularized

Hypergeometric2F1Regularized

HypergeometricU

JacobiP

LaguerreL

Rational and PFQ Type Solutions (with reduction of order)

Further Transformations

y[x+dord] -> a*(b+c*y[x]^n+...+y[x+j]^n+...)^(1/n) with z[x] -> y[x]^n

y[x+1] -> F with z[x] -> Log[y[x]]

y[x+1] -> F with z[x] -> 1/y[x]

y[x+1] -> F with z[x] -> y[x+1]-y[x]

y[x+1] -> F with z[x] -> y[x+1]-x*y[x]

Variation of Parameters

Nonlinear

Transformations

y[x+dord] -> a*(b+c*y[x]^n+...+y[x+j]^n+...)^(1/n) with z[x] -> y[x]^n

y[x+1] -> F with z[x] -> Log[y[x]]

y[x+1] -> F with z[x] -> 1/y[x]

y[x+1] -> F with z[x] -> y[x+1]-y[x]

y[x+1] -> F with z[x] -> y[x+1]-x*y[x]

PDE

Linear

Standard Methods

Coefficients with missing variables

Symbolic method

Laplace's method

Nonlinear - to do

System of Equations

ODE

Linear

Constant Coefficients

Matrix Power

Rational Coefficients

Abramov - Bronstein Method

Nonlinear

Patterns

DAE

Constant Coefficients

Variable Coefficients - to do

PDE - to do

q-difference equations

Boundary Value Problem

Testing

Tested against well-known books by Mickens, Kelley & Peterson, Elaydi, etc.

Examples

Example

RSolve[y[x + 1/2] == y[x - 1/2], y[x], x]

Example

RSolve[{-y[x]^2 + y[1 + x]^2 == 0, 
        v[x + 1] - v[x] == 0}, {y[x], v[x]}, x]

Example

RSolve[(-y[x])*y[1 + x] + y[1 + x]^2 - y[x]*y[3 + x] + 
          y[1 + x]*y[3 + x] == 0, y[x], x]

Example

RSolve[y[x + 2, t] == y[x, t], y, {x, t}]

Example

RSolve[y[x + 1] == 1/x*y[x] + x, y[x], x]

Example

RSolve[
      k*y[k + 1]*y[k] - 1/(k + 2)*y[k + 1] + 1/(k - 1)*y[k] == 
        0, y[k], k]

Example - Logistic Equation

RSolve[x[1 + k] == 2*(1 - x[k])*x[k], x[k], k]

Example - Logistic Equation

RSolve[x[1 + k] == 4*(1 - x[k])*x[k], x[k], k]

Example

RSolve[
      x[1 + k] == 
        2 + 3*(-2 - (4/27)*(-2 + x[k])^3 + x[k]), x[k], 
      k]

Example - Julia Equation

RSolve[
      x[1 + k] == 
        a + (2*(-a + x[k]))/(1 - (-a + x[k])^2/b^2), 
      x[k], k]

Example

RSolve[
      x[1 + k] == 
        2 + (3*(1 - (28/9)*(-2 + x[k])^2 + (70/
                          81)*(-2 + x[k])^4 - (28/
                          729)*(-2 + x[k])^6 + (-2 + 
                            x[k])^8/
                      6561))/((-(8/3))*(-2 + 
                      x[k]) + (56/27)*(-2 + x[k])^3 - (56/
                      243)*(-2 + 
                        x[k])^5 + (8*(-2 + x[k])^7)/2187), 
      x[k], k]

Example - Julia Equation

RSolve[
      x[1 + k] == 
        a + (-a + 
                  x[k])^5/(b^4*(16 - (20*(-a + x[k])^2)/
                      b^2 + (5*(-a + x[k])^4)/b^4)), x[k], 
      k]

Example

RSolve[
      x[k + 1] == -1 + (1 + 
                  x[k])^4/(32*(-2 + (1/4)*(1 + x[k])^2)*
                Sqrt[-1 + (1/4)*(1 + x[k])^2]), x[k], 
      k]

Example

RSolve[y[x + 1]^3 + y[x]^3 - x == 0, y[x], x]

Example

RSolve[y[x + 1] - a/y[x]^2 == 0, y[x], x]

Example

RSolve[y[x + 2] y[x] + a y[x + 2] + b y[x] == 0, y[x], 
      x]

Example

RSolve[
      y[n] - 2*y[1 + n] + 
          y[2 + n] == (-y[n] + y[1 + n])*(-y[1 + n] + 
              y[2 + n]), y[n], n]

Example

RSolve[
      y[x + 2] - (x + 1) y[x + 1] == (y[x + 1] - x y[x])^2, 
      y[x], x]

Example

RSolve[
      y[x + 1] == (-(1/2))*(1 + x) + 
          2*E^(x/2)*(x/4 + y[x]/2)^x, y[x], x]

Example

RSolve[
      y[x + 1] == (3/8)*(-3 + 
              x*(-3 + 27*x^2 + 
                    8*x*(2 + 3*y[x] + Sqrt[3]*Sqrt[9*x + 8*y[x]]))), 
      y[x], x]

Example

RSolve[y[x + 1] == -Log[-(1/3) + 1/(E^y[x]*x)], 
      y[x], x]

Example

RSolve[y[k + 3] + y[k + 2] - 8*y[k + 1] - 12*y[k] == 0, y[k], 
      k]

Example

RSolve[
      x^2*y[x] - 2*y[1 + x] - 2*x*y[1 + x] - x^2*y[1 + x] + y[2 + x] == 
        0, y[x], x]

Example

RSolve[y[n + 2] - (n + 1)*(n + 2)*y[n] == 0, y[n], 
      n]

Example

RSolve[u[v] == 2*((v - 1)/z)*u[v - 1] - u[v - 2], u[v], 
      v]

Example

RSolve[u[v] == 2*((v - 1)/z)*u[v - 1] + u[v - 2], u[v], 
      v]

Example

RSolve[
      u[v] == (2*(1 + m + v)*z*u[1 + v])/(2*m + 
                v) - ((2 + v)*u[2 + v])/(2*m + v), u[v], 
      v]

Example

RSolve[
      u[v] == 
        2*(v + 1)*((c*z + d)/v)*u[v + 1] - ((v + 2)/v)*
            u[v + 2], u[v], v]

Example

RSolve[
      u[x] - ((3 + 2*x)*(d + c*z)*u[1 + x])/(1 + 
                x) + ((2 + x)*u[2 + x])/(1 + x) == 0, 
      u[x], x]

Example

RSolve[
      u[v, z] == (z*u[1 + v, z])/(1 + v) - 
          u[2 + v, z]/(2*(1 + v)), u[v, z], {v, z}]

Example

RSolve[
      u[b] == 
        u[1 + b] + ((c*z + d)*u[2 + b])/(b*(1 + b)), u[b], 
      b]

Example

RSolve[u[b] == b*u[b + 1] + (c*z + d)*u[b + 2], u[b], 
      b]

Example

RSolve[
      u[a, b, z] == ((b + z)/b)*
            u[a, 1 + b, 
              z] + (((a - b - 1)*z)/(b*(1 + b)))*
            u[a, 2 + b, z], u[a, b, z], {a, b, z}]

Example

RSolve[
      u[a, b, z] == (b + z)*u[a, 1 + b, z] + (a - b - 1)*z*
            u[a, 2 + b, z], u[a, b, z], {a, b, z}]

Example

RSolve[
      u[x] == ((2 - c + 2*x + (-1 + a - x)*z)*
                u[1 + x])/(1 - c + x) + ((1 + x)*(-1 + z)*
                u[2 + x])/(1 - c + x), u[x], x]

Example

RSolve[
      u[x] == (2 - b + 2*x + z)*
            u[1 + x] - (1 + x)*(2 - b + x)*u[2 + x], u[x], 
      x]

Example

RSolve[
      u[x] == -((4*(7/3 + 2*x)*u[1 + x])/(9*
                    x*(4/3 + x)*(10/3 + 2*x))) - ((2 + 
                    x)*(4/3 + 2*x)*
                u[2 + x])/(x*(10/3 + 2*x)), u[x], x]

Example

RSolve[
      u[x] == ((3 + a + 2*x - z)*u[1 + x])/(1 + a + 
                x) - ((2 + x)*u[2 + x])/(1 + a + x), u[x], 
      x]

Example

RSolve[
      y[x + 2] - 
          2*(x + 101)*((x - 99)/((x + 102)*(x - 98)))*
            y[x + 1] + (x - 
                100)*((x + 100)/((x + 102)*(x - 98)))*
            y[x] == 0, y[x], x]

Example

RSolve[
      2*x*(x + 1)*y[x] - (x^2 + 3*x - 2)*y[x + 1] + (x - 1)*
            y[x + 2] == 0, y[x], x]

Example

RSolve[u[x + 1, y] - a*u[x, y + 1] == 0, 
      u[x, y], {x, y}]

Example

RSolve[
      u[k + 1, l] + u[k, l + 1] + u[k + 1, l + 1] + u[k, l + 2] == 0, 
      u[k, l], {k, l}]

Example

RSolve[z[k, l] + 2*k*l*z[k - 1, l - 1] == 0, 
      z[k, l], {k, l}]

Example

RSolve[{u[k + 1] - 3*u[k] + v[k] == k, 
        3*u[k] + v[k + 1] - 5*v[k] == 4^k}, {u[k], v[k]}, k]

Example

RSolve[{y[
            x + 1] == ((-1 - 2*x - x^2 + x^4 + 
                      x^5)/(x^2*(-1 + x^3)))*
              y[x] - ((-1 - x)/(x*(-1 + x^3)))*v[x], 
        v[x + 1] == ((1 + 4*x + 6*x^2 + 4*x^3)/(x^2 - x^5))*
              y[x] - ((-x + (1 + x)^4)/(x - x^4))*
              v[x]}, {y[x], v[x]}, x]

Example

RSolve[
      y[n + 1] == (-y[n] + 1)/(y[n] - z[n] + 1) && 
        z[n + 1] == (17*y[n] + 6*z[n] + 1)/(y[n] - z[n] + 
                1), {y[n], z[n]}, n]

Example

RSolve[{y[x + 1] == z[x], z[x] + y[x] == 1}, {y[x], z[x]}, 
      x]

Example

RSolve[{y[q^2*x] - v[q*x] == 0, 
        v[q*x] - 5*y[x] == 0}, {y[x], v[x]}, x]

Example

RSolve[
      r[x, k + 1] - x*r[x, k] + (1/4)*r[x, k - 1] == 0 && 
        r[x, 0] == 2 && r[x, 1] == x, r[x, k], {x, k}]