## PREP 2014 Question Authoring - Archived

### Prime notation in student answers ### Re: Prime notation in student answers

by Davide Cervone -
Number of replies: 0
There are a number of things involved, here. First of all, there was a bug in parserFunctionPrime.pl, though that is not what is causing the issues for you. In any case, I have made a new version available in this answer, so you might download that and put it in your course templates/macrosfolder.

Aside from that, let's look at your proposed problem. Here is your main code:

$a = random(2,6,1);$b = random(100,1000,100);
$c = Compute($a*3);

Context("Numeric");
Context()->variables->remove("x");

$ans1 = Compute("$b*8");
$ans2 = Compute("$b*2^(t/$a)");$ans3 = Compute("$b*2^(19/$a)");

Context("ImplicitPlane");
parser::FunctionPrime->Enable();

Context()->variables->remove("x","y","z");
$diffeq = ImplicitPlane("P'(t) = k * P(t) ");  There are some cosmetic issues, and some more serious ones. First, the two statements Context()->variables->add(t =>'Real'); Context()->variables->remove("x");  can be combined to become one: Context()->variables->are(t =>'Real');  Using are rather than add automatically removes any existing variables and adds the new ones, so you don't have to do the remove() call yourself. Similarly, Context()->variables->remove("x","y","z"); Context()->variables->add(t =>"Real", k=>"Real", C=>"Real");  can be replaced by Context()->variables->are(t =>"Real", k=>"Real", C=>"Real");  Another minor nitpick is that you have used $c = Compute($a*3);  before you set the context, which is legal but bad form. It would be best to set the context before then. You mentioned that parserFunction("P'(t)"=>"2 t +cos(t)");  produced an error message about P' not being a valid function name. That is true. You don't set the value of P'(t) since that is already determined by the value of P(t) itself. Once you have defined P(t), then P'(t) (and P''(t), etc.) are already available. You don't declare them yourself. So you can just drop this line entirely. Finally, I don't understand this line: $diffeq = ImplicitPlane("P'(t) =  k * P(t) ");

You are using ImplicitPlane but the expression you give is not the equation of an implicit plane, so that is not going to work. Note that ImplicitPlane() is very specifically for linear equations in n-space, not for arbitrary implicit equations. Also, your equation isn't an implicit equation, it is a differential equation, so even the implicit equation object wouldn't work for it.