Skip to main content
deleted 4 characters in body
Source Link
Dr. belisarius
  • 116.8k
  • 13
  • 208
  • 466

Is this near to what you are looking for?

In[107]:=  ClearAll[f, g, h] In[104]:=  f1[s__] := Total@Take[{s}, 3]; In[105]:=  f2[s__] := Times @@ Take[{s}, 2]; In[106]:=  f3[s__] := {s}[[1]] {s}[[3]] - {s}[[2]] {s}[[4]]; In[108]:=  expr = Through[(f + g + h)[##]] & In[109]:=  w = expr /. {f -> f1, g -> f2, h -> f3}; In[111]:=  w[5, 6, 7, 8] Out[111]=   (* 35 *) 

Is this near to what you are looking for?

In[107]:= ClearAll[f, g, h] In[104]:= f1[s__] := Total@Take[{s}, 3]; In[105]:= f2[s__] := Times @@ Take[{s}, 2]; In[106]:= f3[s__] := {s}[[1]] {s}[[3]] - {s}[[2]] {s}[[4]]; In[108]:= expr = Through[(f + g + h)[##]] & In[109]:= w = expr /. {f -> f1, g -> f2, h -> f3}; In[111]:= w[5, 6, 7, 8] Out[111]= 35 

Is this near to what you are looking for?

  ClearAll[f, g, h]   f1[s__] := Total@Take[{s}, 3];   f2[s__] := Times @@ Take[{s}, 2];   f3[s__] := {s}[[1]] {s}[[3]] - {s}[[2]] {s}[[4]];   expr = Through[(f + g + h)[##]] &   w = expr /. {f -> f1, g -> f2, h -> f3};   w[5, 6, 7, 8]    (* 35 *) 
Source Link
John McGee
  • 2.5k
  • 13
  • 15

Is this near to what you are looking for?

In[107]:= ClearAll[f, g, h] In[104]:= f1[s__] := Total@Take[{s}, 3]; In[105]:= f2[s__] := Times @@ Take[{s}, 2]; In[106]:= f3[s__] := {s}[[1]] {s}[[3]] - {s}[[2]] {s}[[4]]; In[108]:= expr = Through[(f + g + h)[##]] & In[109]:= w = expr /. {f -> f1, g -> f2, h -> f3}; In[111]:= w[5, 6, 7, 8] Out[111]= 35