mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

Arithmetic of numbers with error bound

Open HanchaiN opened this issue 3 years ago • 5 comments

Since this module supports units and physical constants, which normally contain errors in the value, I'd suggest to implement a numerical type with an error bound (either defined by min-max bound or standard deviation). This might be a very big feature to implement but this issue is opened just in case somebody (including me) want to use it.

HanchaiN avatar May 26 '22 13:05 HanchaiN

Like interval arithmetic?

Yaffle avatar May 26 '22 16:05 Yaffle

Maybe. As mentioned, the error might be defined by min-max bound (using interval arithmetic) or standard deviation (using algebra of random variables).

HanchaiN avatar May 27 '22 06:05 HanchaiN

It's an interesting idea. I think it's probably a lot of work, and I'm not sure there is a lot of need for it, so I'm not sure if we should implement something like this.

First thought: we could implement a new numeric data type which can hold both a numeric value and an error bound. Then, we should implement support for this data type for all functions and operators and correctly propagate error bounds.

josdejong avatar May 27 '22 11:05 josdejong

I wonder how many base functions are there in this module? Since most functions are based on other functions and the rest depends on built-in operation in javascript. Still, defining the new type and changing all the typing-related code would be a significant change (I think it's considered a feature, a minor update, but the scale might be equivalent to that of the major release.)

HanchaiN avatar May 27 '22 12:05 HanchaiN

There is not a clear separation between "base functions" and the rest, many functions are built upon others. Most important base functions are arithmetic functions (about 30 functions) and trigonometric functions (about 30 functions).

josdejong avatar May 31 '22 09:05 josdejong

As this is an open-ended proposal rather than a specific actionable issue at this time, moving to Discussions.

gwhitney avatar Oct 03 '23 01:10 gwhitney