Hi Andrew,
There are a few possibilities, depending on what you are trying to do. As you mentioned writing this:
$f='x^2-1';
using either single or double quotes, will do it in that particular variable.
On the other hand you did mention $ANSWER - $RESPONSE which suggests you are using a Maple-graded response area. In that case, relying on the Maple computation engine for the algorithm code may also be a solution.
$f=maple("x^2-1");