Logarithm tricks

From Helpful
Revision as of 23:14, 21 April 2024 by Helpful (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

properties of logs

Change of log base

If you want to work with an arbitrary base, but you have a log function of which you cannot change the base (e.g. on a calculator), then a useful property is:

logw v = ( logh v ) / ( logh w )


w is the base you want
h is the base you have (which you don't even have to know the value of, just has to be consistent just has to be consistent between the two uses)
v is the value you want the logw of

Say you want the log-base-2 of 256

...but are working with base 10
log2(256) = ( log10(256) ) / ( log10(2) ) ≈ 2.40824 / 0.30103 ≈ 8
...or are working with base e
log2(256) = ( loge(256) ) / ( loge(2) ) ≈ 5.54518  / 0.69315 ≈ 8

addition is multiplication

logb(x*y) = logb x + logb y

subtraction is division

logb(x/y) = logb x - logb y



Decibels are logarithms applied to ratios of power.

Which turns out to be rather useful idea.

Log probabilities