WeBWorK Problems

bug in math objects?

bug in math objects?

by Peter Selinger -
Number of replies: 3
I am looking at this problem: Library/FortLewis/Calc3/17-2-Motion-velocity/HGM4-17-2-30-Motion-velocity-acceleration.pg

For example, with random seed 0, the "correct answer" is displayed as:

i + 4k + (t-2) \cdot 3.14159j + 2k

However, it should be:

i + 4k + (t-2) \cdot (3.14159j + 2k)
It is not a bug in the problem itself: the code says

$P = $displacement->eval(t=>"$b");
$V = $velocity;
$T = Formula("(t - $b)") -> reduce;
$L = $P + $T * $V;

However, the "$V" part of the formula is somehow not correctly parenthesized when displayed by WebWork. The formula is internally treated correctly, i.e., i + 4k + (t-2) (pi j + 2k) is accepted as the correct answer. It just seems to be a display error. Potentially a bug?

-- Peter
In reply to Peter Selinger

Re: bug in math objects?

by Peter Selinger -
Sorry about the messed-up formatting. There are some characters that are invisible in the HTML editor but show up in ASCII.

The correct answer was displayed as

i + 4k + (t-2) \cdot 3.14159j + 2k

but actually should be

i + 4k + (t-2) \cdot (3.14159j + 2k),

with a parenthesis around the last part.

In reply to Peter Selinger

Re: bug in math objects?

by Peter Selinger -
I am having a second technical problem with this very question, i.e., Library/FortLewis/Calc3/17-2-Motion-velocity/HGM4-17-2-30-Motion-velocity-acceleration.pg

A student entered the following answer in field 3:

<-3.14sin(3.41t), 3,14cos(3.14t), 5>

Note that he used a comma instead of a period in one of the 3.14's.

Instead of giving a sensible error message, such as "your vector has 4 components", or even a syntax error, his input essentially crashed Perl, and he received the following internal error message:

"Warning -- there may be something wrong with this question. Please inform your instructor including the warning messages below."


WeBWorK Warnings

WeBWorK has encountered warnings while processing your request. If this occured when viewing a problem, it was likely caused by an error or ambiguity in that problem. Otherwise, it may indicate a problem with the WeBWorK system itself. If you are a student, report these warnings to your professor to have them corrected. If you are a professor, please consult the warning output below for more information.
Warning messages

Error in Translator.pm::process_answers: Answer AnSwEr0003: |<-3.14sin(3.41t), 3,14cos(3.14t), 5>|
Method 'ijk' can only be used on vectors in three-space at line 565 of [PG]/lib/AnswerHash.pm
Died within AnswerEvaluator::evaluate called at line 1 of (eval 1119)

Error in Translator.pm::process_answers: Answer AnSwEr0003:

Answer evaluators must return a hash or an AnswerHash type, not type || at /opt/webwork/pg/lib/WeBWorK/PG/Translator.pm line 1247
Use of uninitialized value in addition (+) at (eval 1031) line 1705.

(End of error message).

I understand that such error messages are usually meant for programming errors, and not in response to wrong user input?

If this is a bug in the problem, I wonder how it could be fixed?

Thanks, -- Peter
In reply to Peter Selinger

Re: bug in math objects?

by Peter Selinger -
I'm not sure why, when I enter a formula in a forum post, it later shows up as blank. Maybe it interpreted "<" and ">" as HTML. Sorry about that. Anyway, here is what the student typed:

<-3.14sin(3.41t), 3,14cos(3.14t), 5>