ugly.
To recap, my problem was check answers when the correct answer is a factorial, say "k!"
This is a solution that works:
BEGIN_TEXTI 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):
$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));
$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 howI get the same error message.
## 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
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