Problem with frac in PGdiffeqmacros.pl | topic started 10/4/2004; 6:33:42 PM last post 10/5/2004; 8:18:23 AM |
|
|
Davide P. Cervone - Re: Problem with frac in PGdiffeqmacros.pl 10/5/2004; 8:18:23 AM (reads: 1206, responses: 0) |
Danny: I think you are using an old version of the problem, as the frac call is not used in the current one (the change occured in June 2003 according to the CVS logs). The frac call is still in the problem, but the $W answer has been replaced with -$b/$a, as you suggest. The "Operator or semicolon missing before *A" message usually means that the answer included a variable that is not valid in the current formula, in this case "A". Where did that "A" come from? Well the frac() returns a HASH reference, and when that was inserted into the answer string, the answer was set to something like "exp(HASH(0xddaac0)*t)", and WeBWorK parsed this as "exp(H*A*S*H*(0*x*d*d*a*a*c*0)*t)", and tried to evaluate it to obtain the correct answer when only t is given a value. It turns out that since A has no other meaning, perl tries to interpret *A as something called a "typeglob" (sort of a reference to a name rather than an object itself, in this case it refers to main::A as a possible name for something rather than a value). So * here is not multiplication but typeglobbing. The "H" was interpreted as a string constant, and so there are now two operands (a string and a typeglob) with no operator in between, so perl complains that you either left out the operator (or maybe a semicolon that should have separated the end of one command from the beginning of the next one). Anyway, your solution is the right one. The frac should never have been there in the first place. Davide PS, students can generate this error message by tying things like "HASH" as their answer to any function answer. It is also produced if they type "3X" rather than "3x", for example, which can be a bit confusing to students. Luckily, the new parser doesn't have this problem. |