WeBWorK Main Forum

Webwork seems to not allow answers smaller than 10^-13. How allow even smaller numbers?

Webwork seems to not allow answers smaller than 10^-13. How allow even smaller numbers?

by Christian Seberino -
Number of replies: 2
Webwork seems to not allow answers smaller than 10^-13.  How allow even smaller numbers?

(Webwork interprets than as zero.)


In reply to Christian Seberino

Re: Webwork seems to not allow answers smaller than 10^-13. How allow even smaller numbers?

by Davide Cervone -
Because WeBWorK uses relative error (which is basically |student-correct|/|correct|) to determine when an answer is correct, if the correct answer is near zero, this becomes numerically unstable. For answers near zero, WeBWorK switches to absolute error (just |student-correct|) and uses a separate tolerance value in that case.

There is a value called zeroLevel that determines when WeBWorK will switch to absolute error (by default it is 10^-14) and a value called zeroLevelTol that is the tolerance to use in that case (10^-12 by default).

So if you want to distinguish values that are smaller than this range, you will need to adjust these two values. If you are using MathObjects, these are stored in the Context, for example

    Context()->flags->set(
      zeroLevel => 1E-15,
      zeroLevelTol => 1E-13
    );
set these to smaller values. I would change these only for the particular answer checker where you need the higher precision, as it could increase the numeric instability of function checking when there are near zeros within the domain limits (the major source of problems with WeBWorK function checking).

Davide

In reply to Davide Cervone

Re: Webwork seems to not allow answers smaller than 10^-13. How allow even smaller numbers?

by Christian Seberino -

Yes!  Seems Webwork can do anything!

You have an answer for anything I throw at you! :)

cs