MathGroup Archive 2008

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

Search the Archive

Re: How to avoid overflow or underflow in mathematica?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88681] Re: [mg88648] How to avoid overflow or underflow in mathematica?
  • From: Carl Woll <carlw at wolfram.com>
  • Date: Mon, 12 May 2008 04:48:07 -0400 (EDT)
  • References: <200805111914.PAA08842@smc.vnet.net>

quantumfang wrote:

>It's well known that Mathematica can do evaluation to arbitrary precision. But I don't know how to avoid the following trouble in computing:
>
>Ef = 0.;
>mu=0.;
>KBT = 1.*10^-10;
>FL[omega_Real] := 1./(1. + E^((omega - mu - Ef)/KBT));
>
>the error message shows
>
>General::ovfl: Overflow occurred in computation. >>
>General::unfl: Underflow occurred in computation. >>
>  
>
You don't tell us what value of omega you used. However, keep in mind 
that there is a maximum number in Mathematica. On my computer this 
number is:

In[34]:= $MaxNumber

Out[34]= 1.920224672692357*10^646456887

The log of this number is:

In[35]:= Log[$MaxNumber]

Out[35]= 1.488521991921978478647057*10^9

So, if (omega-mu-Ef)/KBT is larger than the above number you will get 
overflow/underflow problem. With your parameters, this means that an 
order 1 value of omega will cause overflow/underflow problems.

Carl Woll
Wolfram Research


  • Prev by Date: Re: Parameter conditions
  • Next by Date: Re: Re: Request for Collective Wisdom...
  • Previous by thread: How to avoid overflow or underflow in mathematica?
  • Next by thread: Re: How to avoid overflow or underflow in mathematica?