# Find intersection of linear and logarithmic lines

I have equations for two lines, one of which is linear and the other is logarithmic, ie:

$$y = m_1 x + c_1$$

$$y = m_2 \cdot \ln(x) + c_2$$

..and I need to find out where (if at all) these lines intersect. I realise that I need to solve:

$$m_1 \cdot x + c_1 = m_2 \cdot \ln(x) + c_2$$

..for $x$, but apart from shuffling the constants around I'm not sure how to do this.

Is there a general solution to this problem?

Thanks

-

The general solution involves the Lambert W function, whose defining equation is $z = W(z)e^{W(z)}$ for complex numbers $z$. If either $m_1$ or $m_2$ is zero in the given problem, then the solution is elementary, so suppose $m_1,m_2 \neq 0$. Then $$m_1 x + c_1 = m_2 \ln x + c_2$$ can be rewritten as $$-\frac{m_1}{m_2}e^{(c_1-c_2)/m_2} = -\frac{m_1 x}{m_2} e^{-m_1 x / m_2},$$ which has the solution $$-\frac{m_1 x}{m_2} = W\left(-\frac{m_1}{m_2}e^{(c_1-c_2)/m_2}\right),$$ or $$x = -\frac{m_2}{m_1} W\left(-\frac{m_1}{m_2}e^{(c_1-c_2)/m_2}\right).$$ For instance, if $m_1=1$, $m_2=-1$, and $c_1=c_2=0$, this gives $x=W(1)=\Omega=0.56714329...$ (the Omega constant), which is correct, since $\Omega = -\ln\Omega$.