[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*To*: Sebastian Egner <sebastian.egner@xxxxxxxxxxx>*Subject*: Re: [srfi-70] Limit*From*: bear <bear@xxxxxxxxx>*Date*: Thu, 26 May 2005 01:35:57 -0700 (PDT)*Cc*: srfi-70@xxxxxxxxxxxxxxxxx*Delivered-to*: srfi-70@xxxxxxxxxxxxxxxxx*In-reply-to*: <OF16409C85.5A9ED3F9-ONC125700C.0024BD7D-C125700C.0029C3E4@xxxxxxxxxxx>*References*: <OF16409C85.5A9ED3F9-ONC125700C.0024BD7D-C125700C.0029C3E4@xxxxxxxxxxx>

On Wed, 25 May 2005, Sebastian Egner wrote: > Unfortunately, my experience is that this approach is highly > unreliable. In the end, I spent more time doing analytical sanity > checks myself than it took to write the proper numerical code > directly after understanding the limits properly. >Example: An important function from information theory is > > f(x) = -x log(x). > This function is in principle well behaved (smooth, analytic, etc.) > on (0,1], but its derivative does not exist at x = 0. Moreover, f(0) > cannot directly be computed numerically because the underflow from > log(x) is not cancelled by the multiplication with zero. Practical > numerical code: IF x < xmin THEN 0 ELSE x log(x), where xmin is > chosen minimal such that log(xmin) is an ordinary number and not > -infinity. This is difficult; In many ways, the idea of "infinity" as a number too large to represent requires a corresponding idea of "epsilon" as a number too small to represent. (This is an idea subtly different from "signed zeros": epsilon is 1/inf, a "smallest positive number". This saves you in some situations from mathematical errors, but the properties of such a simple idea of epsilon are not helpful in all cases. Where log(0) is undefined, log(epsilon) = -infinity. Better as far as it goes, but it still leaves you with a mathematically undefined situation, so you have to write the sanity check anyway. Bear

**References**:**Re: [srfi-70] Limit***From:*Sebastian Egner

- Prev by Date:
**Re: infinities reformulated [was Re: My ideas about infinity in Scheme (revised)]** - Next by Date:
**Re: infinities reformulated** - Previous by thread:
**Re: [srfi-70] Limit** - Next by thread:
**Re: [srfi-70] Limit** - Index(es):