Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92289

Re: Testing random

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.036
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'exercise': 0.03; 'calculating': 0.09; 'happen.': 0.09; 'occurrences': 0.09; 'percentage': 0.09; 'cc:addr:python-list': 0.10; 'python': 0.11; 'certainty': 0.16; 'experiment.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'inverse': 0.16; 'sequence,': 0.16; 'subject:random': 0.16; 'wrote:': 0.16; 'figures': 0.18; 'integer': 0.18; '>>>': 0.20; 'cc:2**0': 0.21; 'cc:addr:python.org': 0.21; "aren't": 0.22; 'raised': 0.22; 'am,': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; 'least': 0.27; 'sequence': 0.27; 'message-id:@mail.gmail.com': 0.28; '*the': 0.29; "they'll": 0.29; "skip:' 10": 0.30; 'certain': 0.31; 'getting': 0.33; 'point': 0.33; 'case,': 0.34; 'received:google.com': 0.34; 'next': 0.35; 'but': 0.36; 'quite': 0.37; 'subject:: ': 0.37; 'means': 0.39; 'expect': 0.39; 'does': 0.39; 'your': 0.60; 'close': 0.61; 'entire': 0.61; 'here.': 0.61; 'times': 0.61; 'more': 0.62; 'thomas': 0.63; 'different': 0.64; 'virtually': 0.66; 'repeat': 0.67; 'choose': 0.68; 'power': 0.72; '100': 0.79; 'low': 0.83; '*does': 0.84; 'chrisa': 0.84; 'events;': 0.84; 'subject:Testing': 0.84; 'to:none': 0.90; 'outcome': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=uTLO7h4YY9Y6AoIm8sGMCnX+HVjiLYCPKb3V7AOYp4o=; b=kJghi3wYZxK+HfkhIyyrpN/A2x9cXqv6mdFJBsdGqbH/krL+50Bl+XJozVZwZe3/ur pCDL2jjbEMZHyUPZT9+r/r7qjzvm7UJgDy7GVSsGHnUrkdGMyfxEx0MiFuZo0vOGTf6A oXIQV0VoyLG+NSRtsC3Mdypo+GGqfRyL4cvYfxj1ZLMpRd8fbt5U/rDnlVWICzWuh2r4 6ZcAwLdzWmXWvhWUZS5E608CRwUFI+0gWaRy2OGIInmV7TGYN1pYdbczpaQos4b58sZn iCbFg+lhqeSFzwW9LnU5vQ8ik5HKEUCcYIEL1im4EsFAF6+YxQlD3ZjckfJh8hELEZvZ TddA==
MIME-Version 1.0
X-Received by 10.43.0.67 with SMTP id nl3mr19674239icb.59.1433703126324; Sun, 07 Jun 2015 11:52:06 -0700 (PDT)
In-Reply-To <5515034.V7dcXEWAvK@PointedEars.de>
References <87oaksowwg.fsf@Equus.decebal.nl> <1451048.pW9z17ilMA@PointedEars.de> <mailman.242.1433677915.13271.python-list@python.org> <3158703.Lr4HFMbMOd@PointedEars.de> <mailman.257.1433694323.13271.python-list@python.org> <1656356.OjxBvjpJ5d@PointedEars.de> <mailman.259.1433695485.13271.python-list@python.org> <5515034.V7dcXEWAvK@PointedEars.de>
Date Mon, 8 Jun 2015 04:52:06 +1000
Subject Re: Testing random
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.271.1433703133.13271.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433703133 news.xs4all.nl 2835 [2001:888:2000:d::a6]:49382
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92289

Show key headers only | View raw


On Mon, Jun 8, 2015 at 4:23 AM, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:
> If the set to choose from is integer numbers from 1 to 9, then *each* of
> those sequences has *the same* probability (1∕9)¹¹ ≈ 3.1866355 × 10⁻¹¹.
>
> AISB, those are *independent* events; the number of occurrences of an
> outcome before *does not matter* for the probability of the next one.  And
> so the probability of getting a certain number does _not_ change depending
> on the number of times you repeat the experiment.  It is always the same;
> in this example, it is always 1∕9.  And the probability of _not_ getting a
> certain number is always the same; in this example, it is always 1 − 1∕9 =
> 8∕9.

Yes, the probability of not getting a certain number is always 8/9...
but the probability of not getting that number for an entire sequence
is 8/9 raised to the power of the length of the sequence, because they
are independent events that must *all* happen. In your case, with a
length of 11, that means there's about a 27% chance of any particular
number not happening. Looking at it the other way, that means there's
a 73% chance of seeing at least one N, for any N. So the probability
of seeing at least one of every digit is actually quite low - about
5.6% - because you're looking for nine digits out of eleven. (Note
that the numbers aren't quite exact here. The probabilities aren't
entirely independent. Calculating off the exact figures is left as an
exercise for the reader, but I don't expect they'll be more than a
percentage point different one way or the other.)

