Thursday, December 23, 2004

In the Details

Consider the following two recurrences:

  • yn+1 = yn-1 - 3/2 yn, y1 = 1, y2 = 1/2
  • zn+1 = zm-1 - 8/3 zn, z1 = 1, z2 = 1/3

What are y100 and z100? Try computing a few steps of each recurrence to see what happens.

Here's a little MATLAB script to compute y100 and z100. If you don't have MATLAB (which is expensive), it will also run in Octave (which is free). Try it, or write a program in your favorite language which does the same computation. Can you explain the results?

  y = [1, 1/2];
  z = [1, 1/3];

 
  for j = 3:100
    y(j) = y(j-2)-(3/2)*y(j-1);
    z(j) = z(j-2)-(8/3)*z(j-1);
  end
  
  disp( y(end) );
  disp( z(end) );