## WeBWorK Problems

### f prime in student answers

by Paul Pearson -
Number of replies: 1
Hi all,

Is it possible to add named functions to the context if they have a prime in their name? How difficult would it be to modify parserFunction.pl to allow for named functions such as g' that have a prime in them?

Ultimately, I would like to be able to ask students questions such as

-- begin question --

If h(x) = f ( g(x) ), then

h ' (x) = __________ [expect students to input f ' ( g(x) ) * g ' (x) ]

h ' (1) = __________ [expect students to input f ' ( g(1) ) * g ' (1) ]

-- end question --

and then be able to ask follow up questions that get students to realize that

f ' ( g(1) )

involves function composition, not multiplication.

As you can see, for these types of questions I don't need a derivative operator for named functions. I've played around with modifying parserFunction.pl, but have not achieved what I wanted.

Paul Pearson

### Re: f prime in student answers

by Davide Cervone -
Paul:

Here is a file that implements prime notation for parserFunction objects. See the documentation in the file for details. The basics are that you load this file and then enable it in the context you want:

    loadMacros("parserFunctionPrime.pl");
Context("Numeric");
parser::FunctionPrime->Enable();

After that, you can use things like
    parserFunction("f(x)" => "x sin(x^2) - 3x^2");
parserFunction("g(x)" => "3 cos(1-x^3)");
\$fog_prime = Compute("f'(g(x))g'(x)");

so that students have to enter the chain rule via prime notation.

Hope that does what you need.

Davide