Chapter 24 Logarithms in R

By Nathan Brouwer

Logging splits up multiplication into addition. So, log(m*n) is the same as log(m) + log(n)

You can check this

m<-10
n<-11
log(m*n)
## [1] 4.70048
log(m)+log(n)
## [1] 4.70048
log(m*n) == log(m)+log(n)
## [1] TRUE

Exponentiation undos logs

exp(log(m*n))
## [1] 110
m*n
## [1] 110

The key equation in BLAST’s E values is

u = ln(Kmn)/lambda

This can be changed to

[ln(K) + ln(mn)]/lambda

We can check this

K <- 1
m <- 10
n <- 11
lambda <- 110

log(K*m*n)/lambda
## [1] 0.04273164
(log(K) + log(m*n))/lambda
## [1] 0.04273164
log(K*m*n)/lambda == (log(K) + log(m*n))/lambda
## [1] TRUE