When you pass a string to Compute(), it will first parse it using the MathObject parser, as controlled by the current Context object. That means that the operations and functions and so on that are defined there will be the ones that control the result, no the built-in perl expression parser. That makes the result work exactly like student answers, which is good for consistency, and also makes it easier to produce results that are not easy to produce in perl (like Intervals, and Vectors). Finally, Compute() saves the original string as the correct answer string, so that if you used
$ans = Compute("sqrt(2)");to produce a MathObject that was used for an answer checker via
ANS($ans->cmp);then the correct answer would show as
sqrt(2) rather than
1.41421 as it would have been had you used
Compute(sqrt(2)) without the quotes.
I don't think there is a hard-and-fast rule for when to use quotes and when not to. You have to think about what result you want to have in terms of the correct answer as well as the computed result.
Hope that clears things up for you.