LinkingProblems
Linking Successive Problems
This is the PG code to result in a problem having a predictable set of variable values, so that one can link successive problems in a set "knowing" what the previous problem included.
PG problem file | Explanation |
---|---|
SRAND($psvn); $a = random(1,3,1); $b = random(1,3,1); |
Setup: To make the random values that show up in a problem be consistent between problems, two things need to happen: we need to set the random seed for the problems so that they are the same, and we need the sequence of calls to the random number generator to be the same in each of the problems.
We can do the first of these by calling
Then we just include all of the random calls that have been used in the preceding problems that have the same seed in the same order. Here we have the variables |
BEGIN_TEXT In the previous problem you found the value of \($a^2\). Now find $BR \( $a^2 - $b = \) \{ ans_rule(5) \} END_TEXT |
Main Text: In the text section of the problem we proceed as expected. |
ANS( Compute("$a*$a - $b")->cmp() ); ENDDOCUMENT(); |
Answer evaluation: And the answer and solution section of the file is straightforward. |