Can you plot pure function without specifying variable?
Yes, you can plot it, but not using Plot
. For example, you could map the function over a range of values and then use ListLinePlot
:
With[{xmin = 0, xmax = 4π},
ListLinePlot[f/@Subdivide[##,100],DataRange->{##}]&[xmin,xmax]
]
This uses the new function Subdivide
with 100
plot points.
The reason why Plot
requires you to specify a dummy variable is that it takes expressions and not functions as its argument. Therefore, the plot variable is not identifiable by a slot, and you need to specify it by naming the plot variable.
There is the function Unique
, which is often used to avoid symbol name collisions.
You could use it like this:
Plot[f[#], {#, 0, 10}] &[Unique[]]
Of course, in another sense, it's the most arbitrary that a variable can get (it's just a variable with a name of the form $12345
where 12345 represents some arbitrary number).
The short answer is no, not with Plot
, which like many other Mathematica built-in functions that range over a set of values, is designed to follow a standard syntax pattern for which Table
may be considered the prototype. Consider Do
or even Manipulate
$\text{*}$, which was added long after Plot
. Both follow this pattern although in the case of Manipulate
the semantics are wildly different.
$\text{*}$ See this conference article for a discussion of how Manipulate
was deliberately designed to emulate Table
. It also has many additional interesting things to say about Manipulate
.