Using Map, one can apply a function f to the elements of a list:
Clear[f];
Map[f,Range[10]]
(*{f[1], f[2], f[3], f[4], f[5], f[6], f[7], f[8], f[9], f[10]}*)
But the command does not seem to work if any modification is applied to f. For example:
Map[-f,Range[10]]
(*{(-f)[1], (-f)[2], (-f)[3], (-f)[4], (-f)[5], (-f)[6], (-f)[7], (-f)[8], (-f)[9], (-f)[10]}*)
This is illustrated with an example:
f[x_]=2x;
Map[f, Range[10]]
(*{2, 4, 6, 8, 10, 12, 14, 16, 18, 20}*)
Map[-f, Range[10]]
(*{(-f)[1], (-f)[2], (-f)[3], (-f)[4], (-f)[5], (-f)[6], (-f)[7], (-f)[
8], (-f)[9], (-f)[10]}*)
Is there a way to evaluate this expression to the desired result ?
FullForm@(-f)this is what you are mapping with while you should useMinus @* for something. – Kuba May 30 '17 at 09:28Map[(f@# + g@#) &, Range[10]]where g[x_] = 3 x; (or,Range[10] // Map[(f@# + g@#) &, #] &– user1066 May 30 '17 at 12:17