A question on function notation Forgive me if this does not belong here.
All throughout primary school I've seen the notation $f(x)$ to denote a function, that is, if we are talking about the squaring function, we would write
$$ f(x) = x^2 $$
to denote/define the function (IIRC this notation was invented by Euler).
However, in the past few years I've been introduced to the notation
$$ x \mapsto x^2 $$
when talking about an anonymous function that we don't need to give a name (and as someone who does functional programming I find it very intuitive and useful).
My question is, should we prefer
$$ f(x) = x^2 $$
or
$$ f \colon x \mapsto x^2 $$
when defining a function with a name. It seems to me the former is more common, but wouldn't it make sense to use the latter to be consistent with anonymous functions? What's the standard in professional mathematics (e.g. papers)? Does anyone think one is more readable than the other?
Oh, and I've also seen
$$ f(x) :=  x^2 $$
as another alternative.
 A: The problem with all of these notations is that they don't indicate the domain or codomain of the function. I would introduce a function in two parts, first I would write $f : X \to Y$ which indicates the domain and codomain, then write either $f(x) = \dots$ or $x \mapsto \dots$ , both are acceptable.
Example: I would write either $f : \Bbb{R} \to \Bbb{R}$, $x \mapsto x^2$ or $f : \Bbb{R} \to \Bbb{R}$, $f(x) = x^2$.
In both cases, the first part tells you the name of the function, its domain, and its codomain, while the second tells you how it acts on an element of the domain.
A: I don't think there's anything inherently bad about either notation (used properly).
The less common notation is useful in some cases, e.g.:


*

*Let $\alpha$ be a permutation.  Let $\alpha'$ be the map defined by $\alpha(i) \overset{\alpha'}{\longmapsto} i$.  We see that $i \overset{\alpha}{\longmapsto} \alpha(i) \overset{\alpha'}{\longmapsto} i$ and $\alpha(i) \overset{\alpha'}{\longmapsto} i \overset{\alpha}{\longmapsto} \alpha(i)$, and so $\alpha\alpha'=\alpha'\alpha$ is the identity map.

*If $\theta$ is a permutation of a group $(G,+)$, then $\theta$ is an orthomorphism if $g \mapsto \theta(g)-g$ is also an permutation of $G$.
Here's an image from a paper I'm currently writing where I use the notation element-by-element:

In this example, it would be cumbersome to use e.g. $\theta\big((0,0,0)\big)=(1,1,1)$ and $\theta^2\big((0,0,0)\big)=(2,2,2)$.
A: There is also an "historical" motivation behind.
Functions in mathematics originated form the idea of "recipe" or "procedure" which, taking an input $x$ "produce" an output $y$.
Paradigmatic examples are the simple mathematical functions like : "double of __" (i.e. $y = 2 \times x$), "square of __" (i.e. $y = x^2$).
This origin explains the "old" symbolism :

$f(x)=x^2$

where we write in the RHS a "formula" which express the way to calculate the value of the function for an "input" whatever : i.e. the "law" formalized by the mathematical expression. 
With the modern mathematics, starting form Dirichelet, an abstract concept of function emerged : a corerspondance between values from two sets whatever : the doamin and the codomain (or range).
In this case, we need - as answered above - more informations to define the function : the indication of domain and codomain.
But also, we have "general" functions, where we are nor more able to "specify" with a simple mathematical expression the "law" defining the correspondance.
