precision and accuracy
- To: mathgroup at yoda.ncsa.uiuc.edu
- Subject: precision and accuracy
- From: Jeffrey P. Golden <uunet!ALLEGHENY.SCRC.Symbolics.COM!jpg>
- Date: Mon, 2 Apr 90 16:18 EDT
Date: Mon, 26 Mar 90 13:03:08 CST From: wri!keiper at yoda.ncsa.uiuc.edu (Jerry Keiper) [...] As to increasing the precision of a number, Mathematica allows this to be done very simply using SetPrecision[] (likewise the accuracy can be increased with SetAccuracy[].) y = SetPrecision[x, prec] gives y a value such that y == x is True and such that the precision of y is prec. If the precision of y is greater than the precision of x the "missing" digits of x are filled in for y with 0's in binary. This does not mean that they will appear as 0's in decimal however. e.g. the decimal number 1.2 has a nonterminating binary expansion 1.0011001100110011001100... Clearly if we start with a finite approximation to this and attach 0's in binary we will not get the decimal expansion for 1.200000000... Since it is not possible to know what number a user has in mind when he wants to increase its precision it is not possible to give a better approximation; all that Mathematica can do is give another number with more digits in it. If the user types SetPrecision[1.2,30], I think it is pretty clear that most users mean the same number that SetPrecision[12/10,30] would mean, i.e. fill in with decimal 0's, which is not what Mathematica does. As to relative and absolute error vs. precision and accuracy, precision is a nonnegative integer and accuracy is an integer. Relative and absolute error are small numbers, sometimes complex, but they are never known exactly (if they were the approximate answer could be corrected.) I find it more convenient to deal with an accuracy of 27 rather than an absolute error of 0.000000000000000000000000001, but perhaps not everyone does. I think no one finds it convenient to deal with 0.000000000000000000000000001 . That's why notations such as 1.0 10^-27 (or even 1.0e-27) were invented. (I can't tell whether you're trying to bias the situation or just so used to typing numbers such as 1.20000000000000000000000000000 to Mathematica to get the precision you need!-)