Given a number n
, how would I convert this number into a logarithmic scale?
My logarithmic scale would range from 0 to 255 (I'm working with RGB colours), and I would expect values of n
from 1 to 1,000,000.
Apologies if this is an easy question.
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communitylet $f(n)$ be the log function of n.
So a general log function can be written as $f(n)=k\log n +c$
where $k$ and $c$ are constants
$\implies 255=k\log {10^6}+c$
and $0=k\log {1}+c$
here is to the base 10
so $c=0$ and $k=255/6$
or here you can use any base and different values of k
so that $f(n)=\frac {255 \log n}{6}$ if the base is 10.