math - delta value while calculating logarithm -


i using formula calculate parameter, formula involves taking logarithm of value can 0 @ times. handle such case, read in literature technique put delta value follows:

ln(delta + a) 

here, paramter a real number ranging [0, 1].

what value should assign delta? shall assign delta = 1, ln(delta + a) return 0 whenever a 0?

further, there rule of choice using natural logarithm or base10 or base2 logarithm?

following formula using:

lw = exp[ 1 / n( sum[ log( delta + lw( x, y ) ) ] ) ] 

please refer link explanation: log average luminance

without knowing range of is, hard answer.

if integer, happens 0, returning log(a + 1) want, return 0 when 0. question impact have on use of answer if use log(a + 1) instead of log(a), since mathematically different.

-- edit --

for real value in range [0,1], value of log(a) negative anyway. sensible answer log(0) in circumstance -infinity. programming languages use ieee 754 standard representing floating point values, , standard includes value -infinity 1 of special values. using -infinity here preserve monotonicity, i.e. log(a) < log(b) if < b, if == 0.

the code depend on implementation of log in use; unless log(0) return -infinity, obvious thing check:

if(a == 0)    result = -infinity; // macro in math.h else    result = log(a);  

as (gnu) c example.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -