What is the difference between $\log^2(n)$, $\log(n)^2$, $(\log n)^2$, $\log (n^2)$ and $\log \log n$? In research articles (e.g. this one's abstract), I often see the complexity of an algorithm expressed using a somewhat ambiguous notation:


$\log^2(n) = ?$
$\log(n)^2 = ?$
$(\log n)^2 = (\log(n)) \times (\log(n))$
$\log(n^2) = \log(n \times n)$
$\log \log n = \log(\log(n))$


The last three case are easy enough to understand, but what about the first two? The operator precedence is unclear. Do they mean $\log(n \times n)$, or do they mean $(\log(n)) \times (\log(n))$, or do they mean $\log(\log(n))$?

Citing a reliable source would be a plus, so that I can confidently add this information to Wikipedia.

Note I'm asking about the meaning of big-O or about $O(\log n)$ complexity. I'm interested in what the $^2$ means (square the $n$, square the result of $\log(n)$, or $\log^2$ = $\log \cdot \log$).
For the first one, you can find an answer here:


  (log(n))² means log²(n)


And from this question for example you can guess that:


  log(n)² = (log(n))²


So both the first and the second essentially mean 


  (log(n)) × (log(n))


(Unfortunately, not with more reliable sources than stackexchange...)