Is there a software package that supports, or could support, through operator overloading or extensions, code such as the following;
x = rand_arr(10) ; array 10 elements long y = rand_arr(10) z = x + y ; elemental addition (z=x+y;z=x+y,...) print z
If the above, or something similar, is valid in this hypothetical language, does it also support, or could it support via operator overloading / custom classes / extensions / whatever, the following additional syntax:
x.err[*] = 0.1 % a fixed error y.err = rand_arr(10) % a dynamic noisy error range z = x + y print z.err
Or whatever the implementation dictates, but the point being that the error is tracked for me through the
z = x+y without work on my part.
I could imagine default support as per a standard (or customizable) function for
log() operators, and support for extensions or hooks to add support for additional functions (system, and user) such as
z = smooth(x,3) and
z = my_func(x^2)
This would be a nice feature for a language.
There is a discussion of ERROR PROPAGATION here.
For the error tracking, I'm assuming that
x.err is the error associated with each measurement, in this case, a constant value of
y.err is similar, but each measurement is part of some noise. Given a standard definition of error propagation, such as the following:
When adding x + y with errors dx and dy, the solution has error dx + dy
Or in code
z = x + y => dz = dx + dy
I can add lines of code to track dz, but is there a language that supports, or could support, dz without me doing extra work?