Numeric error propagation: Difference between revisions

Content added Content deleted
m (Undo revision 218619 by Rdm (talk) - broke arithmetic evaluation)
m (J: explain why we have @}. in the unc definition)
Line 681: Line 681:
unc=: {:@}."1 : ,.
unc=: {:@}."1 : ,.
dist=: +/&.:*:</lang>
dist=: +/&.:*:</lang>

Note that if a number has no uncertainty assigned to it, we assume the uncertainty is zero.


Jumping into the example values, for illustration purposes:
Jumping into the example values, for illustration purposes:
Line 720: Line 722:
<lang j> exp&0.5 (x1 sub x2) add&(exp&2) y1 sub y2
<lang j> exp&0.5 (x1 sub x2) add&(exp&2) y1 sub y2
111.803 2.48717</lang>
111.803 2.48717</lang>

=={{header|Java}}==
=={{header|Java}}==
<lang java>public class Approx {
<lang java>public class Approx {