Re: Why Mathematica does not issue a warning when the calculations
- To: mathgroup at smc.vnet.net
- Subject: [mg117647] Re: Why Mathematica does not issue a warning when the calculations
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 29 Mar 2011 06:53:08 -0500 (EST)
In addition (for some curious reason) Richard never bothers to point out that
z = 1.0000000000000000000;
Block[{$MaxPrecision = 20, $MinPrecision = 20},
Table[(z = 2*z - z), {42}]]
will give the output that other systems give (with all the accompanying problems your post below mentions).
In other words, his (and only his) gripe is only with Mathematica's *default* arithmetic.
Andrzej Kozlowski
> Richard Fateman wrote:
>> On 3/21/2011 4:13 AM, John Travolta Sardus wrote:
>>> With Mathematica 8.0.1
>>>
>>> N[FractionalPart[(6 + Sqrt[2])^20]]
>>>
>>> Result:
>>>
>>> -160.
>>>
>>> Is it a problem for all numerical software being able to recognize when
>>> these calculations cannot be performed with the given machine accuracy?
>>
>> Yes, it is a problem. There is some support for this in other
>> computational systems (e.g. "inexact" traps), and Mathematica has
>> some tools involving increasing the precision of results, but basically
>> recognizing that your answer is wrong is, in general, a problem.
>>
>>> Does this happen in this case only (where a wrong result is easily
>>> recognized) or in other cases too?
>>
>> It happens in cases where you cannot see it directly, as well.
>
>> To some extent this is a problem with all arithmetic that is of finite
>> precision, but it is especially a problem with Mathematica because of
>> its unusual arithmetic.
>
> The example below, and the claim above, are completely tail backwards.
>
> In slightly more detail, this is the customary gripe, from one poster,
> about degradation of precision when using precision tracking. But that
> degradation is made apparent by the low or zero precision of the result.
>
> By way of contrast, programs that do no tracking give arbitrarily
> terrible results, only with NO warning. So they might well get wrong the
> example from the original post, even when ostensibly working at high
> precision.
>
>
>> Try this
>>
>> z = 1.11111111111111111111
>> While [(z = 2*z - z) != 0, Print[z]]
>>
>> This loop should never terminate, since 2*z-z is equal to z and is
>> clearly very far away from zero, and setting z=2*z-z should not
>> make it any closer to zero... Yet it terminates. So a test
>> internal to a Mathematica program that involves arithmetic and
>> comparison can produce odd results.
>>
>> This phenomenon is well-known to certain denizens of this newsgroup,
>> who claim it is a feature.(!) You can judge for yourself.
>>
>> RJF
>
> Richard,
>
> The development of Mathematica, and usage of significance arithmetic, is
> not going to change. The fact that you do not like it, or even
> necessarily know how to use it to advantage, will not alter that. My
> advice: get past it. Move onto something more important. Justifying this
> particular gripe as important is not the tack to take (since you've gone
> that route before and made no impression).
>
> Daniel Lichtblau
> Wolfram Research
>