WeBWorK Problems

Can't generate enough valid points for comparison

Can't generate enough valid points for comparison

by Bill Shillito -
Number of replies: 2

Hello! I'm having some trouble with a WebWork question I authored. It seems that whenever $a is between 2 and 7, the problem works fine, but when $a is 8 or greater, it gives the error "Can't generate enough valid points for comparison". I've set the domain to [$a+1, $a+10], so I know the function should be defined on this interval (since it's defined from -∞ to -$a and from $a to +∞).

########################################################################
DOCUMENT();      
loadMacros(
   "PGstandard.pl",     # Standard macros for PG language
   "MathObjects.pl",
   "contextFraction.pl",
   "PGML.pl",
   "scaffold.pl",
   
   "PGchoicemacros.pl",
   "PGstandard.pl",
"PGunion.pl",
"PGnumericalmacros.pl",
"PGstatisticsmacros.pl",
"MathObjects.pl",
"parserPopUp.pl",
"PGML.pl",
"unionTables.pl",
"niceTables.pl",
"PGcourse.pl",
"PGchoicemacros.pl",
"answerHints.pl",
"weightedGrader.pl",
"parserRadioButtons.pl",
"parserNumberWithUnits.pl",
"randomizers.pl",
"AnswerFormatHelp.pl",
"parserFormulaUpToConstant.pl"
);
#### Example of a question with numeric values as the answers.
### Question involving Functions
# Create a random function

$a = random(2,13);
$asq = $a**2;
$b = 5;
Context()->variables->set(x => {limits => [a+1,a+10]});
$f = Formula("1/(x*sqrt(x^2-$a^2))")->reduce();
#FormulaUpToConstant is used for antiderivatives - this allows the student to use any integration constant (C, K, etc)
$antiderivative = FormulaUpToConstant("1/$a * asec(x/$a)");
$adwoc = FormulaUpToConstant("asec(x/$a)");
BEGIN_PGML
Calculate [``\int[$f]\,\mathrm dx``].
(Hint: Make the substitution [`x=[$a]u`].)
[_]{$antiderivative} [@ AnswerFormatHelp("formulas") @]*
END_PGML
BEGIN_PGML_SOLUTION
Make the substitution [`x=[$a]u`] as suggested, which means [`x^2=[$asq]u^2`] and [`\mathrm dx=[$a]\,\mathrm du`].
Simplify after making the substitution, pulling the [`[$a]`] out of the square root.
You should find you have an extra factor of [`[$a]`] on the bottom.
The answer is [``\dfrac1{[$a]}[$adwoc]``].
END_PGML_SOLUTION
ENDDOCUMENT();   


In reply to Bill Shillito

Re: Can't generate enough valid points for comparison

by Danny Glin -

In your code you are missing the dollar signs on a+1 and a+10.

In reply to Danny Glin

Re: Can't generate enough valid points for comparison

by Bill Shillito -

. . . WOW. Of course it was something small like that.

Though now I'm wondering, why did it even run beforehand? Why didn't it throw an error?