I have successfully created my first problem using the new scaffold.pl form of scaffolding.

In my second problem I am having trouble, however.

It seems that when I use the LimitedFactor context developed by Alex Jordan in the problem, the correct answers are marked incorrect when I check them, but oddly the section header is turned green and the second section opens up, so the answers are registering as correct in some form.

And though, the bar for Section 1 turns green, and Section 2 is opened, the score does not reflect correct answers for the first part even after finishing the problem.

Here is my code so far:

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"answerHints.pl",

"scaffold.pl",

"parserAssignment.pl",

"contextLimitedFactor.pl",

"PGcourse.pl",

);

TEXT(beginproblem());

$showPartialCorrectAnswers = 1;

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

# The scaffold

Scaffold::Begin(

can_open => "when_previous_correct",

is_open => "correct_or_first_incorrect"

);

Section::Begin("Part 1: Separate the variables.");

Context("Numeric");

$a = random(2,9,1);

do { $b = random(2,5,1); } until ($b != $a);

$ab = $a * $b;

Context("LimitedFactor");

Context()->variables->add(y=>"Real");

Context()->noreduce('(-x)-y','(-x)+y');

$ans = Formula("(x+$b)*(y+$a)")->reduce;

$factor = Compute("y+$a"); $factor2 = Compute("y+$a");

BEGIN_PGML

Find the general solution to

[` \displaystyle \frac{dy}{dx} = xy + [$a] x + [$b] y + [$ab]`], showing all requested steps.

Use C as a arbitrary constant, if needed.

First, factor the right side of the differential equation.

[` \displaystyle \frac{dy}{dx} = xy + [$a] x + [$b] y + [$ab] = x(`][______]{$factor}[`) + [$b](`][______]{$factor2}[`) =`][______________]{$ans}

END_PGML

Section::End();

Section::Begin("Part 2: Separate the variables.");

Context("Numeric")->variables->add(

y=>"Real", C=>"Real");

$C=2.356;

parser::Assignment->Allow;

$answer = Compute("y = C * e^(x^2/2 + $b x) - $a");

$ls = Compute("1/($factor)"); $rs = Compute("x + $b");

BEGIN_PGML

Now, separate the variables.

[`\int`][_____]{$ls} [`dy = \int`][_____]{$rs} [`dx`]

END_PGML

BEGIN_PGML_SOLUTION

END_PGML_SOLUTION

Section::End();

Scaffold::End();

COMMENT("MathObject version.");

ENDDOCUMENT();

Clearly something is not working correctly.

Thanks!

Paul