(\x)^2
will plot correct parabola, while \x^2
will have negative x branch upside down. Why () are required for this formula to work?
\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes.misc}
\begin{document}
\begin{figure}[!htb]
\begin{tikzpicture}
\draw[very thin,color=gray] (-4.1,-4.1) grid (4.1,4.1);
\draw[->] (-4.2,0) -- (4.2,0) node[right] {$x$};
\draw[->] (0,-4.2) -- (0,4.2) node[above] {$f(x)$};
\draw[thick,purple,domain=-3:3,smooth] plot (\x,{0.5*\x^2});
\draw[thick,brown,domain=-3:3,smooth] plot (\x,{0.2*\x^3});
\end{tikzpicture}
\caption{$y=1/2 x^2, y=1/5 x^3$}
\end{figure}
\end{document}
-5^2
will be-25
. – Peter Grill Feb 6 '14 at 21:03