MathGroup Archive 2007

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

Search the Archive

Re: any way to force symbolic computation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78404] Re: any way to force symbolic computation?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Sat, 30 Jun 2007 06:11:21 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <f62l1i$ca6$1@smc.vnet.net>

Nathan Thern wrote:
> Hello all-
> I have a set of programs that perform various operations on rational 
> numbers and have started running into overflow errors.
> 
> By definition, rationals have the form (P1^E1 P2^E2 ...)/(P3^E3 P4^E4) 
> for primes P1,P2... and exponents E1,E2...
> Although the final result of my computations is never very large, the 
> exponents created by some of my functions are quite large, particularly 
> in the numerator.
> 
> For example, one of my cases created the temporary result 
> 5^653552968908668614293009096/2. Eventually the function should return 
> 33, which is Floor[653552968908668614293009096/128^12], but it overflows 
> first.
> 
> I find myself forced to re-write my functions to work with rationals in 
> the form output by FactorInteger (e.g. 5^653552968908668614293009096/2 
> -> {{5,653552968908668614293009096},{2,-1}}), unless there is a way to 
> treat these rationals symbolically. Any clues?
> 
> regards,
> Nate T

Nathan,

The issue you face is that some of your numbers (rational or not) are 
well above the greatest number that Mathematica can handle (evaluate 
$MaxNumber to see the limit on your platform). For instance, compare the 
exponent of your rational number to the greatest number returned by 
$MaxNumber:

In[1]:= 5^653552968908668614293009096/2

During evaluation of In[1]:= General::ovfl: Overflow occurred in \
computation. >>

Out[1]= Overflow[]

In[2]:= {$MaxMachineNumber, $MaxNumber}

Out[2]= {1.7976931348623157*^308,
    1.9202246726923565854204690606`15.954589770191005*^646456887}

There is no way that Mathematica can manipulate such large number at all 
(symbolically or numerically). As you already seem to have done, you 
have to devise your own representation for such number and write your 
functions accordingly.

Regards,
Jean-Marc


  • Prev by Date: Re: search for an operator in an expression
  • Next by Date: A note on MathLink: cygwin Makefile for building addtwo.exe
  • Previous by thread: Re: any way to force symbolic computation?
  • Next by thread: managing version 6 in a locked-down environment