Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Joe Riel Newsgroups: comp.soft-sys.math.maple Subject: Re: Missing solution to (1-p)^n = 1-n*p Date: Thu, 23 Jun 2011 10:49:31 -0700 Organization: A noiseless patient Spider Lines: 91 Message-ID: <87vcvwbfpw.fsf@san.rr.com> References: <96h90eFjgpU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="7daQ3AF9ALJlnU9jGWSG5Q"; logging-data="5680"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19l3Mcex6SVf7+G2G2+eEOh" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:HLQILTLeoHM1hJLN6zLP02HhT6g= sha1:Df0dWXiYAnOzM5HFYyQmtg9Wmps= Xref: x330-a1.tempe.blueboxinc.net comp.soft-sys.math.maple:195 Axel Vogt <&noreply@axelvogt.de> writes: > 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(%); The way to solve this is with solve/identity. (**) eq := (1-p)^n = 1-n*p: (**) solve(identity(eq,p),{n}); {n = 0}, {n = 1} -- Joe Riel