TITLE: Notation for functions vs. numbers
QUESTION [7 upvotes]: I understand that $f$ represents a function while $f(x)$ represents the value of a function, but while I can easily see how to apply this convention to work with functions instead of numbers in some circumstances, e.g., 
$$\sin(x)\text{ becomes } \sin\text{,}$$
$$\cos(x)\text{ becomes } \cos\text{, and}$$
$$g(x)\text{ becomes } g\text{,}$$
it isn't clear to me how to to express the functions corresponding to the numbers
$$x^{2}\text{, or}$$
$$2\cdot x\text{.}$$
Short of defining new symbols, like $S$ or $I$ (which I've seen for the function corresponding to $x \mapsto x$), can one say things like $$\left(\cdot\right)^{2}\text{ for }x^{2}\text{, or}$$
$$2\cdot \left(\cdot\right)\text{ or }2\left(\cdot\right)\text{ or }2\cdot\text{ for }2\cdot x\text{?}$$
What is the general idiom for expressing such functions concisely?

REPLY [8 votes]: A good question. There are various approaches.
Formally, in simple cases such as the ones in the question, you can get away with giving a name to the identity function $\mathrm{Id}$ which returns its argument unchanged. Then, by analogy with, say $\sin^2$, the function that squares its argument becomes $\mathrm{Id}^2$ and the function that doubles its argument is $2\,\mathrm{Id}$.
If you're really devious, you can even decide to name the identity function "$x$", and declare that everything is a function of a hidden variable with some other name. That can quickly get confusing if you have other named functions around, though. If your audience are algebraists, they will probably like this approach.
The full-featured bells-and-whistles solution, however, is to use the applied lambda calculus, in which the function that squares its argument is notated $(\lambda x.x^2)$ or $(\lambda y.y^2)$ or $(\lambda z.z^2)$ ... you get the pattern. The variable that follows the $\lambda$ is bound by the function expression and not visible outside. Thus you can write $(\lambda x.x^2)(20)=400$. The notation also allows you to write functions that take functions as arguments, such as $(\lambda f.f(42))$, or functions that return other functions, such as $(\lambda x.(\lambda y.x+y))$.
The lambda calculus is one of the bedrock formations of computer science, but not much used by contemporary mathematics -- even though it was originally invented as a possible general foundation for mathematics before computers were even invented. Mathematics sometimes uses notations such as "... the function $x \mapsto x^2$ ..." for $(\lambda x.x^2)$, but this $\mapsto$ notation is rarly used inside larger expressions.