Problema al usar atan en pgfplots

Problema al usar atan en pgfplots

Estoy intentando trazar algo usando atan en pgfplots, pero siempre genera cientos de errores.

Estoy usando un ejemplo que encontré aquí:

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\pgfplotsset{compat=1.9}
\begin{tikzpicture}
\begin{axis}[
     width=160pt,compat=1.5.1,grid style={ultra thin},every axis plot post/.append style={thick},
     x tick label style={font=\tiny},y tick label style={font=\tiny},
     scale only axis,grid=major,axis lines=middle,
     xlabel={$x$},
     ylabel={$y$},
     xmin=-200,
     xmax=200,
     domain=-200:210,
     ymin=-5.5,
     ymax=5.5,
     xtick={-150,-100,...,150},
     ytick={-5, -4,...,5},
     restrict y to domain=-20:20,
     legend style={at={(0.5,-0.05)},anchor=north,nodes={right}},
 ]
 \addplot[mark=none,color=blue, samples=500]{rad(atan(x))};
 \addlegendentry{$y = \tan^{-1}x $};
 \end{axis}
\end{tikzpicture}

\end{document}

Los errores son:

! Undefined control sequence.
<recently read> \pgfmath@multiply@thousand 

l.23 ...ne,color=blue, samples=500]{rad(atan(x))};

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
\pgfmath@basic@atan@ ... pt \pgfmath@table@lookup 
                                                  {\pgfmath@x }{pgfmath@atan...
l.23 ...ne,color=blue, samples=500]{rad(atan(x))};

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Missing number, treated as zero.
<to be read again> 
                   }
l.23 ...ne,color=blue, samples=500]{rad(atan(x))};

Y sigue y sigue. Más de cien errores y luego deja de compilar sin ningún resultado. ¿Qué estoy haciendo mal aquí?

Respuesta1

Según su archivo de registro, tiene pgfplots1.11 y pgf2.10. Puedo reproducir el problema en esta combinación.

Funciona con ambos paquetes actualizados (es decir, pgfplots1.11 y pgf3.00).

Funciona con pgfplots1.10 y pgf2.10.

Las alternativas de soluciones para usted son:

  1. actualice PGF a 3.00 o

  2. degradar pgfplots a 1.10 o

  3. utilizar \addplot ... gnuplot {atan(x)};por el momento.

EDITARResulta que este problema es en realidad peor de lo previsto: los informes enSecuencia de control indefinida: \pgfmath@multiply@thousandyMiktex 2.9 pgfplots, problema de colisión de bibliotecas circuitikzparecen tener la misma causa raíz.

La causa principal es que pgfplotsse intenta parchear la versión anterior de PGF; pero ese parche no se aplica (es decir, es un error pgfplots).

Para solucionarlo, puede proceder según la opción (1) o (2). O puedes agregar las líneas

% HACK: deactivate feature 'trig format' but restore compatibility
% between pgfplots 1.11 and tikz 2.10:
\csname pgfutil@ifundefined\endcsname{pgfmathiftrigonometricusesdeg}{%
    \def\pgfmathiftrigonometricusesdeg#1#2{#1}%
}{}%

antescargando pgfplots. En este caso, asumirá que todo está actualizado y no intentará aplicar el parche roto. Riesgo de aplicar este parche: la característica trig format plotsintroducida en pgfplots1.11 no funcionará. Pero eventualmente lo hará (probablemente con la versión que vendrá después de PGF 3.0.0).

información relacionada