I want to graph two quadratic equations using pgfplots. The first one work fine, however when I add the second equation, I get the following error message:
Package PGF Math Error: Unknown operator `x' or `x+' (in 'x^2 - 3x + 4').
It seems PGFplots will not let me multiply numbers at all. Functions such as 2x
or even x * 2
don't seem to work. Here is what I am working with:
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{tikzpicture}
\begin{axis}[
axis lines = center,
xlabel = {$x$},
ylabel = {$ y = f(x)$}
]
\addplot[no markers, red]{x^2};
\addplot[no markers, blue]{x^2 - 3x + 4};
\end{axis}
\end{tikzpicture}
The red plot works fine, but the blue one causes a compilation error.