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

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

$lower = Compute("$studentsupper - pi");

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.
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.