Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Loss of precision when using Simplify

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36988] Re: Loss of precision when using Simplify
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Fri, 4 Oct 2002 05:01:31 -0400 (EDT)
  • Organization: University of Washington
  • References: <angi42$q06$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Bill,

Let's step through the expansion here.

9*(0.546+x[2]))/16

can be expanded to

9*0.546/16 + 9*x[2]/16

which becomes

.307125 + 9*x[2]/16

My question was why the 9/16 gets converted to .5625, as I see no reason to
do so. Even more troubling (to me, at least) is the following:

x[0]+3x[1]/4+9x[2]/16+.4//Simplify

0.4 + x[0] + 0.75 x[1] + 0.5625 x[2]

I don't want Simplify to change my nice rational numbers to machine number
approximations.

Carl Woll
Physics Dept
U of Washington

"Bill Rowe" <listuser at earthlink.net> wrote in message
news:angi42$q06$1 at smc.vnet.net...
> On 10/2/02 at 3:32 AM, carlw at u.washington.edu (Carl K. Woll) wrote:
>
> >I'm writing to report what I consider to be a bug. First, I want to
> >show a simplified example of the problem. Consider the following
> >expression:
> >
> >expr=0.22 + x[0] + (3*(-0.16+ x[1]))/4 + (9*(0.546 + x[2]))/16;
> >
> >When simplified I expected to get some real number plus
> >x[0]+3x[1]/4+9x[2]/16, but instead I get the following:
> >
> >Simplify[expr] 0.407125 + x[0] + 0.75 x[1] + 0.5625 x[2]
> >
> >As you can see, for some reason Mathematica converted the fractions
> >3/4 and 9/16 to real machine numbers. I consider this to be a bug.
>
> You really are not seeing a loss of precision here. When simplify carries
out the indicated multiplication such as  9*.546/16 a machine precision
number is returned because on of the arguments only has machine precision.
It would be incorrect for Mathematica to return a result with greater
precision than the arguements. It would also be incorrect for Mathematica to
refuse to preform the required multiplications when simplifying this
expression.
>
> Or said differently, if you want an exact result from Mathematica *all* of
the information you supply Mathematica must also be exact. It is not
sensible for Mathematica to do otherwise.
>




  • Prev by Date: Re: Accuracy and Precision
  • Next by Date: RE: Mathematica stole my X so I had to kill it
  • Previous by thread: Re: Loss of precision when using Simplify
  • Next by thread: Re: Loss of precision when using Simplify