Evaluating a function over an input range & putting output into list?

Hello everyone,

I am trying to evaluate a function over a range of input parameters and put each output into a common list. For instance, if we have a function f(a) = Exp[-a]*1000, I am hoping to evaluate the function over the range [0,1] and compile a list of outputs, i.e., something like {f(0),f(0.001), f(0.002),…}. Attached is a notebook showing the function I am trying to map to a list and my attempt to solve the problem using a For loop.

Alex

testing1.nb (7.55 KB)

Hello Alex,
A bunch of choices:

Caliing Exp on a list:

1000 Exp[Range[0, 1, .01]]

Using table with an iterator

Table[1000 Exp[-v], {v, 0, 1, .01}]

Iterating over a list

With[{values = Table[x, {x, 0, 1, .01}]},
 1000 Table[Exp[-v], {v, values}]
 ]

Mapping a pure function:

1000 Exp[-#] & /@ Range[0, 1, .01]

aka

Map[1000 Exp[-#] &, Range[0, 1, .01]]

and many many others.

If you need the input and output

(* As a List of pairs *)
Map[{#, 1000 Exp[-#]} &, Range[0, 1, .01]]

(* As an Association *)
AssociationMap[1000 Exp[-#] &, Range[0, 1, .01]]