MathGroup Archive 1999

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

Search the Archive

RE: Working With Large Numbers

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19673] RE: [mg19667] Working With Large Numbers
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Thu, 9 Sep 1999 02:19:46 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Hans Havermann  wrote:
-------------------------

Is there now, or will there ever (likely) be, a way of approximating very
large numbers like Nest[Factorial, 3, 4]?

-------------------------

Actually you can work with numbers that are quite large. For example the
next two lines evaluate in a flash.

In[1]:=
40000000.0!

Out[1]
3.776664  10^286710624


In[2]:=
Exp[10^25]-x^x

Out[2]=
E^10000000000000000000000000 - x^x


You can also evaluate the problem you asked about (see the next line).  I
think it's returned with the head Factorial because computing the last Nest
would have caused an overflow.  Notice we get an overflow when we try to
compute N[n1] or N[Exp[10^25]] below.  The point where you get an overflow
is given by $MaxNumber.

In[3]:=
n1=Nest[Factorial,3,4]

Out[3]=
(* A very large integer followed by "!". *)


In[4]:=
N[n1]

General::ovfl:Overflow occurred in computation.
Out[4]=
Overflow[]


In[5]:=
N[Exp[10^25]]

General::ovfl:Overflow occurred in computation.
Out[5]=
Overflow[]



In[6]:=
?$MaxNumber

$MaxNumber gives the magnitude of the maximum arbitrary-precision number
that can be represented on a particular computer system.


In[7]:=
$MaxNumber

Out[7]=
1.440397193981785  10^323228010


Notice I computed the Factorial of an approximate number above and got an
answer in a flash.  You could compute (40000000!) and the kernel will return
a giant integer if you wait a very long time and your computer doesn't run
out of memory.

Going back to your question we can work with very large numbers to the
extent that I do above.  I think it might be possible for Wolfram Research
to change future versions of Mathematica so the magnitude of numbers is only
limited by the resources your computer has available.  However, this will
never happen if they don't see sufficient need for such a capability, and I
suspect the need isn't there.

--------------------
Regards,
Ted Ersek

For Mathematica tips, tricks see 
http://www.dot.net.au/~elisha/ersek/Tricks.html


  • Prev by Date: Re: Re: Re: Langford's Problem (another solution improved)
  • Next by Date: Mathematica can't win against Tiger Woods
  • Previous by thread: Working With Large Numbers
  • Next by thread: Knowing a unknowed time serie