Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Mathematica bugs?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg67330] Re: Mathematica bugs?
  • From: "Jason Quinn" <jason.lee.quinn at gmail.com>
  • Date: Sun, 18 Jun 2006 05:13:31 -0400 (EDT)
  • References: <e70f29$rf4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Yaroslav Bulatov wrote:
> Also
> x = Pi/4; For[i = 0, i < 50, i += 1, x = 2*Abs[x - 1/2]]; N[Log[x]]
> gives me
> Indeterminate
>
> How can I get an indeterminate here?

   The value of x being sent to Log and causing the problems is EXACTLY
this

281474976710656 \[Pi] - 884279719003555

(Use FullSimplify on the last value). It just so happens that the first
15 digits of (281474976710656 times pi) are the same as the digits in
884279719003555. So when you use N on that number it becomes a
machine-valued zero. The Log of a MACHINE-valued zero is Indeterminate
(Of course, the Log of EXACTLY zero is minus infinity. Try
Log[0] and Log[0.] to see the difference in action.)

>x = Pi/4; For[i = 0, i < 56, i += 1, x = 2*Abs[x - 1/2]]; N[x]
>I get 3. But x should always stay between 0 and 1, why do I get 3?

I really don't understand the answer to this question. It has something
to do with the N function and the way Mathematica handles machine
numbers. For the last x generated by the above snippet of code, the
following commands generate the following output:
<N[x]
<N[x, MachinePrecision]
<N[x, 15.9546]
<N[x, $MachinePrecision]

>3.
>3.
>0.7938724526798038
>0.7938724526798038

I don't understand the output from the first two commands. I always
thought N defaulted to the digits the machine can handle. I'll let
someone else tackle this one.

Jason Quinn


  • Prev by Date: Re: Mathematica bugs?
  • Next by Date: Re: standard errors and confidence intervals in NonlinearRegress
  • Previous by thread: Re: Mathematica bugs?
  • Next by thread: Re: Mathematica bugs?