Re: Calculating with imprecise values

new topic     » goto parent     » topic index » view thread      » older message » newer message

jxliv7 wrote:

> Juergen, what i think you're talking about is significant digits and
> significant
> decimals. there's some excellent discussions of them at
>    http://mathforum.org/dr.math/ 
> and in particular
>    http://mathforum.org/library/drmath/view/56375.html
>    http://mathforum.org/library/drmath/view/59014.html

I think what I mean is something mentioned on this ^^^^ page.

> there are no Euphoria libraries that i know of that deal with this, since the
> results of any multiplication, division, addition, substraction, sqare root,
> etc., can vary considerably dependent on what the user wants. figuring taxes
> is different (between Europe and the US, for example), 

Yes, of course.

> rounding is different
> (which digit to base the rounding on, round up, round down, truncate),
> scientific
> calculations are different, etc.
> 
> what i've done with my apps is basically have the user make the choice
> beforehand
> of the precision of any calculation.
> 
> hope that helps,

Thanks.
I think what I mean has got to do with what is called "error propagation".

For example, if I measure a length with a ruler that shows millimeters,
the measurement will be accurate to one millimeter. So if I measure the
value 12 mm, the "real" value is somewhere between 11.5 and 12.5 mm.
Then I measure another distance, and I get 4 mm, that means the "real" value
is somewhere between 3.5 and 4.5 mm.
Now for some reason I have ro add both values. So I am thinking of a
function like the following:

function add_with_error (atom a, atom delta_a, atom b, atom delta_b)
   atom min, max

   min = (a-delta_a) + (b-delta_b)
   max = (a+delta_a) + (b+delta_b)
   return {min, max}
end function


Given the example above, I would call the function like this:

? add_with_error(12,0.5,4,0.5)


This prints {15,17}. So I have got some *additional* information.
Normally I would get the result 12+4 => 16,
and I would have the feeling "Well, 16 might not be the exact result,
because the ruler is not 100% precise".
Using a function such as add_with_error(), I know now that the actual
result is between 15 and 17.

Does that make sense? smile

Regards,
   Juergen

-- 
Have you read a good program lately?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu