[Numpy-discussion] Testing for close to zero?
Charles R Harris
Mon Jan 19 23:36:02 CST 2009
On Mon, Jan 19, 2009 at 9:17 PM, Robert Kern <firstname.lastname@example.org> wrote:
> On Mon, Jan 19, 2009 at 22:09, Charles R Harris
> <email@example.com> wrote:
> > On Mon, Jan 19, 2009 at 7:23 PM, Jonathan Taylor
> > <firstname.lastname@example.org> wrote:
> >> Interesting. That makes sense and I suppose that also explains why
> >> there is no function to do this sort of thing for you.
> > A combination of relative and absolute errors is another common solution,
> > i.e., test against relerr*max(abs(array_of_inputs)) + abserr. In cases
> > this relerr is typically eps and abserr tends to be something like 1e-12,
> > which keeps you from descending towards zero any further than you need
> I don't think the absolute error term is appropriate in this case. If
> all of my inputs are of the size 1e-12, I would expect a result of
> 1e-14 to be significantly far from 0.
Sure, that's why you *chose* constants appropriate to the problem. As to
this case, I don't know what the quadratic is or what methods are being used
to solve it, or even if the methods are appropriate. So the comment was
general and I think many numeric methods for solving equations use some
variant of the combination. For instance, the 1D zero finders in Scipy use
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion