Re: Particular structure
- To: mathgroup at smc.vnet.net
- Subject: [mg33554] Re: [mg33545] Particular structure
- From: BobHanlon at aol.com
- Date: Sun, 31 Mar 2002 04:09:00 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 3/29/02 7:29:19 AM, yast at optushome.com.au writes:
>How do I go about achieving the structured list below,
>
>{f[x1, y1, z], ... , f[xn, y1, z]}
>
>followed by some operation on the above list (e.g Fold), store the
>result and then, do the same again for other y values, as in,
>
>{f[x1, ym, z], ... , f[xn, ym, z]}
>
>until the last value of ym.
>
>In summary, the n values of x get slotted in first for one value of y
>then the resulting list is evaluated, the answer stored, values of x get
>
>slotted in again, y is incremented and so forth until all (m) values of
>
>y have been done.
>
x = {x1,x2,x3};
y = {y1,y2,y3,y4};
g /@ Outer[f[#2,#1,z]&, y, x]
{g[{f[x1, y1, z], f[x2, y1, z], f[x3, y1, z]}],
g[{f[x1, y2, z], f[x2, y2, z], f[x3, y2, z]}],
g[{f[x1, y3, z], f[x2, y3, z], f[x3, y3, z]}],
g[{f[x1, y4, z], f[x2, y4, z], f[x3, y4, z]}]}
Bob Hanlon
Chantilly, VA USA