I tried to export my Geogebra graphs into tikz-code. In General it works fine, but plot x^1/3 doesn't work:
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{ccqqqq}{rgb}{0.8,0,0}
\definecolor{qqttcc}{rgb}{0,0.2,0.8}
\definecolor{cqcqcq}{rgb}{0.75,0.75,0.75}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,dash pattern=on 1pt off 1pt, xstep=1.0cm,ystep=1.0cm] (-4,-4) grid (4,4);
\draw[->,color=black] (-4,0) -- (4,0);
\foreach \x in {-4,-3,-2,-1,1,2,3}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0,-4) -- (0,4);
\foreach \y in {-4,-3,-2,-1,1,2,3}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-4,-4) rectangle (4,4);
\draw[color=qqttcc, smooth,samples=100,domain=-4.0:4.0] plot(\x,{(\x)*(\x)*(\x)});
\draw[color=ccqqqq, smooth,samples=100,domain=-4.0:4.0] plot(\x,{((\x))^(1/(3))});
\draw [color=qqttcc](2.06,4.18) node[anchor=north west] {$f(x)=x^3$};
\draw [color=ccqqqq](2.06,1.18) node[anchor=north west] {$f(x)=\sqrt[3]{x}$};
\begin{scriptsize}
\draw[color=qqttcc] (-1.74,-7.16) node {$f$};
\end{scriptsize}
\end{tikzpicture}
\end{document}
Error line 21: !Missing number, treated as zero.
So plot has problems with the negative x I suppose, but I don't know. Any help would be great! I googled it for nearly 1 hour - but no real answers.
As suggestet it rotated and mirrored the graph - works great!:
\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{ccqqqq}{rgb}{0.8,0,0}
\definecolor{qqttcc}{rgb}{0,0.2,0.8}
\definecolor{cqcqcq}{rgb}{0.75,0.75,0.75}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,dash pattern=on 1pt off 1pt, xstep=1.0cm,ystep=1.0cm] (-4,-4) grid (4,4);
\draw[->,color=black] (-4,0) -- (4,0);
\foreach \x in {-4,-3,-2,-1,1,2,3}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize \x};
\draw[->,color=black] (0,-4) -- (0,4);
\foreach \y in {-4,-3,-2,-1,1,2,3}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize \y};
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize 0};
\clip(-4,-4) rectangle (4,4);
\draw[color=qqttcc, smooth,samples=100,domain=-4.0:4.0] plot(\x,{(\x)*(\x)*(\x)});
\begin{scope}[yscale=-1,xscale=1]
\draw[rotate=90, color=ccqqqq, smooth,samples=100,domain=-4.0:4.0] plot(\x,{(\x)*(\x)*(\x)});
\end{scope}
\draw [color=qqttcc](2.06,4.00) node[anchor=north west] {$f(x)=x^3$};
\draw [color=ccqqqq](2.06,1.00) node[anchor=north west] {$f(x)=\sqrt[3]{x}$};
\begin{scriptsize}
\draw[color=qqttcc] (-1.74,-7.16) node {f};
\end{scriptsize}
\end{tikzpicture}
\end{document}
\draw[color=ccqqqq, smooth,samples=50,domain=0.0001:4.0] plot(\x, {(\x)^(1/3)});
with the same code as jojo but the shape of the curve is completely wrong for values less than1.0
.\usepackage{fp} \usetikzlibrary {fixedpointarithmetic}
and the keyfixed point arithmetic
added to the picture, it now works. The failure of nakedpgfmath
on this one is spectacular!