[Tex/LaTex] Writing math formula in LaTeX, ‘undefined control sequence’

amsmathmath-modemath-operatorsmathtools

I'm using the amsmath package and writing a report. I am using a LaTeX manual pdf, which has a chapter on writing maths formulas. I have followed what it says and I do not understand why my equation is causing an 'undefined control sequence' error

I'm trying to write this maths formula:

\begin{equation}
q_k(p)= f(x_k) + \nablaf(x_k)^Tp + \frac{1}{2}p^T\nabla{^2}f(x_k)p
\end{equation}

The equation comes out nicely, except for the nabla squared term, there is some brackets around the 2 for some reason. However, the bigger problem is I can not move on because it says I have created an 'unidentified control sequence' and I do not know why.

Best Answer

You have

\nablaf

which is probably undefined, I guess you wanted

\nabla f

(Please always post a complete document that generates the error, it is much easier to debug then)