Re: Why Mathematica does not issue a warning when the calculations
- To: mathgroup at smc.vnet.net
- Subject: [mg117704] Re: Why Mathematica does not issue a warning when the calculations
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Wed, 30 Mar 2011 04:10:25 -0500 (EST)
John Travolta Sardus wrote: > On 24.03.11 12:32, Daniel Lichtblau wrote: > > (several things and) > >> precision tracking and fixed precision > > > ok, so I realize there is a deeper point which I had failed to > appreciate properly. I will take my time to read through the > documentation, although probably I won't understand it up to the lat detail. > > Anyway, when writing I had something in mind, somewhat naive, but I > thought it had something to do with the general issue (that is, it would > be nice to have software that *always* warns when the calculations are > losing precision). That is not possible with hardware or any other fixed precision arithmetic. For software arithmetic that keeps track of precision, the warning, so to speak, is in the precision. That is, numbers will carry with them a precision which can be queried by Precision[]. There are also some functions that issue verbal cautions (I think NIntegrate might be one such). > First a (very naive) point of view > > - when a calculation is impossible for a computer, then just do not do > it ... do not subtract two very large numbers that are almost equal to > each other hoping to get their difference correct to the n-th decimal > digit (ok, almost joking here) Glad to hear that, because I've no idea how to test in advance whether cancellation error will be an issue. That's one reason precision tracking is useful: it provides an approximate upper bound on error. > What I actually had in mind > > - there are algorithms which, I know, can give a nice rule on the > expected usefulness of the result beforehand (the most important case > that I know of is the condition number for matrix inversion: by the way, > I have verified that Mathematica issues the usual warning when dealing > with an ill-conditioned matrix, and that stating a precision). When > reflecting about it, it seems very unlikely that there is a simple > criterion for every algorithm (quoting again ... >> Many computations cannot be done with good >> error control, or a priori estimates of needed initial precision. > So, to make my original question more precise, are the algorithms > corresponding to each Mathematica command (of which there is only a > finite set ...) classified into "algorithms with good error bounds" and > "algorithm without" and is there such a list? I guess not, and in any > case it is better to learn about this "significance arithmetic" if one > wants to use Mathematica with its "arbitrary precision arithmetic". I do not know of such a list. I believe most transcendental and all elementary function evaluations are reliable. Linear algebra is fairly good about deducing bad conditioning. Root finding and optimization will depend on whether one starts in a zone of attraction. Generally a warning is issued if the result appears to be bad. Numeric differential equations, quadrature, and the like might be less well understood in terms of assessing ill conditioning. > Just to make an (extreme?) example of what can happen, I was fooling > around with ill-conditioned matrices, to see whether I could obtain > accurate results for the solution of ill-conditioned linear systems > using the second argument to the N function. After a while of playing > around I entered the following (I wanted to introduce a new vector of > known values into my calculations) > > b = {1, -999999999999998} > > Resulting into the output: > > {1, -999997999000002} > > > I guess one needs first to learn how to use Mathematica, then he can use > it effectively Without knowing what was the matrix on the left hand side, I cannot say whether or not this is a reasonable result. Daniel Lichtblau Wolfram Research