MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why Mathematica does not issue a warning when the calculations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117570] Re: Why Mathematica does not issue a warning when the calculations
  • From: Richard Fateman <fateman at cs.berkeley.edu>
  • Date: Wed, 23 Mar 2011 02:53:30 -0500 (EST)
  • References: <im7bsu$t7r$1@smc.vnet.net>

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.

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


  • Prev by Date: Re: Q for WRI: What % of users are on platform x?
  • Next by Date: Re: Handling conditions on subvector elements
  • Previous by thread: Re: Why Mathematica does not issue a warning when the calculations
  • Next by thread: Re: Why Mathematica does not issue a warning when the calculations