MathGroup Archive 1994

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

Search the Archive

Re: 1/T errors

Paul.Shand at (Paul M. Shand) wrote:
>I have a function f of the type (Exp[b/T]/Exp[c/T]), where b and c are
>complicated functions consisting of sums over several parameters, but is
>not of primary interest here. The problem is the following. I wish to
>obtain values of the function f at small values of T. For example, for T =
>0.05 and T = 0.03, Mathematica gives me a reasonable answer in a reasonable
>amount of time (the times required for the calculation are approximately
>the same).
>For T = 0.02, however, Mathematica gives a ridiculous number for the
>answer (10^9000). Also, the time taken to get that answer is about twice as
>large as before. The answer should be of the order of 5. I am probably
>running into problems with big number arithmetic, but I am not sure how to
>get around this. It would be nice if I could at least get a reasonable
>value for T=0.01. What can I do? I have Mathematica 2.2 Enhanced for Mac.

I've just upgraded from 2.2 Enh to 2.2.2 Enh under Windows, and I can't seem 
to reproduce the problem.  It might help if you posted the formulas for b and 
c (unless their input forms are too gory).  Off the cuff, it sounds like 
either Mma is choking on one of the arguments b/T or c/T when T=.02, or else 
your program computes either b or c incorrectly when T=.02.  (You didn't 
indicate whether b or c depends at all on T.)  The most I can get Mma to do 
is bomb "gracefully" with an overflow message if the argument for Exp gets 
too large.  Assuming that b and c are being computed correctly, there are two 
things you could try:  (1) use N[b, ...] and N[c, ...] in place of b and c to 
force more accuracy; and (2) replace Exp[b/T]/Exp[c/T] with Exp[(b-c)/T].  As 
a general rule of course, I would always use the latter anyway.  If b and c 
are large and close to each other, b-c would be small but b/T and c/T would 
be large, so I think you're inviting some needless rounding error.

* Paul A. Rubin                                  Phone: (517) 336-3509   *
* Department of Management                       Fax:   (517) 336-1111   *
* Eli Broad Graduate School of Management        Net:   RUBIN at MSU.EDU    *
* Michigan State University                                              *
* East Lansing, MI  48824-1122  (USA)                                    *

  • Prev by Date: Re: "virtuell lines"
  • Next by Date: bug-checking experiment
  • Previous by thread: Re: "virtuell lines"
  • Next by thread: bug-checking experiment