WeBWorK Problems

Other Bases of Logarithm

by Gregory Varner -
Number of replies: 1

My goal is to have a student convert an exponential equation into a logarithm. (The other way around is not as difficult.)

For instance, something like

(x-2)^3=z becomes log_(x-2)(z)=3.

I am avoiding needing to look for answer mirroring by requiring a particular order to the answer. I am not currently using multianswer, though I am not against doing so.

My main problem is in getting the students to be able to input log_(x-2) in and have Webwork recognize it. (I realize that there is probably something similar on the discussion board somewhere but I have not been able to find it).

Here is what my code currently is. It is not randomized (I am fitting it to some static questions at the moment).

DOCUMENT(); # This should be the first executable line in the problem.

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"PGcourse.pl",

);

TEXT(beginproblem());

######################################

#  Setup

Context("Numeric");

$base = Formula("x-2");$power = 3;

$equals = Formula("z"); ###################################### # Main text BEGIN_PGML Convert the equation into a logarithmic equation. [ ([$base])^[$power] = [$equals] ]

The logarithmic equation is :  [__________] = [_________]. (You must write the logarithmic terms on the left.)

END_PGML

######################################

$ans1 =Formula("log_($base)($equals)");$ans2 = Formula("$power"); ANS($ans1->cmp());

ANS($ans2->cmp());$showPartialCorrectAnswers = 1;

#####################################

;

ENDDOCUMENT();