PREP 2014 Question Authoring - Archived

answer in required form

Re: answer in required form

by Paul Pearson -
Number of replies: 0
Hi Joel,

Your question is on stuff that we will cover in detail in the next two weeks.  Yes, you can do things like disable (or undefine or redefine) certain functions in webwork.  One way to disable a function is described on the wiki

http://webwork.maa.org/wiki/DisableFunctions

For example, you can disable the absolute value and the square root using

Context()->functions->disable("abs","sqrt");

In your case, you would probably want to disable sine, tangent, and all the co- functions except for cosine, which could be accomplished with

###  begin code snippet

Context("Numeric")->variables->are(t=>"Real");
Context()->functions->disable("sin","tan","csc","sec","cot");

$A = ??; # replace ?? by some value
$F = ??; # replace ?? by some value
$phi = ??; # replace ?? by some value

$answer = Compute("$A * cos(2*pi* $F * t + $phi)");

### end code snippet

If you write a question like this, make sure to include instructions for the students in the text of the problem that says something like "Enter your answer using a single cosine function and no other trig functions." or "Enter your answer in the form \( A \cos(\omega t + \phi) \) for some constants \( A \), \( \omega \), and \( \phi \)."

Best regards,

Paul Pearson