MathGroup Archive 2009

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

Search the Archive

Re: Bug ??????

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105346] Re: Bug ??????
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Sun, 29 Nov 2009 05:08:57 -0500 (EST)

On 11/28/09 at 1:07 AM, wkfkh056 at yahoo.co.jp (ynb) wrote:

>F[x_]:=34880228747203264624081936 - 464212176939061350196344960*x^2
>+ 4201844995162976506469882880*x^4 -
>36736184611200699915890392480*x^6 +
>245136733977616412716801297320*x^8 -
>1144143594851571569661248433072*x^10 +
>3682862525053500791559515638600*x^12 -
>8693355704402316431096075720520*x^14 +
>16394872503384952006491292949865*x^16 -
>26387316917169915527289585290460*x^18 + ...

<rest of definition snipped>

>(*  Bug ?; F[Sqrt[Sqrt[2] + 3^(1/3)] + 1/Sqrt[3^(1/3) + 5^(1/5)]]
>//N
>=3.828176627860558*^38<---Bug ?  *)

>(* =0? *)

This is not a bug. It is inherent when converting things to
machine precision.

Your definition of F is an alternating sum of large powers of x.
The function N converts each subterm to machine precision then
computes the sum. Loss of precision is inevitable when such a
large dynamic range exists in the terms to be summed as is the
case here.

Note, this is not a Mathematica issue. Rather it is inherent to
floating point arithmetic used on any computer system.

To get a simple numerical answer to this problem, there are
several possible approaches. The simplest I can think of would
be either


=46[Sqrt[Sqrt[2] + 3^(1/3)] + 1/Sqrt[3^(1/3) + 5^(1/5)]]//Simplify//N

or

N[F[Sqrt[Sqrt[2] + 3^(1/3)] + 1/Sqrt[3^(1/3) + 5^(1/5)]], 100]

Note neither of these as written above is guaranteed to work.
Usage of Simplify will work *if* the structure of the terms to
be added result in cancellations giving a much simpler prior to
be converted to machine precision.

The second approach will work if the second argument to N is
made sufficiently large.



  • Prev by Date: Re: Replacement rules that contain function arguments
  • Next by Date: piecewice pdf, problems with cdf
  • Previous by thread: Re: Bug ??????
  • Next by thread: Re: Re: Bug ??????