Osmophile

Osmophile is a virtual lab notebook that documents ongoing projects and experiments.

Solving Exponential Equations Using the Lambert W Function

2024-11-24, C. V. Pines

Suppose we want to solve equations of the form x = a + b \exp\left(cx\right) where all values are real and bc < 0. We can use the Lambert W function, defined as W_k(z) \exp(W_k(z)) = z, to obtain an exact solution for x as follows:

\begin{split} a + b \exp\left(cx\right) &= x \\ \exp(cx) &= b^{-1}\left(x - a\right) \\ \exp(-cx)(x-a) &= b \\ \exp(-cx)(-cx + ac) &= -bc \\ \exp(-cx + ac)(-cx + ac) &= -bc \exp(ac) \\ -cx + ac &= W_0\left(-bc \exp(ac)\right) \\ x &= a - c^{-1} W_0\left(-bc \exp(ac)\right) \end{split}

In particular, the restriction that bc < 0 ensures that exactly one solution exists and the principal branch W_0 is sufficient.

Often, it is more convenient to represent solutions in terms of the Wright omega function, defined as \omega(x) = W_0(\exp(x)). This is easily done:

\begin{split} x &= a - c^{-1} W_0\left(-bc \exp(ac)\right) \\ &= a - c^{-1} W_0\left(\exp(ac + \ln(-bc))\right) \\ &= a - c^{-1} \omega\left(ac + \ln(-bc)\right) \end{split}


When formulating transfer functions for circuits with semiconducting elements, it is often more convenient to express equations in the alternate form \alpha x + \beta = \exp(\gamma x + \delta) where \alpha \gamma < 0.

By simple substitution of a = -\beta \alpha^{-1}, b = \alpha^{-1} \exp(\delta), c = \gamma we find:

\begin{split} x &= -\tfrac{\beta }{\alpha } -\gamma^{-1} W_0\left(-\tfrac{\gamma}{\alpha } \exp\left(\delta - \beta \tfrac{\gamma}{\alpha }\right)\right) \\ &= -\tfrac{\beta }{\alpha } -\gamma^{-1} \omega\left(\delta - \beta \tfrac{\gamma}{\alpha } + \ln\left(-\tfrac{\gamma}{\alpha }\right)\right) \end{split}

Generally, for audio circuits expressible in this form, \alpha and \gamma represent constants or control-rate values, while \beta and \delta represent audio-rate signals. This alternate formulation makes it easier to perform multi-rate processing optimizations.