Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Recursive function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115930] Re: Recursive function
  • From: Dana DeLouis <dana2010 at me.com>
  • Date: Wed, 26 Jan 2011 05:05:33 -0500 (EST)

> On Jan 25, 4:20 am, StatsMath <stats.ma... at gmail.com> wrote:
> I am trying to compute the following function:
>
> x[t] = a * x[t-1] + b * x[t-2]
> x[0] = 1
> x[1] = 1


Probably not useful, but another way for a specific term in your sequence might be:
(Similar to the Fibonacci sequence)

term[n_, a_, b_] := Tr[MatrixPower[{{a, 1}, {b, 0}}, n][[All, -1]]]

Given a=1, b=1/2, then the 20th term:

term[20, 1, 1/2]

413403 / 1024

= = = = = = = = = =
HTH  : >)
Dana DeLouis



  • Prev by Date: Graph cycles in Mathematica 8
  • Next by Date: Re: Vector problem
  • Previous by thread: Re: Recursive function
  • Next by thread: Re: Recursive function