I read about piecewise defined functions today and saw this post which was actually about something else:
Label plots in pgfplots without entering coordinates manually
This is taken from there.
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\begin{axis}[
axis y line=center,
axis x line=middle,
axis on top=true,
xmin=-7,
xmax=7,
ymin=-4,
ymax=4,
clip=false
]
\addplot[
mark=none,
domain=-4:6,
samples=80,
red,
thick,
] {(x<-2)*-2 + (!(x<-2) && (x<3))*x + (!(x<3)) * 3}
node[pos=0.1,pin=135:{\color{purple}$f(x)=-2$}] {}
node[pos=0.6,pin=135:{\color{blue}$f(x)=x$}] {}
node[pos=0.9,pin=135:{\color{green!70!black}$f(x)=3$}] {}
;
\end{axis}
\end{tikzpicture}
\end{document}

I get the syntax and(<condition1>,<condition2>) which is explained here for example but I do not understand the syntax in the example above
(x<-2)*-2 + (!(x<-2) && (x<3))*x + (!(x<3)) * 3
Can somebody explain it to me or am I just being blind? There is no and like in and(a,b) and what does the ! do? I guess it's a negation.
Update
Can I find this somewhere in a documentation or is this just common knowledge?


pgfmanual, section "Mathematical Expressions" in part VIII. – randers Nov 17 '16 at 17:49