Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Axel Vogt <&noreply@axelvogt.de> Newsgroups: comp.soft-sys.math.maple Subject: Re: Missing solution to (1-p)^n = 1-n*p Date: Thu, 23 Jun 2011 18:47:05 +0200 Lines: 79 Message-ID: <96h90eFjgpU1@mid.individual.net> References: Reply-To: &noreply@axelvogt.de Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ok8KRODP9C7ugh/bSgy7cQn0gJJ7U2GQRO49a5EUR4rXNh5/o= Cancel-Lock: sha1:X4b0K33gE27kwwReKosrwMeyRkU= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.soft-sys.math.maple:194 On 23.06.2011 16:29, Ilmari Karonen wrote: > While I was playing around with probabilities, I noticed that I wasn't > able to get Maple 12 to figure out that > > (1-p)^n = 1-n*p > > has a solution at n = 1. Of course, it's trivial to verify by > substitution that this is indeed a solution for any p, but I wasn't > able to get solve() to cough it up: > >> assume(p> 0, p< 1, n> 0): >> interface(showassumed = 0): >> solve((1-p)^n = 1-n*p, n); > 0 > > OK, n = 0 certainly is a solution, but I'd have liked the other one > too. Let me see if solving for all variables would do any better... > >> solve((1-p)^n = 1-n*p); > {n = n, p = -exp(RootOf(_Z n - ln(1 + n exp(_Z) - n))) + 1}, > {n = 1, p = 1} > > Well, that wasn't very useful. I'm not sure offhand if that RootOf() > can actually take values other than 0, but either way I really wanted > a solution for n, not p. Any why does Maple figure out the specific > solution n = 1, p = 1, but not the more general n = 1, p = p? > > Rewriting the left hand side as exp(n*log(1-p)) helps a little... > >> solve(exp(n*log(1-p)) = 1-n*p, n); > memory used=3.8MB, alloc=3.2MB, time=0.22 > memory used=7.6MB, alloc=5.1MB, time=0.38 > ln(1 - p) > ln(1 - p) exp(---------) > p > -LambertW(------------------------) p + ln(1 - p) > p > exp(-------------------------------------------------) - 1 > p > - ----------------------------------------------------------, 0 > p > > ...but unfortunately Maple does no better than me in simplifying that > awful nested expression, even though numerical testing does indeed > suggest that it is identically 1 at least for 0< p< 1. > > Solving in the real domain does no better: > >> RealDomain[solve]((1-p)^n = 1-n*p, n); > memory used=11.4MB, alloc=5.9MB, time=0.60 > (1/p) > ln(1 - p) (1 - p) > -LambertW(-_B3, ----------------------) p + ln(1 - p) > p > exp(-----------------------------------------------------) - 1 > p > - -------------------------------------------------------------- > p > > So, now I'm curious. Is this just a bug in Maple 12, or am I doing > something silly? Or both? And does it work any better in later > versions? > Generally if RootOf occurs, the 'allvalues' may be the way to go. With your assumptions and using Maple 15: (1-p)^n = 1-n*p; solve(%,n, allsolutions=true); expand(%); simplify(%); collect(%, LambertW); -1/ln(1-p)*LambertW(_Z30,ln(1-p)/p*(1-p)^(1/p))+1/p Where a warning is given: "Warning, solve may be ignoring assumptions on the input variables." In older versions use RootOf(eq, n); allvalues(%);