Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to solve this equation:

$$n \cdot 2^n = 15000$$

And according to WolframAlpha

$$n=\frac{W(15000\log(2))}{\log(2)}, \text{ where }\log\text{ is ln}$$

Which shows that I need to use the product log function $W$ which I tried looking up on wikipedia. I don't need the complex numbers, just real numbers.

Additionally, are there ways of solving the original equation without the $W$ functions?

Can someone explain the rules and how to do this please?

I would eventually like to implement a way to find $n$ programmaticly (if possible-in python).

share|cite|improve this question
Wolfram clearly says "$\log$" is the natural logarithm function. So you're misquoting them. – Michael Hardy Mar 12 '12 at 3:32
whoops, fixed it – Dacto Mar 12 '12 at 3:34
Surely there is some package somewhere on the 'net which implements the $W$ function. – Alex Becker Mar 12 '12 at 3:36
I'm also interested in ways of solving this without the $W$ function. The initial equation doesn't look as if a solution would be difficult...but I honestly don't know. – Dacto Mar 12 '12 at 3:40
Are you just asking how to approximate the W function numerically in general? Or just for this one particular case? If the former, then why focus on this one equation, and if the latter, then how much accuracy do you need (because W|A should be able to give a lot already). Also, the solution necessarily involves the W function - there is no other way of solving it here (except to work with the W function in disguise). – anon Mar 12 '12 at 3:47
up vote 2 down vote accepted

You can use Newton's method for finding the root of $f(n) = n 2^n - 15000 = 0$: $$ n_{i+1} = n_i - \frac{f(n_i)}{f'(n_i)} = n_i - \frac{n_i 2^{n_i} - 15000}{2^{n_i} (1+n_i \log(2))} $$ and start with a suitable guess (look up the Wikipedia page on that). Here $n_0 = 1$ should do.You keep repeating the process for $i \ge 1$ until you reach a proper accuracy, i.e., you terminate at iteration $t$ when $n_{t} - n_{t-1} < \epsilon$ for some tiny $\epsilon$ you define.

Questions on exact implementation are more suitable question for SO; also scicomp.SE in case you're interested in details on appropriate numerical methods, and robust libraries.

share|cite|improve this answer
Relevant: – user2468 Mar 12 '12 at 4:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.