picking particular values of the function

Hi guys!
Its probably a very simple question..

Suppose you have some function f(x).

ListPlot[Table[f, {x, 1, 5}]]  

gives you all values of the function for x=1,2,3,4,5
But, what is the syntax if I’d like to take particular values, say f(1) and f(3)?

Many thanks,
D

If you aim is to plot a discrete (but not necessarily arithmetic progression) you could use (where f here is x^2):

ListPlot[Table[x^2, {x, {1, 3}}]]

or use DiscretePlot:

DiscretePlot[x^2, {x, {1, 3}}]

For specific values, you may also try

f[x_]:=x^2(*or any other function*);
ListPlot[(*Function*) f[x](*replace x*)/. x ->(*with specific list of x values*){1, 3, 8, 2.5}]

A slightly simpler version of Issac Abraham’s approach would be (using the function Map, see http://reference.wolfram.com/language/ref/Map.html)

ListPlot[f/@{1, 3, 8, 2.5}]

Issac’s approach requires that the function that you use have the Attribute, Listable, which may often be the case for simple functions, but may not be true for more complicated ones. The approach that I gave does not depend on a Listable Attribute.

Even better. Thanks David.