## WeBWorK Problems

by Steven Fiedler -
Number of replies: 0

I'm attempting to use WeBWorK to permit students to conduct an analysis on empirical data that they collect.  In gateway quizzes, answers from previous questions can be accessed as entries in the inputs_ref hash.  Unfortunately, inputs_ref does not appear to retain such information in homework type assignments. My naive understanding is that gateway quizzes are not a simple concatenation of all the problems in a given assignment. If this is the case, perhaps there is hope for using inputs_ref to transmit this information in a homework environment?   I would appreciate any insight on this.

Below are a couple linked problems that demonstrate the principle.

Problem 1

DOCUMENT();

"PGstandard.pl",
"MathObjects.pl"
);

$nsamples=5;$dum=Real(1);  #For answer checker syntax

$spc="$$\hspace{0.5em}$$"; BEGIN_TEXT Weigh five pennies individually and enter the mass of each in the table below.$BCENTER
$BR \{ begintable(2) . row("$spc Penny$spc", "$spc Mass (g)$spc") . row( "1", ans_rule(5)) . row( "2", ans_rule(5)) . row( "4", ans_rule(5)) . row( "4", ans_rule(5)) . row( "5", ans_rule(5)) . endtable(); \}$ECENTER $BR END_TEXT for(my$i=0;$i<$nsamples;$i++){ ANS($dum->cmp(
checker => sub {return 1;}
) );
}

ENDDOCUMENT();

Problem 2

DOCUMENT();

"PGbasicmacros.pl",
"PGinfo.pl"
);

TEXT(&beginproblem);

$mass1 =$inputs_ref->{Q0001_AnSwEr0001};
$mass2 =$inputs_ref->{Q0001_AnSwEr0002};
$mass3 =$inputs_ref->{Q0001_AnSwEr0003};
$mass4 =$inputs_ref->{Q0001_AnSwEr0004};
$mass5 =$inputs_ref->{Q0001_AnSwEr0005};
$ave=($mass1+$mass2+$mass3+$mass4+$mass5)/5;

BEGIN_TEXT
The value of mass1 is: $mass1 g.$BR
The value of mass2 is: $mass2 g.$BR
The value of mass3 is: $mass3 g.$BR
The value of mass4 is: $mass4 g.$BR
The value of mass5 is: $mass5 g .$BR
The average of mass5 is: $ave g.$BR

Calculate the average mass of the pennies you weighed in Problem 1:\{ans_rule(4)\} g.$BR$BR$BR END_TEXT ANS(num_cmp($ave));

#listEnvironmentVariables();

ENDDOCUMENT();