2 introduced dummylist
source | link

(Sorry, this is too long to fit into a comment) A possible workaround is to use fresh unevaluated symbols to represent your expression of free functions

expr = 3 f1 + 2Exp[-f2]

g1 = (#1^2 + #2) &;
g2 = Cos[#1 #2] &;

This will produce a list with the functionfunctions of said variables.

funlist = {g1, g2}; arglist = {x, y};
dummylist = {f1, f2};
funrule = #@(Sequence @@ arglist) & /@ funlist

{x^2+y, Cos[x y]}

Then you can use a replacement rule, as suggested in one of the comments:

expr /. Thread[{f1, f2}Thread[dummylist -> funrule]

3(x^2+y) + 2 Exp[-Cos[x y]

You might automate this into a procedure that could generate the unique identifiers by parsing an unevaluated expr(held) expr so that when you pass expr[g1,g2], you'll end up with expr[f1,f2] in the body of the procedure.

(Sorry, this is too long to fit into a comment) A possible workaround is to use fresh unevaluated symbols to represent your expression of free functions

expr = 3 f1 + 2Exp[-f2]

g1 = (#1^2 + #2) &;
g2 = Cos[#1 #2] &;

This will produce a list with the function of said variables.

funlist = {g1, g2}; arglist = {x, y};
funrule = #@(Sequence @@ arglist) & /@ funlist

{x^2+y, Cos[x y]}

Then you can use a replacement rule, as suggested in one of the comments:

expr /. Thread[{f1, f2} -> funrule]

3(x^2+y) + 2 Exp[-Cos[x y]

You might automate this into a procedure that could generate the unique identifiers by parsing an unevaluated expr.

(Sorry, this is too long to fit into a comment) A possible workaround is to use fresh unevaluated symbols to represent your expression of free functions

expr = 3 f1 + 2Exp[-f2]

g1 = (#1^2 + #2) &;
g2 = Cos[#1 #2] &;

This will produce a list with the functions of said variables.

funlist = {g1, g2}; arglist = {x, y};
dummylist = {f1, f2};
funrule = #@(Sequence @@ arglist) & /@ funlist

{x^2+y, Cos[x y]}

Then you can use a replacement rule, as suggested in one of the comments:

expr /. Thread[dummylist -> funrule]

3(x^2+y) + 2 Exp[-Cos[x y]

You might automate this into a procedure that could generate the unique identifiers by parsing an unevaluated (held) expr so that when you pass expr[g1,g2], you'll end up with expr[f1,f2] in the body of the procedure.

1
source | link

(Sorry, this is too long to fit into a comment) A possible workaround is to use fresh unevaluated symbols to represent your expression of free functions

expr = 3 f1 + 2Exp[-f2]

g1 = (#1^2 + #2) &;
g2 = Cos[#1 #2] &;

This will produce a list with the function of said variables.

funlist = {g1, g2}; arglist = {x, y};
funrule = #@(Sequence @@ arglist) & /@ funlist

{x^2+y, Cos[x y]}

Then you can use a replacement rule, as suggested in one of the comments:

expr /. Thread[{f1, f2} -> funrule]

3(x^2+y) + 2 Exp[-Cos[x y]

You might automate this into a procedure that could generate the unique identifiers by parsing an unevaluated expr.