problem with program writing


ejd141
09-18-2003, 04:40 PM
Hi all:

I have a problem that I can't figure out:

I need to write a program that generates the first n terms in the sequence given by the difference equation

X_k+1 = 2.25x_k - 0.5x_k-1

with starting values

x_1 = 1/3

x_2 = 1/12

Use n = 225 if you are working in a single precision or n=60 if you are working in a double precision.

I'm programming using MATLAB, and it's simply C and/or Fortrane based, but I'm having trouble. Hopefully someone can help!

Thanks!

sbt1961
10-13-2003, 02:47 AM
A closed form expression for this sequence can be guessed or derived.

x_n = (1/3)*(1/4)^(n-1)

x_1 = 1/3
x_2 = 1/12
x_3 = 1/48
x_4 = 1/192

...

x_60 = (1/3)*(1/4)^60 =

1/996920996838686904677855295210258432

...

x_225 = (1/3)*(1/4)^225 =

1/21805161728868206716479714236640136030609240820619 54180844470597541917864340193769978573152141290696 682287564818798533800603804885843968

I derived this expression using the method described in the first chapter of Herbert Wilf's awesome book - Generatingfunctionology.

This entire book and others are downloadable, for free, via the web:

http://www.math.upenn.edu/%7Ewilf/DownldGF.html