I have to plot the function f(x) = atan(x)-x/(1+x^2)
, but it won't come out right. By looking at previous questions, I have the code:
\documentclass[a4paper, norsk, 11pt]{article}
\usepackage{pgfplots}
\begin{tikzpicture}
\begin{axis}[
domain=-10:10,
xscale=1.5,yscale=1,
xmin=-3, xmax=3,
ymin=-100, ymax= 100,
samples=1000,
axis lines=center,
]
\addplot+[mark=none] {atan(x) - x/(1+x^2)};
\end{axis}
\end{tikzpicture}
\end{document}
The code generates this graph:
but it should look like this:
Anybody knows how to fix this?
Best Answer
The
atan
function returns the value in degrees. You need to convert it into radians: