I'm beginning to learn pgfplots and I would like to plot some functions: cubic root, inverse, and some trigonometric functions.
The problem is that for y=1/x function, it joins up the points between negative and positive parts of the domain: we can't see the asymptote.
\documentclass{minimal}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[]
\addplot [domain=-10:10, samples=100]{x^(-1)};
\end{axis}
\end{tikzpicture}
\end{document}
With the function y=x^{1/3}, it doesn't display the negative part of the domain. And with the trigonometric functions, it just doesn't do anything right...
\addplot[domain=-27:27]{x^(1/3)};
\addplot[domain=-2*pi:2*pi]{cos(rad(x))};
thank you very much if you can help me a little bit.
thank you very much for your answers, it's really helping. Just a last thing: the cubic root function has a negative part in its domain that cannot be displayed. Do you know why?
\begin{tikzpicture}
\begin{axis}[
width=8cm,xlabel={$x$},
ylabel={$y$},grid=both, axis x line=middle, axis y line=middle,
title={$f(x)=x^{1/3}$}]
\addplot[blue,domain=-27:27, no markers,samples=100] {x^(1/3)};
\end{axis}
\end{tikzpicture}
NB: Yes, the cubic root function has a partially negative domain, and no, there is no imaginary part. NB: i'm sorry i'm insisting on one of my first questions in this comment which is supposed to be an "answer", i'm just new here and, as i'm not registered yet, i don't know how i can ask something related with the topic in a new "question comment"