MathGroup Archive 2007

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

Search the Archive

Re: Mathematica precision for a^b

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73505] Re: Mathematica precision for a^b
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 21 Feb 2007 01:33:09 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <1171965456.017093.124290@m58g2000cwm.googlegroups.com>

sonyaBabken at yahoo.de wrote:
> Hallo
> I am new to mathematica. I have mathematica 5.1.
> If I have the expresion a^b where a is  an arbitrary double precision
> decimal number and b is an exact number say a list from 1-10. How can
> I see that the precision of this expression changes when raising a to
> these powers?
> Many thanks in advance
> Sonya
> 

Hi Sonya,

The precision of the results does not change: since you have a mix of 
hardware precision numbers and exact numbers the overall precision is 
lowered to machine precision and the computations are done using the 
functions implemented in the hardware. Detailed explanations are given in  	
"The Mathematica Book Online / Advanced Mathematics in Mathematica / 
Numbers / 3.1.4 Numerical Precision", available at

http://documents.wolfram.com/mathematica/book/section-3.1.4

To see the precision of a Mathematica expression, you can use the 
built-in function Precision [1]. For instance,

In[1]:=
a = 2.;

In[2]:=
Precision[a]

Out[2]=
MachinePrecision

In[3]:=
b = Range[10]

Out[3]=
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

In[4]:=
Precision /@ b

Out[4]=
{Infinity, Infinity, Infinity, Infinity, Infinity,

   Infinity, Infinity, Infinity, Infinity, Infinity}

In[5]:=
a^b

Out[5]=
{2., 4., 8., 16., 32., 64., 128., 256., 512., 1024.}

In[6]:=
Precision /@ %

Out[6]=
{MachinePrecision, MachinePrecision, MachinePrecision,

   MachinePrecision, MachinePrecision,

   MachinePrecision, MachinePrecision,

   MachinePrecision, MachinePrecision, MachinePrecision}

In[7]:=
$MachinePrecision

Out[7]=
15.9546

In[8]:=
$Version

Out[8]=
5.2 for Microsoft Windows (June 20, 2005)

Regards,
Jean-Marc

[1] http://documents.wolfram.com/mathematica/functions/Precision


  • Prev by Date: Re: Precision of a number raised to a power
  • Next by Date: Re: FullGraphics question
  • Previous by thread: Re: Approximate/asymptotic factorization
  • Next by thread: ToMatlab limitations