[Tutor] numerical problem

Gabriele Brambilla gb.gabrielebrambilla at gmail.com
Tue Mar 4 04:44:07 CET 2014


ok,
the things I get is very specific.
my results differs from the other guy's ones with which I compare them for
slightly details.
We fit the data with a function and we obtain different but similar values.
our  fit routines on the same data return the same results. So we produce
different data.
the values in www are like 1.01e-134 and also smaller, and I sum values
like this: there could be any problem summing so small numbers? is there a
Python guide that helps in using strange values numbers?

thanks

Gabriele




2014-03-03 21:02 GMT-05:00 Steven D'Aprano <steve at pearwood.info>:

> On Mon, Mar 03, 2014 at 08:00:52PM -0500, Gabriele Brambilla wrote:
> > Hi,
> >
> > I'm doing a sum in a for loop:
> >
> > www is the quantity I add.
> >
> > MYMAP[i, j, k] = MYMAP[i, j, k] + www
> >
> > MYMAP is a numpy array
> >
> > I have strong reasons to think that in this operation happens some
> > numerical error...Have you suggestions to discover where it is?
>
> You are almost certainly correct. Unless all the numbers are exact
> integers, nearly every floating point operation will add some error.
>
> Without seeing your code, and some representative sample data, it is
> impossible to tell whether the error is tiny or huge.
>
> Tiny error:
>
> MYMAP[1, j, k] = 1.001
> www = 0.25
>
>
> Huge error:
>
> MYMAP[1, j, k] = 1.001e19
> www = 0.25
>
>
>
> --
> Steven
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140303/786711e9/attachment-0001.html>


More information about the Tutor mailing list