# Defining logarithms explicitly

How are logarithms defined explicitly?

One way I can come up with is the following, first start by using McLaurin series representation of exponent function:

$$e^x = \sum_{k=o}^{\infty}\frac{x^k}{k!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!}...$$

Now, simply invert the function (solving for x), cutting it off at a certain point:

$$y=1 + x + \frac{x^2}{2!} + \frac{x^3}{3!}$$ $$ln(y)=x(y)$$

But as can be seen, the function is really difficult to solve as each added term increases the order of the polynomial. My question is, is there a simpler explicit definition for logarithms, and how to define logarithms explicitly accurately at all?

(Edit: previously there was an unnecessary bit regarding how calculators accomplish the calculation).

It's hard to say there's "a" correct definition. But what many texts do is not define $\ln$ as the inverse of $\exp$, but define each individually then show their relation. In particular, $\ln x = \int_{1}^{x} \frac{1}{t} \mathrm{d}t$ makes sense as it's the unique function with derivative $1/x$ and with value $0$ at $1$. From this, you can show $\ln (a b) = \ln(a) + \ln(b)$ and all the rest.

Calculators don't actually need to define logarithms -- it is enough that they can somehow calculate a number that is within a desired tolerance from the true value of the logarithm, and if a method achieves that, then it doesn't matter whether it's based on a principled definition of the logarithm function or not.

Calculators that are based on binary floating point typically calculate $\log_2 x$ natively and then scale that to get logarithms to other bases.

First, multiply or divide by an appropriate integer power of $2$ such that the number is between $1$ and $2$. (This is an extremely cheap operation to do with binary floating-point representation). The integer power becomes the integral part of $\log_2 x$, and then one only needs to be able to approximate $\log_2 x$ on the interval $[1,2)$ to find the fractional part.

Methods to do this approximation vary. Sometimes this is done with a polynomial approximation -- which might be a Taylor approximation of $\log_2(x+1)$, or a hand-chosen polynomial that minimizes the error over the entire interval $[1,2)$ with fewer terms than a Taylor polynomial would need.

Some implementations uses several approximating polynomials, chosen for subintervals of $[1,2)$ by table lookup.

There are also CORDIC-like methods, where you try express $x$ as a product of factors of the form $1\pm2^{-n}$ (multiplying by such a factor is cheap!), and then add together the logarithms of the factors you used -- which are themselves looked up in a table baked into the calculator during manufacture.