[Numpy-discussion] numerical noise for simple calcululations
Sun Feb 10 13:23:47 CST 2008
I need just a single number "in avarage".
I have committed some changes to NLP/NSP ralg solver from
scikits.openopt, for non-noisy funcs it works better, but for noisy
funcs vise versa, hence now my examples/nssolveVSfsolve.py doesn't work
as it should be, so I need to implement "noise" parameter and assing a
default value to the one.
So, the question is: what default value should be here? I was thinking
of either 0 or something like K*numpy.machine_precesion, where K is
something like 1...10...100.
Timothy Hochberg wrote:
> On Sun, Feb 10, 2008 at 4:23 AM, dmitrey <firstname.lastname@example.org
> <mailto:email@example.com>> wrote:
> hi all,
> I need a good estimation of noise value for simple calculations.
> I.e. when I calculate something like sin(15)+cos(80) I get a solution
> with precision, for example, 1e-11.
> I guess the precision depends on system arch, isn't it?
> So what's the best way to estimate the value?
> I guess here should be something like 10*numpy.machine_precision,
> isn't it?
> This is a complicated subject, which I'm really not qualified to
> comment on, but I'm not going to let that stop me. I believe that you
> want to know how accurate something like the above is given exact
> inputs. That is a somewhat artificial problem, but I'll answer it to
> the best of my ability.
> Functions like sin, cos, +, etc can in theory compute there result to
> within on ULP, or maybe half an ULP (I can't recall exactly). An ULP
> is a Unit in the Last Place. To explain an ULP, let's pretend that we
> were using decimal floating point with 3 digits of precision and look
> at a couple of numbers:
> 1.03e-03 --> 1 ULP = 1e-5
> 3.05e+02 --> 1 ULP = 1
> We're obviously not using decimal floating point, we're using binary
> floating point, but the basic idea is the same. The result is that the
> accuracy is going to totally depend on the magnitude of the result. If
> the result is small, in general the result will be more accurate in an
> absolute sense, although not generally in a relative sense.
> In practice, this is drastically oversimplified since the inputs are
> generally of finite accuracy. Different functions will either magnify
> or shrink the input error depending on both the function and the value
> of the input. If you can find an easy to read introduction to
> numerical analysis, it would probably help. Unfortunately, I don't
> know of a good one to recommend; the text I have is a pretty hard slog.
> To complicate this further, functions don't always compute there
> results to maximum theoretical accuracy; presumably in the interest of
> reasonable performance.
> So, in the end the answer is; it depends. In practice the only useful,
> simple advice I've seen to get a handle on accuracy is to compute
> results using at least two different precisions and verify that things
> are converging sensibly. And compare to known results wherever possible.
> . __
> . |-\
> . firstname.lastname@example.org <mailto:email@example.com>
> Numpy-discussion mailing list
More information about the Numpy-discussion