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();