WeBWorK Problems

Using student answer to set value for next answer

Using student answer to set value for next answer

by Murphy Waggoner -
Number of replies: 1
Howdy,

I have a question where the students provide the lower, upper limits of integration, the integrand and the value.

The integral is measuring the area of a polar region.  Thus, the limits of integration could be on any 2pi interval, but the lower limit = upper limit - pi.

I calculated

$upper = Compute("pi/2")->with(period => 2*pi);

As long as the student enters a correct possible upper limit, I want to check the lower limit as pi less than their upper limit.  So I want

ANS($upper->cmp);
$lower = Compute("$studentsupper - pi");
ANS($lower->cmp);

I have been wanting to do something like this for a long time, but I've looked around and I'm not sure how to capture the student's answer to a question.  Is there a system variable I can tap into?  Do I need to use a postfilter?  I've tried several things, but haven't come across anything that works.

Thanks, as always.
MEW
In reply to Murphy Waggoner

Re: Using student answer to set value for next answer

by Chrissy Safranski -
I would use MultiAnswer.  Then you're linking those two answers, and you can return [1,1] if $f1stu-$f2stu = pi and return [0,0] otherwise.  Or maybe return [1,0], since the upper limit can be anything and that way the student doesn't think they have to change both answers. 

http://webwork.maa.org/wiki/MultiAnswerProblems#.VMWBVFWJOuY