How to solve this simple Algebraic equation? (Wolfram & SymboLab both stumped...)

308 Views Asked by At

I need to solve the following equation for a hobby coding project I'm working on and I can't figure out the solution. Wolfram and SymboLab solvers are both stumped.

$$0 = d - (r^{p-1} * (p-1) * c)$$

I'm trying to solve for $p$, where $d$, $r$, $c$, and $p$ are all positive real numbers.

Seems like it should be quite doable. Any help? Thanks.

1

There are 1 best solutions below

2
On

I may have a solution. The bad news: you're not going to like it because it's nasty. It ain't pretty.

So first, we get all of the $p$-based terms on one side of the equation, probably the most trivial step. This is kosher since all of the constants are nonzero. This gives us

$$(p-1)r^{(p-1)} = \frac{d}{c}$$

This is where it goes downhill. For simplicity, I let $x = p-1$ to make this a bit prettier, and we reduce this problem to finding $x$:

$$xr^{x} = \frac{d}{c}$$

If you've ever heard of the Lambert $W$-function, this expression absolutely screams its use. If not, the $W$ function is essentially introduced in scenarios where we have $xe^x = c$ for some number $c$ and want to find $x$. Then the $W$ function is applied to both sides to give $x = W(c)$. The $W$ function is basically the "inverse" to $xe^x$, i.e. $W(xe^x) = x$. I'll be honest and admit I don't know a whole lot about it, so I'll link to the Wikipedia article

The article does give us a way to solve $xr^x$ when $r$ is not necessarily $e$: the identity that

$$z = xa^x \;\;\; \Leftrightarrow \;\;\; x = \frac{W(z \ln(a))}{\ln(a)}$$

Take $z = d/c, a = r.$ Then,

$$\frac{d}{c} = xr^x \;\;\; \Leftrightarrow \;\;\; x = \frac{1}{\ln(r)}W\left(\frac{d}{c} \cdot \ln(r) \right)$$

Then, since $x = p-1,$

$$p = 1 + \frac{1}{\ln(r)}W\left(\frac{d}{c} \cdot \ln(r) \right)$$

Per the Wikipedia article, "the Lambert W relation cannot be expressed in terms of elementary functions," so unless there's a method I overlooked in solving this, this might be the best you get.

I'm not sure how it would be evaluated. The Wikipedia article notes some special values and approximation via Newton's method.