(42S/DM42/Free42/Plus42) Birthday Probability Function - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (42S/DM42/Free42/Plus42) Birthday Probability Function (/thread-19535.html) |
(42S/DM42/Free42/Plus42) Birthday Probability Function - Eddie W. Shore - 02-10-2023 04:10 AM DM42, Free42, HP 42S: Birthday Probability Function P = Π( 1 - m/C, m = 1 to N-1) C = number of categories (examples: days in a calendar year, minutes in an hour, number of places, etc...) N = sample population P = probability that sample population does not share a category (examples: number of people that don't share the same birthday, number of people from a city that are not in the same location, etc...) Code: 00 { 58-Byte Prgm } Examples: Probability that 40 people do not share a birthday (assume a 365 day calendar): CATEGORIES? 365 N? 40 Probability: 0.10877 Probability that 3 cards drawn do not share the same suit: CATEGORIES? 4 (4 suits in a deck of cards) N? 3 Probability: 0.37500 Source: Diaconis, Persi and Brian Skyrms Ten Great Ideas About Chance Princeton University Press: Princeton, New Jersey. 2018. ISBN 978-0-691-19639-8 RE: (42S/DM42/Free42/Plus42) Birthday Probability Function - Thomas Klemm - 02-11-2023 09:24 AM For small values we can also use: Code: 00 { 9-Byte Prgm } Examples 365 ENTER 40 R/S 0.10877 4 ENTER 3 R/S 0.37500 RE: (42S/DM42/Free42/Plus42) Birthday Probability Function - Eddie W. Shore - 02-11-2023 05:34 PM The approximation does very well! RE: (42S/DM42/Free42/Plus42) Birthday Probability Function - Thomas Klemm - 02-12-2023 10:12 AM It's less of an approximation but uses the formula: \( \begin{aligned} \bar{p}(k)=\frac{_{365}P_{k}}{365^{k}} \end{aligned} \) where \(_{n}P_{k}\) denotes permutation. What I meant by "small values" is that with the HP-42S we can't go beyond \(k=195\) or we get the error: Out of Range However, it still works with Free42 due to its extended range. For an approximation we can use: \( \begin{aligned} \bar{p}(n,k) &\approx e^{-\frac{k(k-1)}{2n}} \\ &\approx \left(1 - \frac{k}{2n}\right)^{k-1} \\ \end{aligned} \) Here we assume that \(k \ll n\). Example 40 ENTER 39 * 2 / 365 / CHS ex 0.11801 1 ENTER 40 ENTER 2 / 365 / - 39 yx 0.11105 RE: (42S/DM42/Free42/Plus42) Birthday Probability Function - Thomas Klemm - 02-12-2023 10:39 AM It also seems to be a recurring topic of this forum:
|