9
$\begingroup$

How can I replace the $\log(x)$ function by simple math operators like $+,-,\div$, and $\times$?

I am writing a computer code and I must use $\log(x)$ in it. However, the technology I am using does not provide a facility to calculate the logarithm. Therefore, I need to implement my own function using only simple operators ($+,-,\div$, and $\times$).

Thank you.

  • 0
    How about Taylor series?2011-10-23
  • 1
    The best you can do is *approximating* the logarithm using its [power series expansion](http://en.wikipedia.org/wiki/Power_series_expansion).2011-10-23
  • 1
    There is no way to write $\log x$ as (finitely many) simple math operations applied to $x$. You will need to approximate the logarithm using any of several methods; http://en.wikipedia.org/wiki/Logarithm#Calculation lists some of these.2011-10-23
  • 0
    http://en.wikipedia.org/wiki/Natural_logarithm#Derivative.2C_Taylor_series2011-10-23
  • 2
    Any $x>0$ is of the form $x=10^r\cdot t$ with $r\in{\mathbb Z}$ and $1\leq t<10$. I suggest that you use a ("wired in") value for $\ln 10$ and a good rational approximation for $t\mapsto\ln t$ in the interval $1\leq t\leq 10$.2011-10-23
  • 0
    One could of course replace the $10$ in Christian's comment with $2$ or $16$, depending on what sort of arithmetic your system does...2011-10-23
  • 0
    You could probably use [this](http://www.math.com/tables/expansion/log.htm).2011-10-23

7 Answers 7