On Apr 15, 5:33 pm, Arnaud Delobelle wrote:
> I still don't think mutable floats are necessary. Here is an approach
> below - I'll let the code speak because I have to do some shopping!
Hats off to you, Arnaud! I'm very impressed by the ideas found in
your code. :)
Your UExpr object is almost
Th^H^H
On Apr 16, 5:51 am, a...@pythoncraft.com (Aahz) wrote:
> In article <3b01d8f1-6a77-4374-b1c2-25bee7cdf...@x3g2000yqa.googlegroups.com>,
>
> wrote:
>
> >Steven, I'd appreciate if you could refrain from criticizing so
> >bluntly so many points. I'd be great if you trusted me more for
> >kn
Thanks, Piet! Before reading your post, I did not know that defining
__float__() was enough for math.sin() to be able to calculate
something!
To summarize my current understanding for the original problem:
- Mutable floats seem to be the only way of performing (correct)
uncertainty calculations
Arnaud, your code is very interesting!
On Apr 15, 1:00 pm, Arnaud Delobelle wrote:
> I still don't understand why you need mutable floats.
Here is why: the code that your proposed (or any code that does
straightforward error propagation, for that matter) does not generally
calculate uncertaintie
It looks like Dan found what is in effect a mutable float
(numpy.array).
Now, with respect to the initial problem of having mutable floats that
also contain an uncertainty attribute, I'd like to note that
numpy.ndarray can be subclassed: it now looks possible to create a
mutable float class that a
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 wi
Steven, I'd appreciate if you could refrain from criticizing so
bluntly so many points. I'd be great if you trusted me more for
knowing what I'm talking about; I've been a programmer for 25 years,
now, and I pretty well know what my own code looks like! I appreciate
your input, but please soften
Dan, wow! This looks extremely promising!
I initially tried to create a Float_ref class that inherits from
numpy.array, so that objects of the new class behave like numpy.array
in calculations, but also contain an "uncertainty" atribute, but this
is apparently not allowed ("cannot create 'builti
To Peter: What I had in mind was to implement your calc() function;
you could do something similar with your loop in the previous post by
replacing "for f.shift..." by "f.shift = 1"; this would give you 2
values, which you can combine with your unused variable in order to
obtain the same value as w
Ben F., you're right on the money! You expressed exactly what I'm
looking for. Why should I want this? because the place in the code
where (foo, baz) is calculated has _no idea_ of what foo and baz are,
of where they were defined, etc.; on the other hand, the floatref
class can keep track of the
Thanks Dave for your thoughtful remarks, which you sent right when I
was writing a response to the previous posts.
I was wondering about a kind "mutable float"; so you're right, it's
not fully a float, because it's mutable. I'd like to have an object
that behaves like a float in numerical calcula
Thank you all for your input. It is not yet obvious how to achieve
the goal/need that I had in mind in the original post. Basically, I
would need to be able to calculate the derive() function of Peter, but
without knowing what arguments are passed to the function f under
study. Here is why:
I'
It looks like what is needed here are a kind of "mutable float". Is
there a simple way of creating such a type? I don't mind changing the
value through x.value = 1.23 instead of x = 1.23... :)
On Apr 14, 3:03 pm, eric.le.bi...@spectro.jussieu.fr wrote:
> Hello,
>
> Is there a way to easily build
Hello,
Is there a way to easily build an object that behaves exactly like a
float, but whose value can be changed? The goal is to maintain a list
[x, y,…] of these float-like objects, and to modify their value on the
fly (with something like x.value = 3.14) so that any expression like "x
+y" uses
14 matches
Mail list logo