loadMacros(↲ "PGstandard.pl",↲ "PGML.pl",↲ "MathObjects.pl",↲ "PGcourse.pl"↲ );↲ ↲ TEXT(beginproblem());↲ $a = list_random(2,3,5,6,7,8,10,11,12,13,14,15);↲ ↲ Context("Numeric");↲ ↲ Context()->flags->set(↲ formatStudentAnswers => 'parsed',↲ reduceConstants => 0,↲ reduceConstantFunctions => 0,↲ );↲ ↲ $sqrt1 = Formula("sqrt($a)");↲ ↲ BEGIN_PGML↲ Enter the exact value of [`[$sqrt1]`]: [__________]{$sqrt1}↲ END_PGML↲ ↲ ENDDOCUMENT();
How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Jan Hlavacek - Number of replies: 9Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Danny Glin -Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Jan Hlavacek -Sorry, my actual problem had
Parser::Number::NoDecimals();
but I forgot to include it in the minimal working example.
That takes care of entering the decimal approximation, but the "Entered" column still shows the approximation.
I would expect that the "Entered" column contains the exact text that the student entered.
Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Michael Gage -Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Jan Hlavacek -I think I misunderstood what the "Entered" column means. I expected it to show the exact text that the student entered. It must be available somewhere, because:
The
Parser::Number::NoDecimals
checks that it is not a decimalThe Preview column displays the square root, so it knows that a square root was entered.
It seems to me that the Formula flags reduceConstants
and reduceConstantFunctions
are not applied when parsing student answer, and so the parsed version is reduced. It would be helpful to have similar flags for the student answer, or have another value, e.g. "asis", for the formatStudentAnswer
flag, that would use the student's answer verbatim.
Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Jan Hlavacek -I am digging into AnswerChecker.pm
, trying to figure out where is the numerical value that appears in the "Entered" column calculated. I am not sure I am unraveling this right, but it seems that $ans->{student_formula}->TeX
has the TeX version of the actual entered answer, while $ans->{student_formula}->string
seems to have the evaluated numerical version.
Also, in cmpContextFlags
, both reduceConstants
and reduceConstantFunctions
are set to 0, so I am now completely confused.
Is there some way how to disable the "Entered" column on per course basis? I found the showAttemptAnswers
flag in AttemptsTable.pm
, but I am not sure where to set it and if it is possible to set it for individual courses.
Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Michael Gage -Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Alex Jordan -Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Jan Hlavacek -Thank you! This does exactly what I need it to do, at least for radicals. I still think students in my remedial class will be confused when they enter something like 2^3
and WeBWorK will claim that they entered 8, but at least these are actually equal.
Re: How to show "sqrt(3)" in the Entered column when previewing or submiting answers?
by Davide Cervone -formatStudentAnswer
not formatStudentAnswers
(singular not plural). If you set that to 'parsed'
, that should show the unevaluated student answer in the "Entered" column. You don't need to set the reduceConstants
or reduceConstantFunctions
flags unless you want to affect the correct answer, as these are set automatically during processing of student answers.