Prev: Plotting piecewise in 2D
Next: Genetic Algorithm
From: David Bevan on 14 May 2010 05:33 In[]:== innerApply[f_,a_]:==Apply@@#&/@Transpose[{f,a}] innerApply[{f,g},{{a,b},{c,d}}] Out[]== {f[a,b],g[c,d]} David %^> > -----Original Message----- > From: Fred Klingener [mailto:gigabitbucket(a)BrockEng.com] > Sent: 13 May 2010 12:26 > To: mathgroup(a)smc.vnet.net > Subject: innerApply[{f, g}, {{a, b}, {c, d}}] == {f[a, b], g[c, > d]} ? > > This seems to work fine, but there must be a less clumsy way to do it: > > Clear[innerApply, functionList, argumentList, f, g, a, b, c, d] > > innerApply[functionList_, argumentList_] :== > Table[functionList[[j]] @@ argumentList[[j]], {j, 1, > Length[functionList]}] > > In[770]:== innerApply[{f, g}, {{a, b}, {c, d}}] > Out[770]== {f[a, b], g[c, d]} > > TIA, > Fred Klingener >
From: Bob Hanlon on 14 May 2010 05:35 MapThread[#1 @@ #2 &, {{f, g}, {{a, b}, {c, d}}}] {f(a,b),g(c,d)} Bob Hanlon ---- Fred Klingener <gigabitbucket(a)BrockEng.com> wrote: ============= This seems to work fine, but there must be a less clumsy way to do it: Clear[innerApply, functionList, argumentList, f, g, a, b, c, d] innerApply[functionList_, argumentList_] := Table[functionList[[j]] @@ argumentList[[j]], {j, 1, Length[functionList]}] In[770]:= innerApply[{f, g}, {{a, b}, {c, d}}] Out[770]= {f[a, b], g[c, d]} TIA, Fred Klingener
|
Pages: 1 Prev: Plotting piecewise in 2D Next: Genetic Algorithm |