upiterbarg / mpmath

Automatically exported from code.google.com/p/mpmath
Other
0 stars 0 forks source link

alternative input of intervals #134

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice to have mpi('1.2') resulting in mpi(1.2-0.05, 1.2+0.05).

Currently it tries to set the smallest interval using the current precision
(which might be a sane default), but for many calculations it would be
handy to use only as many digits as given. 

This could be implemented using a flag. Making it default for mpi(string)
might be overkill.

Original issue reported on code.google.com by Vinzent.Steinberg@gmail.com on 11 Mar 2009 at 7:44

GoogleCodeExporter commented 9 years ago
Instead of a flag, perhaps as a special character, say mpi('1.2*')?

Original comment by fredrik....@gmail.com on 12 Mar 2009 at 8:59

GoogleCodeExporter commented 9 years ago
This is indeed better. But maybe it's somewhat cryptic?

1.23e-34* and 1.23*e-34 are ugly. I'd prefer a character that doesn't 
correspond to
an arithmetic operation.

Original comment by Vinzent.Steinberg@gmail.com on 12 Mar 2009 at 10:21

GoogleCodeExporter commented 9 years ago
It would be possible to use the standard notation for uncertainty, 1.20(5).

Original comment by fredrik....@gmail.com on 13 Mar 2009 at 8:25

GoogleCodeExporter commented 9 years ago
Also '1.2?' is an option.

Original comment by fredrik....@gmail.com on 13 Mar 2009 at 8:32

GoogleCodeExporter commented 9 years ago
Current behaviour:

>>> mpmathify('1.23(4)')
mpi(mpf('-2.77'), mpf('5.2300000000000004'))
>>> mpmathify('1.23+-4')
mpi(mpf('-2.77'), mpf('5.2300000000000004'))

I'm not aware of the standard notation 1.20(5). What does it mean?

'1.2#' might be an option too.

Original comment by Vinzent.Steinberg@gmail.com on 16 Mar 2009 at 6:04

GoogleCodeExporter commented 9 years ago
It's standard in chemistry and at least very common in some some branches of 
physics
(e.g. subatomic physics). See 
http://en.wikipedia.org/wiki/Measurement_uncertainty

Original comment by fredrik....@gmail.com on 16 Mar 2009 at 6:11

GoogleCodeExporter commented 9 years ago
Thank you!

So our current implementation is wrong. I like this notation, let's implement 
it.
It's in my opinion better than a special character. And it won't be confused 
with
1.23(2.3%), I think.

(BTW, I just stumbled upon this notation when searching for atomic masses of 
some
isotopes. :)

Original comment by Vinzent.Steinberg@gmail.com on 16 Mar 2009 at 6:27

GoogleCodeExporter commented 9 years ago
BTW, I think Sage uses 1.23? at least for printing intervals. If any special
character should be used, that might be it.

Original comment by fredrik....@gmail.com on 16 Mar 2009 at 6:32