From: Bill Rowe on 28 Nov 2009 01:11 On 11/27/09 at 6:27 AM, lawrenceteo(a)yahoo.com (Lawrence Teo) wrote: >I have a question. How to make {f,g}[a,b,c] to become >{{f[a],g[a]},{f [b],g[b]},{f[c],g[c]}}? In[6]:= Transpose[Thread[#[{a, b, c}]] & /@ {f, g}] Out[6]= {{f[a], g[a]}, {f[b], g[b]}, {f[c], g[c]}}
From: SHuisman on 29 Nov 2009 05:10 Or maybe faster because there is not need to transpose: Through[{f, g}[#]] & /@ {a, b, c}
From: DrMajorBob on 30 Nov 2009 06:16 Transpose(a)Outer[Compose, {f, g}, {a, b, c}] {{f[a], g[a]}, {f[b], g[b]}, {f[c], g[c]}} Bobby On Sun, 29 Nov 2009 04:10:18 -0600, <SHuisman(a)giganews.com> wrote: > Or maybe faster because there is not need to transpose: > > Through[{f, g}[#]] & /@ {a, b, c} > > -- DrMajorBob(a)yahoo.com
|
Pages: 1 Prev: problem about MLPutRealArray Next: Using GraphPlot to draw an empty graph |