The chances of not seeing a 5 in any of 100 tosses would be virtually
nil. The chances of not seeing a 5 in any of 1000 tosses is so close
to zero that its inverse is indistinguishable from certainty with
Python floats (IEEE double precision):

>>> 1.0-(9/10)**1000 == 1.0
True

That's a pretty low number.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Testing random Cecil Westerhof <Cecil@decebal.nl> - 2015-06-07 08:27 +0200
  Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 12:40 +0200
    Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-07 21:51 +1000
      Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 17:51 +0200
        Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 02:25 +1000
          Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 18:36 +0200
            Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 02:44 +1000
              Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 20:23 +0200
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:52 +1000
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 21:41 +0200
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-07 22:08 +0300
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 21:29 +0200
                Re: Testing random random832@fastmail.us - 2015-06-07 15:44 -0400
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:09 +0200
                Re: Testing random random832@fastmail.us - 2015-06-07 16:41 -0400
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:59 +0200
                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:26 +1000
                Re: Testing random random832@fastmail.us - 2015-06-07 21:34 -0400
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 11:42 +1000
                Re: Testing random MRAB <python@mrabarnett.plus.com> - 2015-06-08 02:49 +0100
                Re: Testing random random832@fastmail.us - 2015-06-07 21:57 -0400
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-08 10:40 +0300
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-10 19:03 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-10 10:52 -0700
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-10 23:00 +0300
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 12:02 -0600
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-12 23:32 +0200
                Re: Testing random alister <alister.nospam.ware@ntlworld.com> - 2015-06-12 21:46 +0000
                Re: Testing random random832@fastmail.us - 2015-06-12 17:52 -0400
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-12 16:00 -0600
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-13 00:09 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-12 15:55 -0700
                Re: Testing random random832@fastmail.us - 2015-06-12 18:57 -0400
                Re: Testing random Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-13 08:53 +0100
                Re: Testing random random832@fastmail.us - 2015-06-10 14:26 -0400
                Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-07 14:21 -0700
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-16 21:18 +0200
                Re: Testing random random832@fastmail.us - 2015-06-16 16:23 -0400
                Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-16 13:48 -0700
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-16 23:57 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-16 15:30 -0700
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-16 16:58 -0600
                Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 11:28 +0200
                Re: Testing random Ned Batchelder <ned@nedbatchelder.com> - 2015-06-16 16:26 -0700
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-17 01:45 +0200
                Re: Testing random sohcahtoa82@gmail.com - 2015-06-16 17:36 -0700
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-17 11:01 +1000
                Re: Testing random Ethan Furman <ethan@stoneleaf.us> - 2015-06-16 18:32 -0700
                Re: Testing random Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-17 09:41 +0100
                Re: Testing random Grant Edwards <invalid@invalid.invalid> - 2015-06-17 14:04 +0000
                Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-17 09:01 -0600
                Re: Testing random MRAB <python@mrabarnett.plus.com> - 2015-06-17 01:42 +0100
                Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-17 08:53 +0200
                Re: Testing random Christian Gollwitzer <auriocus@gmx.de> - 2015-06-17 09:22 +0200
                Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-17 17:28 +1000
                Re: Testing random Tim Golden <mail@timgolden.me.uk> - 2015-06-17 08:30 +0100
                Re: Testing random Cecil Westerhof <Cecil@decebal.nl> - 2015-06-17 11:57 +0200
                Re: Testing random Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-17 01:36 +0000
                Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 12:33 +0200
                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-17 22:47 +1000
                Re: Testing random Laura Creighton <lac@openend.se> - 2015-06-17 15:50 +0200
                Re: Testing random Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-17 01:35 +0000
                Re: Testing random Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-17 07:41 +0300
                Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:11 +1000
            Re: Testing random Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-07 11:07 -0600
            Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 03:20 +1000
            Re: Testing random "C.D. Reimer" <chris@cdreimer.com> - 2015-06-07 10:36 -0700
            Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 04:28 +1000
              Re: Testing random Chris Angelico <rosuav@gmail.com> - 2015-06-08 04:40 +1000
        Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 04:24 +1000
  Re: Testing random Jonas Wielicki <jonas@wielicki.name> - 2015-06-07 12:41 +0200
  Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-07 22:52 +1000
    Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-07 23:06 +1000
    Re: Testing random Peter Otten <__peter__@web.de> - 2015-06-07 15:35 +0200
      Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 18:36 +0200
        Re: Testing random Peter Otten <__peter__@web.de> - 2015-06-07 18:48 +0200
          Re: Testing random Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 22:15 +0200
      Re: Testing random Steven D'Aprano <steve@pearwood.info> - 2015-06-08 11:35 +1000
  Re: Testing random Christian Gollwitzer <auriocus@gmx.de> - 2015-06-07 14:53 +0200
  Re: Testing random Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-06-07 11:04 -0400

csiph-web