Brute Force probability of a pair in 5 cards:

(+/%#)4=;#&.>~.&.>{(5 comb 52){4#1 to 13

0.422569


Skip Cave
Cave Consulting LLC


On Fri, Oct 15, 2021 at 9:43 AM Devon McCormick <devon...@gmail.com> wrote:

> I have not had a chance to look over Thomas's calculations in detail.  To
> check them, I would extend the logic to some other similar problems to see
> how they do.  Come to think of it, I believe I have calculated the chance
> of a pair in five cards and that's something you could look up as well.
>
> The brute force calculations are a good sanity check but fall down for
> larger problems.  As I said in the meeting, I tend to trust my simulations
> more than my calculations.
>
> On Fri, Oct 15, 2021 at 4:52 AM Skip Cave <s...@caveconsulting.com> wrote:
>
> > Brute Force probability of a pair in a flop:
> >
> > (+/%#)2=;#&.>~.&.>{(3 comb 52){4#1 to 13
> >
> > 0.169412
> >
> > Skip Cave
> > Cave Consulting LLC
> >
> >
> > On Thu, Oct 14, 2021 at 12:10 AM Thomas McGuire <tmcguir...@gmail.com>
> > wrote:
> >
> > > Devon presented more of his Poker simulations now using Jd (the J
> > > database) at the most recent NYCJUG meeting (
> > > https://code.jsoftware.com/wiki/NYCJUG/2021-10-12 <
> > > https://code.jsoftware.com/wiki/NYCJUG/2021-10-12>)
> > >
> > > He came up with an interesting problem of calculating the expected
> number
> > > of pairs in the initial flop in a game of Omaha.
> > >
> > > 3 cards dealt into the flop. Consider those with only pairs in them,
> > there
> > > would be 3 ways that the pairs could be dealt out.
> > >
> > > X X Y, X Y X, Y X X
> > >
> > > Taking the first configuration the number of different hands you could
> > > make would be:
> > >
> > >    */52 3 48  NB. this matches part of Devon’s calculation
> > > 7488
> > >
> > > NB. anyone of 52 cards can be dealt, once the card is dealt then only 1
> > of
> > > 3 can be dealt to make the pair
> > > NB. then we have to exclude the remaining 2 cards that match and
> > therefore
> > > the third card will be anyone of 48
> > >
> > > NB. since there are 3 configurations the cards can be dealt in, the
> other
> > > 2 would be calculated:
> > >   */52 48 3
> > > 7488
> > >   */48 52 3
> > > 7488
> > >
> > > NB. this makes
> > >    3*7488.    NB. Different 3 card hands with only pairs in them
> > > 22464
> > >
> > > To calculate the percentage of the total number of hands Devon made the
> > > calculation using only one of the pairs hand configurations. Then used
> > 3!52
> > > for combinations of 52 things taken 3 at a time.
> > >
> > > This was off by a factor of 2 from his simulation, where he enumerated
> > all
> > > the possibilities.
> > >
> > > I finally realized (it took me 2 days of intermittent thought) that the
> > > order in which the cards are dealt matter. Not so much in the scoring
> of
> > a
> > > hand but it does matter for the number of ways the same hand can be
> dealt
> > > out.
> > >
> > > NB. So the total number of 3 card hands from 52 cards is:
> > >     */52 51 50
> > > 132600
> > >
> > > NB. which is permutations of 52 things taken 3 at a time
> > > NB. which like the Combinations function in J has a representation
> called
> > > the Stope function:
> > >     52 ^!._1 (3)
> > > 132600
> > >
> > > NB. Devon’s original calculation was:
> > >    (*/52 3 48)%3!52
> > > 0.338824
> > >
> > > NB. However based on the analysis above it should be:
> > >    (3 * */52 3 48)%52 ^!._1 (3)
> > > 0.169412
> > >
> > > NB. Which is very close to his simulated percentage: 0.169418
> > >
> > > Devon was more concerned with scoring a hand rather than the order they
> > > were dealt in, when dealing with his calculation.
> > > So the best I could come up with to follow what I think was Devon’s
> > > thought process was the following:
> > >
> > > NB. there are 13 different card values
> > > NB. there are 2!4 combinations of pairs due to the different suits
> > > NB. there will be 48 cards left over to make the flop since we exclude
> 3
> > > of a kind (that’s a different type of poker hand than a pair)
> > > NB. So:
> > >    (*/13,(2!4),48)%3!52
> > > 0.169412
> > >
> > > So the question is did I calculate these both correctly or did I just
> > come
> > > up with 2 methods that match the simulation and just think my logic is
> > > correct?
> > >
> > >
> > >
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
>
>
> --
>
> Devon McCormick, CFA
>
> Quantitative Consultant
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to