## WeBWorK Main Forum

### More on problems with test_points ### More on problems with test_points

by Yoav Freund -
Number of replies: 0
Continuing my earlier letter. I finally found a solution that works, but it is
ugly.

To recap, my problem was check answers when the correct answer is a factorial, say "k!"

This is a solution that works:

BEGIN_TEXT
$BCENTER (C) \{ans_rule(15)\}$ECENTER
END_TEXT
$TestPoints1 = [1,2,3,4,5,6,7,10]; ANS(fun_cmp("k!", var=>["k"], test_points=>$TestPoints1));
I did not manage to find a working solution using Formulas. Looking for help in the archives, I found sombody else had a similar problem (in OpenProblemLibrary/Union/setIntSigmaNotation/an6_4_06.pg):

$showPartialCorrectAnswers = 1;$ansf = "(-1)^(k+1)*2k" ;
$ansg = "(-1)^(k)*2(k+1)" ; ANS(fun_cmp($ansf, vars=>"k", test_points=>[1,2,3,4,5]));
ANS(fun_cmp($ansg, vars=>"k", test_points=>[0,1,2,3,4])); ## Note: I left the answer-checking in the "old style" since I don't know how ## to specify the test points with the new parser. ## I tried ## Context()->variables->are(k=>'Real'); ## ANS(Formula($ansf)->cmp(test_points => [1,2,3,4,5]));
## but this generates the error message "Can't generate enough test points for comparison"
## when answering the question -PF 12/06

I get the same error message.

Interestingly, if I use an expression that does not involve factorials, such as "k/(k+1)", there is no problem...

As I don't know how to do it with Formulas, I don't know how to do it using PGML. Is there a way of using the old style comparison fun_cmp inside PGML?

Yoav