This question already has an answer here:

Map an Argument to a list of functions

1 answer

Suppose I have a list of functions like:

listfun = { Sin, Cos, Tan }

And suppose I want to map listfun to a single number Pi so that the result is,

result = { Sin[Pi], Cos[Pi], Tan[Pi] } = {0, -1, 0}

How can I generate result above? Thanks!

=================

=================

1 Answer

1

=================

Two possible ways:

listfun = {Sin, Cos, Tan};

Through[listfun[Pi]]

(* {0, -1, 0} *)

#[Pi] & /@ listfun

(* {0, -1, 0} *)