Modifying the value of a float-like object

Eric.Le.Bigot at spectro.jussieu.fr Eric.Le.Bigot at spectro.jussieu.fr
Wed Apr 15 06:14:11 EDT 2009


To Dave A. and Piet: I appreciate your taking the time to make
suggestions.  I understand that there is a hitch in the approach that
you describe, which I would like to insist on: how do you handle
functions that use math.sin(), for instance?  numpy does this kind of
magic, but I'm not sure it's wise to spend time reproducing it.  I'd
to not have to modify any calculation code, so that it is legible and
general (in particular, so that it can work with Python floats).  And
again, interval arithmetic fails to produce real standard deviations,
because of correlations between uncertainties.

Hence my idea to have mutable floats, that would be changed in some
_external_ error calculation routine (i.e. a routine which is
completely independent from the calculation f()), in a way equivalent
to Peter's derive() function--except that the values used in f() are
only accessible through a list of objects, as in Ben's post.  I'll
implement this with 1x1 numpy.array objects, even though this will
mean that numbers will not have an unambiguous uncertainty attribute,
as I mentioned in a previous post.  I'll post here the result of my
investigations.



More information about the Python-list mailing list