WeBWorK Problems

Syntax: Parentheses and Exponents

Syntax: Parentheses and Exponents

by Christopher Heckman -
Number of replies: 4
I've written up a diagonalization problem for a linear algebra course, and it has a peculiar glitch in it. 

The problem asks for the entries of An where A is a 2x2 matrix. The answers are functions of n, and WeBWorK seems to be accepting some versions of the correct answer but not others.

For instance, if the correct answer is 3·2n + 3n, the student should be able to enter 3*2^n+3^n and get it right. However, WeBWorK says this is wrong.

However, WeBWorK does accept 3*(2)^n+(3)^n as a correct answer. The requirement that the base of the exponent be put in parentheses seems artificial.

Looking over the problem code, I didn't do anything unusual, other than change the tolerance mode to absolute. (This was causing errors when the answer was 0.) However, I noticed that when I was setting up the formulas with the correct answer, I have parentheses there. Is that what's causing the problem?
In reply to Christopher Heckman

Re: Syntax: Parentheses and Exponents

by Davide Cervone -
I am not able to reproduce the problem. Can you give a seed value that produces the version of the problem that is causing the issue?

Also, what version of WeBWorK and PG are you using?
In reply to Davide Cervone

Re: Syntax: Parentheses and Exponents

by Christopher Heckman -
A seed where it fails is 2980.

ww_version: 2.9
pg_version: 2.9
In reply to Christopher Heckman

Re: Syntax: Parentheses and Exponents

by Davide Cervone -
This seed doesn't produce the 3's an 2's in your example, it produces -34 and 34 for me. Note that you do need to use parentheses around -34 in (-34)^n since -34^n means -(34^n) by the rules of operator precedence. You do not need parentheses for 34^n, and the answer is accepted for me without them.

Note that your change to absolute tolerance will require students to enter their decimals to unusually high precision (for this seed, on the order of 10 or more digits). Because you are testing at n=4, and 34^4 = 1336336, asking for an absolute tolerance of .0001 means that you are asking for at least 11 digits of precision, which seems a bit extreme. Because the values for n=1, 2, 3, and 4 will be of vastly different magnitudes, absolute tolerance is probably not a good choice, here.

You said that relative error was causing problems for values that are zero, but don't say what those problems were. Perhaps there is a better solution.
In reply to Davide Cervone

Re: Syntax: Parentheses and Exponents

by Christopher Heckman -
I was only using 2^n and 3^n as an example. (a) I couldn't remember the exact formula, and (b) it was a messy formula, which only clouded the basic issue.

The student stumbled around the "parentheses around the 34s" solution.

The relative tolerance was causing other problems. With the seed I gave you, the matrix A has the property that A^2 has two entries which are exactly zero. If students round off their answers (say, 1/3 to 0.3333333333), using relative tolerance will tell them that their answer is wrong.