WeBWorK Main Forum

minimum tolerance

Re: minimum tolerance

by D. Brian Walton -
Number of replies: 0
This may not be a problem with WeBWorK, but an issue with how computers store numbers and where WW is checking your formula. I assume you know that computers only keep a certain number of binary digits. Consequently, there are gaps between numbers for which a computer has no representation. See http://en.wikipedia.org/wiki/Machine_epsilon

This would suggest 1e-16 is the gap when numbers compared are close to 1, so 1e-19 is the gap between 0.001 and the next closest representable number.

I would recommend using relative tolerance and then specify that the test points used in comparing the function stays in a range where the resulting formula does not grow too large.

I have had similar issues involving exponential functions e^{kx} where I needed to set the interval for the test points to adapt with the particular rate of the exponential function so that it would work correctly for a variety of different values of k, for example using an interval [-1/k,1/k].

In your case you might want to avoid an interval where numbers are too small.

D. Brian Walton
James Madison University