# [Tex/LaTex] Pgfplots : can’t plot some usual mathematical functions

pgfplotstikz-pgf

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}[]
\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)};


thank you very much if you can help me a little bit.

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}$}]
\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"

To keep the negative and positive parts of the 1/x plot separate, you need to make sure that the function is evaluated at x=0. If your domain is symmetric, you can just specify an odd number of samples (samples=101, for example). You also have to make sure that non-real values aren't just silently discarded, but cause a jump in the plot. To do that, specify unbounded coords=jump (instead of the default behaviour discard).

The trigonometric functions in PGF expect degrees, so you'll have to convert radians to degrees using deg(x) (not rad(x), that's used for converting degrees to radians).

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[enlargelimits=false]