MathGroup Archive 2003

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

Search the Archive

Re: Operator that Adds Arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44847] Re: Operator that Adds Arguments
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Wed, 3 Dec 2003 04:24:42 -0500 (EST)
  • Organization: The University of Western Australia
  • References: <bqb7ch$nu6$1@bob.news.rcn.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In article <bqb7ch$nu6$1 at bob.news.rcn.net>,
 "Scott Guthery" <sguthery at rcn.com> wrote:

> I've got a recursion that adds an argument at each step
> and I'd like to say something like ...
> 
> L = Length[F]
> NextOne[F_] = Append[F, Function[F[[L]][#1, #2, ..., #L]+#[L+1]]]]
> 
> and have F[[L+1]] be a function of L+1 arguments.
> 
> Any suggestions?

Not sure what you're trying to do or why you would want this. Exactly 
what sort of functional dependence are you looking for? 

Anyway, here are some ideas about generating the left-hand side 
(function name).

[1] Use a built-in function:

  Append[f[], x]
  f[x]

  Append[%, y]
  f[x, y]

  Append[%, z]
  f[x, y, z]

[2] If you have a list of arguments, say

  v = {x, y, z, t}; 

then you could use NestList:

  i = 1; NestList[Append[##,v[[++i]]] &, f[v[[i]]], Length[v] - 1]

  {f[x], f[x, y], f[x, y, z], f[x, y, z, t]}

[3] Using FoldList avoids the use of a counter:

  FoldList[Append, f[First[v]], Rest[v]]

  {f[x], f[x, y], f[x, y, z], f[x, y, z, t]}

Cheers,
Paul

-- 
Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at physics.uwa.edu.au 
AUSTRALIA                            http://physics.uwa.edu.au/~paul


  • Prev by Date: Re: How to NOT convert Sin[x]/Cos[x] to Tan[x] ?
  • Next by Date: Re: Operator that Adds Arguments
  • Previous by thread: Re: Operator that Adds Arguments
  • Next by thread: Re: Operator that Adds Arguments