I cannot seem to get the answer checker to recognize the answer "All real numbers". I've tried "(-inf, inf)" and
""(-infty, infty)", and "R".
--rac
If you want to allow R as an answer, you can add it bad in as follows:
Context()->constants->redefine("R",from=>"Interval");This causes the current context to get a copy of the definition of R from the Interval context.
I guess the way to specify this as an inequality would be to use -inf < x < inf (although either -inf < x or x < inf by itself would also work). This was not allowed, but I have modified contextInequalities.pl to permit these inequalities.
Davide
OK, I now can use "R" and "-inf < x < inf", thank you.
Next, is there a way to let the students enter "All real numbers" as an alias for "R"? I'd like to have this as an option because for Intermediate Alg students, if they enter "inf" on their homework, they will continue to do so on their quizzes and tests. At least "All real numbers" makes sense to everyone all the time, but it's not a big deal.
Here's what I've tried and the only thing that happens is the student's answer now shows up as "R"after the submit button is pressed, but it is scored as incorrect.
Context()->strings->add("All real numbers"=>{alias=>"R"});
Context()->constants->redefine("R",from=>"Interval");
Thanks again -- rac
If you want "All real numbers" to be equal to (-inf,inf), then you need to make "All real numbers" be a constant, not a string. That would be
Context()->constants->redefine("All real numbers",from=>"Interval",using=>"R");The problem is that constant names are not allowed to contain spaces. So in order to do this, you need to change the allowed constant names first:
Context()->constants->{namePattern} = qr/.*/; Context()->constants->redefine("All real numbers",from=>"Interval",using=>"R");This first line allows names to be anything (any string of any characters). Note, however, that this is case-sensitive, and that students could use this just as they could (-inf,inf), so could make formulas that include "All real numbers", as in
1 < x or all real numbers
Alternatively, you can make "All real numbers" into a string
Context()->strings->add("All real numbers"=>{});(which will be case-insensitive), and use "All real numbers" when that is the correct answer. Students can enter a string without an error message (though it will be marked incorrect). When it is the correct answer, however, you may want to add typeMatch=>"Interval" to the cmp() call in order to get the proper type checking on the student's answers.
Hope that helps.
Davide