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

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

Search the Archive

Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica 4,on NT

  • To: mathgroup at smc.vnet.net
  • Subject: [mg20230] Re: [mg20220] Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica 4,on NT
  • From: "Andrzej Kozlowski" <andrzej at tuins.ac.jp>
  • Date: Fri, 8 Oct 1999 18:30:11 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

N[Pi,a] is always computed with $MachinePrecision for a less than 
$MachinePrecision (=16 on your platform). So all your numbers N[Pi,1],
N[Pi,2] etc until N[Pi,16]  have exactly 16 digits of precision and are the
same. You can see them all by using InputForm[N[Pi,2]] etc. By default
Mathematica dispalys only 6 digits of machine precision numbers. You can
change this using the Options Inspector (In Display Options inside
Expression Formatting).

Finally if you really want to get the result you wanted evaluate:
Table[{i, SetPrecision[Pi, i]}, {i, 1, 20}]
--
Andrzej Kozlowski
Toyama International University
JAPAN
http://sigma.tuins.ac.jp
http://eri2.tuins.ac.jp


----------
>From: R&M <randmarg at magma.ca>
>To: mathgroup at smc.vnet.net
>Subject: [mg20230] [mg20220] Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica
4,on NT
>Date: Wed, 6 Oct 1999 21:06:36 -0400
>

> If I execute:
>
> Table[{i, N[Pi, i]}, {i, 1, 20}]
>
> I get:
>
> {{1, 3.14159}, {2, 3.14159}, {3, 3.14159}, {4, 3.14159}, {5, 3.14159},
> {6,  3.14159}, {7, 3.14159}, {8, 3.14159}, {9, 3.14159}, {10, 3.14159},
> {11, 3.14159}, {12, 3.14159}, {13, 3.14159}, {14, 3.14159}, {15,
> 3.14159}, {16, 3.14159}, {17, 3.1415926535897932},
> {18, 3.14159265358979324}, {19, 3.141592653589793238},
> {20, 3.1415926535897932385}}
>
> I'd expect something like
> {{1,3},{2,3.1},{3,3.14},{4,3.141},{5,3.1416},{6,3.14159},{7,3.141593},....
>
>
>
> It seems N[] only works as expected above 16 digits of requested
> precision.
>
> Is my expectation wrong?  What should I do to get what I want?
>
> My platform is WinNT 4 SP4.
>
>
>
> 


  • Prev by Date: RE: Why Doesn't N[Pi,i] Give i Digits For Small i, Math ematica 4,on NT
  • Next by Date: Re: Rationalize[] in Mathematica3 vs. Mathematica4
  • Previous by thread: Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica 4,on NT
  • Next by thread: Re: V4.0 on NT4.0/SP3 does not update the Start/Documents List