Re: Would you post this Mathematica question to news group for me, please?

*To*: MathGroup at yoda.physics.unc.edu*Subject*: Re: Would you post this Mathematica question to news group for me, please?*From*: keiper*Date*: Mon, 6 Jul 92 08:14:31 CDT

andrew at ll.mit.edu (Andrew Hecht) writes: > I have a problem with mathematica, version 2.0 (on NeXT): When I > perform the following iteration using numbers with high precision, I > get erroneous results. For example, with > a = 3.75000000000000000000000000000000000000000000000... > t = a/2 > and using the following iteration technique: > x = t; Do[Print[x]; x = a x - x^2 ,{140}] ; N[x,80] > the results for the 135th through 140th iteration are > 3.0, 2.0, 0.0, 0.0 Yes, that's one of the problems with significance arithmetic. All uncertainties in the values in any expression are (and must be) treated as independent. When you do arithmetic with uncertain numbers you get an answer containing only those digits which are known to be correct based on the assumption of independence of all uncertainties. In many iterations the uncertainties are not at all independent and in fact they tend to cancel each other. A more sophisticated error analysis would reveal just how well or ill conditioned the iteration may be, but such analysis would be completely impractical if built into the basic arithmetic of Mathematica. (It would be possible to do by giving a serial number to a symbolic representation for each rounding error throughout the calculation, but the result would be huge and unusable.) Since it is not practical to build error analysis into basic arithmetic and the overly pessimistic results produced by the repeated use of the triangle inequality are often not acceptable you have to somehow prevent the degradation of precision that occurs with the default arithmetic. In Version 2.1 you can set the global variable $MinPrecision to some positive value and then every result will have at least that precision. NOTE HOWEVER THAT THIS WILL OFTEN PRODUCE DIGITS THAT ARE UNJUSTIFIED. YOU WILL HAVE TO DO YOUR OWN ERROR ANALYSIS TO KNOW HOW MANY DIGITS ARE CORRECT. It is highly recommended that you only change $MinPrecision and $MaxPrecision within the confines of a Block[ ] statement to prevent the effects of their changes interfering with all of your calculations. (Yes, that's Block[ ]. Do not use Module[ ] for this because it won't work.) Prior to Version 2.1 about all you can do is use SetPrecision[ ] to expliciily force the precision of each calculation in the iteration to be a certain value. Jerry B. Keiper keiper at wri.com