[Date Index] [Thread Index] [Author Index]
Re: locating overlow/underflow
On 9/6/10 at 6:36 AM, nbbienia at cyf-kr.edu.pl (Leslaw Bieniasz) wrote: >Thanks for your comments. I have reduced the range of y, and I am >now obtaining results without any error messages. However, this >exercise raises my doubts whether the desired "arbitrary precision" >is indeed reached, especially when y approaches 100. The program >output yields infinity for the number of valid significant digits, >but how many digits can I really trust if I declare 70 digits? >Shouldn't the output contain warnings if the number of valid digits >is smaller than 70? I don't perhaps need as many as 70, something >like 30 would be enough, but I need to be sure that I really have >that accuracy. I don't know how all that works, but I can imagine >MATHEMATICA should automatically allocate appropriately more bytes >to the floating point representations used, if the current number of >bytes is insufficient. There are algorithms that can do that, I >believe, like interval arithmetics? How can I check whether the >accuracy is indeed as I want it to be? You are conflating two separate issues. Your comments above center on arbitrary precision. But the issue you are having is related to underflow/overflow. There are limits to how large/small of a number can be represented in Mathematica's arbitrary precision format. Specifically, these are given by $MinNumber and $MaxNumber. On my system, I get In:= Log[10, $MaxNumber] Out= 3.232284580911158146609071*10^8 In:= Log[10, $MinNumber] Out= -3.232284580911158146609071*10^8 In:= Log[10, Erfc[10^4]] // N Out= -4.34295*10^7 That is long before you get to a value of 5 10^19 for y, Erfc[Sqrt[y]] is outside the range of values that can be represented in Mathematica's arbitrary precision format. It might be possible to obtain the number of accurate digits you want. But this cannot be done using a simplistic approach with Mathematica's built-in functions such as N due to the limitations of what can be represented. Note, I am not saying Mathematica cannot be used to obtain what you want. Since Mathematica can be seen as a general purpose programming language, any mathematical problem that can be solved on your system can be solved with the tools available in Mathematica. But to obtain accurate digits for values that lie outside the range of $MinNumber to $MaxNumber means you will need to write your own code in Mathematica to deal with such large/small numbers. Moreover, since you are using functions like Erfc, you will need to write code to replace these as well. This is clearly not a simple thing to do. It will not be easy to do even if you use something other than Mathematica.