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: [mg78403] Re: any way to force symbolic computation?
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Sat, 30 Jun 2007 06:10:50 -0400 (EDT)
  • 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
> 

I am not 100% sure this is the question you are asking, but if you want 
to print out numbers in the FactorInteger format, you could try this 
function:

Print[Times @@
   Map[HoldForm[
       Evaluate[#[[1]]]]^(Sign[#[[2]]]
        HoldForm[Evaluate[Abs[#[[2]]]]]) &, x]]

Note that the resultant cell contains invisible HoldForm wrappers (which 
stop the whole thing evaluating and overflowing again) which mean you 
can't easily paste the expression into something else.

David Bailey
http://www.dbaileyconsultancy.co.uk


  • Prev by Date: Graphics package in v6
  • Next by Date: Re: managing version 6 in a locked-down environment
  • Previous by thread: any way to force symbolic computation?
  • Next by thread: Re: any way to force symbolic computation?