Re: Variable number of parameters
- To: mathgroup at smc.vnet.net
- Subject: [mg33330] Re: [mg33300] Variable number of parameters
- From: BobHanlon at aol.com
- Date: Sat, 16 Mar 2002 01:40:07 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 3/14/02 7:58:44 AM, Sven.Richter at xterminator.studfb.unibw-muenchen.de writes: >But how does it look like, if I want to define e.g. something like > >Table[{m1, m2,..., m(n-1),mn=maxVal-m1-...-m(n-1)}, >{m1, minVal, maxVal-(n-1)minVal, step}, >{m2, minVal,maxVal-(n-2)minVal-m1, step}, ..., >{m(n-1), minVal, maxVal-minVal-m1-...-m(n-2), step}] ? > >Do you know what I mean? > Perhaps this is what you want n=5; minVal=3; maxVal=19; step=2; var=Table[ToExpression["m"<>ToString[k]], {k,n-1}]; lst = Append[var, maxVal-(Plus@@var)]; Table[lst, Evaluate[Sequence@@ Table[{var[[k]],minVal, maxVal-(n-k)*minVal-(Plus@@Take[var, k-1]), step},{k,n-1}]]] Bob Hanlon Chantilly, VA USA