Taking the easy question first:

On Sun, Jan 30, 2011 at 12:12 PM, Sean Owen <[email protected]> wrote:

>
> PS why would it be desirable to map log(0) to 0? the limit is negative
> infinity.


The limit of interest is x log x as x approaches 0.  But this limit isn't
quite direct because x approaches 0 and log x becomes infinite.  We can
express this as the ratio of log x and (1/x) and then apply l'Hopital's
rule:

    \lim_{x \rightarrow  0} x \log x = \lim_{x\rightarrow 0} {\log x \over
{1/x}} = \lim_{x\rightarrow 0} {{1/x}\over -1/x^2}=\lim_{x\rightarrow 0}x=0

(http://www.codecogs.com/latex/eqneditor.php is a handy place to preview
what this really says)

So setting safeLog(0) = 0 is just heavy handed way to make this limit come
out right.

Reply via email to