# Arithmetic in Lambert-W number system

$$\DeclareMathOperator{\sign}{sign}$$ The principal branch of Lambert-W function is defined like so: $$W(x) = f^{-1}(x)\\ \text{where} f(x)=xe^x$$ So $$W(e) = 1$$, $$W(2e^2)$$ is 2, $$W(3e^3)$$ is 3 etc.

We define Lambert-W number system to represent a real number $$X$$: $$X \rightarrow \{s=\sign(x),x=W(|x|)\}$$ For instance, $$-2e^{2}$$ is represented $$\{-1,2\}$$, and $$1$$ is represented as $$\{1,W(1)\}$$.
Additionally, we define double Lambert-W number system as this: $$X \rightarrow \{s=\sign(x),x=W(W(|x|))\}$$ For instance, $$(2e^{2})\cdot{e^{(2e^{2})}}$$ is represented as $$\{1,2\}$$.

My question: How to add, subtract, multiply and divide numbers represented in these two systems?

$$\DeclareMathOperator{\sign}{sign}$$ Let us consider $$x \mapsto (\sign(x),W(|x|))$$ and $$y \mapsto (\sign(y),W(|y|))$$. This means that $$|x| = f(f^{-1}(|x|)) = f(W(|x|)) ,$$ so $$x = \sign(x) |x| = \sign(x) f(W(|x|)) = \sign(x) W(|x|) e^{W(|x|)} .$$

At the same way, $$y = \sign(y) W(|y|) e^{W(|y|)} .$$

So, knowing the representation of $$x$$ and $$y$$ in the Lambert-W number system, we can reconstruct the value of $$x$$ and $$y$$.

Now assume that $$\sign(x)=\sign(y)$$.

$$x+y = \sign(x) \left( W(|x|) e^{W(|x|)} + W(|y|) e^{W(|y|)} \right) ,$$ which means that $$|x+y| = W(|x|) e^{W(|x|)} + W(|y|) e^{W(|y|)} .$$

The representation of $$x+y$$ in the Lambert-W number system will be then $$x+y \mapsto \left(\sign(x+y), W(|x+y|)\right) = \left(\sign(x+y), W\left( W(|x|) e^{W(|x|)} + W(|y|) e^{W(|y|)} \right) \right) .$$

We just proved that, if $$(s_1,x_1)$$ and $$(s_2,x_2)$$ are two numbers in the Lambert-W number system, if $$s_1 = s_2$$, we can write $$(s_1,x_1)+(s_2,x_2) = \left(s_1,W\left(x_1 e^{x_1} + x_2 e^{x_2} \right) \right) .$$

When $$s_1 \neq s_2$$, that is when $$\sign(x) \neq \sign(y)$$, you can do a similar calculation using the fact that the function $$f$$ is monotone, so if $$x > y$$, then $$x e^x > y e^y$$.

You can derive the other operations with similar arguments.

• Nice answer, but there are two small problems: 1. I think you meant $(s_1,x_1)+(s_2,x_2) = \left(s_1,W\left(x_1 e^{x_1} + x_2 e^{x_2} \right) \right) .$ 2. If you numerically compute this, there may be an overflow for sufficiently large $x_1$ or $x_2$. Does anyone know how to mitigate this issue? Mar 17, 2021 at 6:50