PREP 2014 Question Authoring - Archived

kronecker delta and other functions

Re: kronecker delta and other functions

by Davide Cervone -
Number of replies: 0
should this be corrected?

Yes, the page is not consistent with the code.

so I should use parserFunction("u(​n)" => "1-step(-n)");

Note that this requires step() to be defined in the context, which is not the case for the Numeric context. So you could either use the LegacyNumeric context (which also defines frac(), and corresponds to the functions defined in the original num_cmp() answer checker), or import the step function from that context:

    Context("Numeric");
    Context()->functions->redefine("step",from=>"LegacyNumeric");
    parserFunction("u(​n)" => "1-step(-n)");
Note that this means step() will also be available to students in their answers, but it is uniquely anyone will try that. If you want to prevent it, then use the mechanism of defining u() that I described above.

Hope that does the trick.