Groups | Search | Server Info | Login | Register


Groups > comp.soft-sys.math.maple > #194

Re: Missing solution to (1-p)^n = 1-n*p

From Axel Vogt <&noreply@axelvogt.de>
Newsgroups comp.soft-sys.math.maple
Subject Re: Missing solution to (1-p)^n = 1-n*p
Date 2011-06-23 18:47 +0200
Message-ID <96h90eFjgpU1@mid.individual.net> (permalink)
References <slrnj06jf1.fj7.usenet2@melkki.cs.helsinki.fi>

Show all headers | View raw


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(%);

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Missing solution to (1-p)^n = 1-n*p Ilmari Karonen <usenet2@vyznev.invalid> - 2011-06-23 14:29 +0000
  Re: Missing solution to (1-p)^n = 1-n*p Axel Vogt <&noreply@axelvogt.de> - 2011-06-23 18:47 +0200
    Re: Missing solution to (1-p)^n = 1-n*p Joe Riel <joer@san.rr.com> - 2011-06-23 10:49 -0700
      Re: Missing solution to (1-p)^n = 1-n*p Ilmari Karonen <usenet2@vyznev.invalid> - 2011-06-23 20:12 +0000

csiph-web