MathGroup Archive 2000

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

Search the Archive

Initializing subscripted variables

  • To: mathgroup at
  • Subject: [mg24879] Initializing subscripted variables
  • From: "Harvey P. Dale" <hpd1 at>
  • Date: Sat, 19 Aug 2000 04:45:52 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

	I want to define a function recursively, and must initialize the
value of the first few instances.  For example:
	f[1]=f[2]=f[3]=f[4]=1; f[n_]:=f[n-1]+f[n-2]+f[n-3]-f[n-4]
Here?s the question: is there a way to write a function, e.g., a Table, that
will generate the code preceding the semicolon above?
	It is easy to generate a list of f[1], f[2], . . ., f[n], by
Threading f across the Range of desired initial subscripted variables.  My
problem is how to join the listed initial subscripted variables with a
single equals sign.  (It is fairly easy to get the Boolean double-equals
sign between them, but I've discovered no way to get the single equals
	Thanks for your help.

  • Prev by Date: functional routine for {a, b, c, ...} -> {a - b, b - c, c - ...}
  • Next by Date: Opening files
  • Previous by thread: Re: functional routine for {a, b, c, ...} -> {a - b, b - c, c - ...}
  • Next by thread: Re: Initializing subscripted variables