Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1943

Re: N[] MachinePrecision vs. Arbitrary Precision

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.glorb.com!news.mv.net!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail
From Sseziwa Mukasa <mukasa@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: N[] MachinePrecision vs. Arbitrary Precision
Date Thu, 28 Apr 2011 10:33:23 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <ipbfpj$aat$1@smc.vnet.net> (permalink)
Lines 44
NNTP-Posting-Date 28 Apr 2011 09:34:08 GMT
NNTP-Posting-Host b65042e2.news.twtelecom.net
X-Trace DXC=LbfBN^Bd>k:W[jR]`SmaB6C_A=>8kQj6=;[h;PUXBgb4AbB79SZHZ=<EFiONJ7[Go66l;=\e@9;:;
X-Complaints-To abuse@twtelecom.net
Xref x330-a1.tempe.blueboxinc.net comp.soft-sys.math.mathematica:1943

Show key headers only | View raw


On Apr 27, 2011, at 5:39 AM, Rafael Dunn wrote:

> Mathematica 8.0.1.0, Mac OSX x86
>
> In:=
> N[Sin[Exp[100]]]
> N[Sin[Exp[100]], 1]
> N[Sin[Exp[100]], 11]
>
> Out:=
> -0.999105
> 0.1
> 0.14219812366
>
> I realize that N[exp] = N[exp, MachinePrecision].  This indicates when
> N[] is asked to calculate to MachinePrecision, it produces an incorrect
> result in this example.  However, when I use N[exp,n] where n <
> MachinePrecision, I get a correct output.  Is this because N[exp,n] uses
> ExtraPrecision, while N[exp] does not? 

Not really, the behavior of N[e] and N[e,p] is different even if p == MachinePrecision, the relevant text in the help guide is:

>  N[e] typically works by replacing numbers with machine numbers and computing the result:


and

>  N[e,p] works adaptively using arbitrary-precision numbers when  p is not MachinePrecision:

So N[Sin[Exp[100]]] is equivalent to N[Sin[Exp[100.]]] but N[Sin[Exp[100]], p] evaluates Exp[100] arbitrary precision.  Consider:

In[41]:= N[Exp[100.]]
N[Exp[100]]
N[Exp[100], MachinePrecision]
N[Exp[100], $MachinePrecision]
Out[41]= 2.68812*10^43
Out[42]= 2.68812*10^43
Out[43]= 2.68812*10^43
Out[44]= 2.688117141816135*10^43
In[37]:= $MachinePrecision == MachinePrecision
Out[37]= True

Regards,
	Sseziwa

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: N[] MachinePrecision vs. Arbitrary Precision Sseziwa Mukasa <mukasa@gmail.com> - 2011-04-28 10:33 +0000

csiph-web