Solving equations with natural logarithms

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
Does anyone know how you go about solving the following equation for x:

ln(x)+k1*x=k2

where k1 and k2 are constants?
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
ok:

ln(x)+k1*x=k2

Rewrite:
k2-k1*x=ln(x)

Raising both sides to e:
e^(k2-k1*x)=x

We got rid of the natural log, but it seems to me we just transferred the problem to the other side?
 

Ian0

Joined Aug 7, 2020
9,817
Get all the logarithms on one side of the equation:
\(
\ln (x)= k_2-k_1 x
\)
and take the exponent
\(
x = e^{k_2-k_1 x}
\)
[Edit] corrected the following. . .
\(
x=\frac{e^{k_2}}{e^{k_1 x}}
\)
\(e^{k_2}\) is a constant, so call it K
\(
x=\frac{K}{ e^{k_1 x}}
\)
\(
\frac{K}{x}=e^{k_1 x}
\)
and I don't think it has an algebraic solution.
 
Last edited:

Papabravo

Joined Feb 24, 2006
21,225
Get all the logarithms on one side of the equation:
\(
\ln (x)= k_2-k_1 x
\)
and take the exponent
\(
x = e^{k_2-k_1 x}
\)
\(
x=\frac{e^{k_2}}{e^{k_1 x}}
\)
\(e^{k_2}\) is a constant, so call it K
\(
x=\frac{K}{ e^{k_1 x}}
\)
and I don't think it has an algebraic solution.
x = K2/K1 =1 is an algebraic solution
 

Thread Starter

dcbingaman

Joined Jun 30, 2021
1,065
Thanks for everyone's input! So it appears the consensus is you cannot algebraically solve this for x:

e^(k2-k1*x)=x

x=e^k2/e^k1x

xe^k1x=e^k2

natural log of both sides, back where we started:

ln(x)+k1*x=k2

So I am going in circles, cannot isolate x.
 

MrSalts

Joined Apr 2, 2020
2,767
Does anyone know how you go about solving the following equation for x:

ln(x)+k1*x=k2

where k1 and k2 are constants?
What are the values of k1 and k2? If they are unknown constants, then they are variables. With three variables, you can get to any value.
 

ZCochran98

Joined Jul 24, 2018
304
For a more general solution, this appears to be an instance where the Lambert W function is useful. The Lambert W function is a non-algebraic (or, rather, non-elementary) function defined as the solution to:
\[ xe^x = \beta \rightarrow x = W_\alpha(\beta) \]
Here, \(\alpha\) is some integer. For real numbers, we can set them to 0 or -1 (I'll explain what they mean eventually).
So, for this problem, we can solve it this way:
\[\ln x+k_1x = k_2\]
\[xe^{k_1x} = e^{k_2}\]
Let \(y\equiv k_1x\)
\[ye^y=k_1e^{k_2}\]
Using Lambert W, because this fits the form exactly, we get:
\[y = W_\alpha\left(k_1e^{k_2}\right)\rightarrow x = \frac{1}{k_1}W_\alpha\left(k_1e^{k_2}\right)\]

For all of these, \(\alpha\) refers to a "branch" index of the function in the complex plane (as it splits off and has several discontinuities, and each separate section is a "branch."). For real numbers only, however, we have the -1 branch (corresponding to \(-e^{-1}\leq x < 0\)) and the 0 branch (the "principal branch," corresponding to \(x\geq 0\)). So the solution will vary, given whatever \(k_{1,2}\) are.

There are a few ways to analyze the function, but generally, the series methods have a small radius of convergence, so it's usually just calculated numerically using something akin to a root-finding algorithm (like Newton or faster). For instance, Newton's method:
\[x = W_0(\beta) \rightarrow x_{j+1} = x_j - \frac{x_je^{x_j}-\beta}{e^{x_j}+x_je^{x_j}}\]

That's probably more information than necessary, but it's a way to solve it numerically, at least (assuming \(k_1e^{k_2}\geq 0\)).

Tl;dr: the general solution hurts, but there is a way to represent it non-algebraically.
 
Top