[Tex/LaTex] TikZ + PGF function Plotting: Is there a max(a,b) function

pgfplotstikz-pgf

I am trying to plot a function with TikZ and PGF. This function contains a max operator (returning the greater value of the given two parameters).

I want to do the following:

\documentclass[
    headsepline,
    parskip=full-
]{scrreprt}

\usepackage{tikz}
\usetikzlibrary{matrix,fadings,calc,positioning,decorations.pathreplacing,arrows}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,decorations.pathreplacing,decorations.pathmorphing,shapes,matrix,shapes.symbols,shapes} %für die Schemata
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[xlabel=$x$, ylabel=$y$]

    % function that should use the max(a,b) function
    \addplot [domain=0:90, samples=90]{max{0,1-x/20}};
    \addlegendentry{test function}

    \end{axis}
\end{tikzpicture}
\end{document}

I am using MikTex and when I compile the above I get the following error message:

PGF Math: Sorry, an internal routine of the floating point unit]'. 
(in 'max{0,1-x/20}'). ... samples=90]{max{0,1-x/20}};

Because I cant find any reference to the max function I assume it does not even exist. What am I doing wrong or how can I immitate this behaviour?

Best Answer

Yes, max is there, but you have to put its arguments in round brackets

max(a,b)

or even

max(a,b,c,d,e)

Sample output

\documentclass[
    headsepline,
    parskip=full-
]{scrreprt}

\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[xlabel=$x$, ylabel=$y$]

    % function that should use the max(a,b) function
    \addplot [domain=0:90, samples=90] {max(0,1-x/20)};
    \addlegendentry{test function}

    \end{axis}
\end{tikzpicture}
\end{document}