Question

In: Electrical Engineering

MATALB MATALAB Getting 4-of-a-kind Consider the following experiment: oYou draw 5 cards from a deck of...

MATALB MATALAB

Getting 4-of-a-kind

Consider the following experiment:

oYou draw 5 cards from a deck of 52 cards. This is considered a single experiment. If you get 4-of-a-kind the experiment is considered a "success".

oYou repeat the experiment N=100,000 times, keeping track of the"successes".

oAfter the N experiments are completed count the total successes, andcalculate the probability of getting4-of-a-kin

Solutions

Expert Solution

Hello,
       Please find the answer attached below. If the answer has helped you please give a thumbs up rating. Thank you and have a nice day!

********** Matlab Code **********

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Four-of-a-kind experiment in Matlab

%%%%%%%%%% Define the parameters %%%%%%%%%%
numOfTrials = 100000          % persons playing cards.
numCardsPerTrial = 5         % cards each person holds
four_Of_A_Kind = 0;

% Perform Monte Carlo simulations for the random distribution game:
for h = 1 : numOfTrials
   % Get the cards. Each card is numbered from 1 - 52
   cards_pick = randperm(52, numCardsPerTrial);                    % picking the cards randomly
  
   % Check for four of a kind
   sameSuit = (min(cards_pick) >= 1 && max(cards_pick) <= 13) || ...     % cards are numbered from 1 till 52
   (min(cards_pick) >= 14 && max(cards_pick) <= 26) || ...              % a gap of 13 in the card numbering indicates a different kind
   (min(cards_pick) >= 27 && max(cards_pick) <= 39) || ...
   (min(cards_pick) >= 40 && max(cards_pick) <= 52);
   if sameSuit
       four_Of_A_Kind = four_Of_A_Kind + 1;                            % counting the successes
    end
end

success = four_Of_A_Kind;               % total number of successes
prob_success = success/numOfTrials     % probability of the success


************ End of Code **********

Output:

numOfTrials =

      100000


numCardsPerTrial =

     5


prob_success =

    0.0019

Final answer: The code gives the probability of success as 0.0019 or 0.19%

NOTE 1: Since this is a random experiment, the answer that you obtain might be slightly different from the answer that is given here. The answers can be made quite close by repeating the experiment for a large number of times.

NOTE2: The complete program has been commented in a manner that it is easy to re-code and understand the code.


Related Solutions

4. The experiment is to draw a card from a standard deck of cards. Consider the...
4. The experiment is to draw a card from a standard deck of cards. Consider the following events: Q = drawing a Queen R = drawing a red card a. Are Q and R mutually exclusive? Clearly explain. b. Find P(Q) and P(Q|R). c. Are the events Q and R independent? Clearly explain.
Suppose we draw 5 cards at random, without replacement, from a deck of 52 cards (such...
Suppose we draw 5 cards at random, without replacement, from a deck of 52 cards (such a deck includes 4 Queens). Let X denote the number of Queens drawn. Define some indicator random variables X1,..., X5 so that X = X1+:::+X5. Then use the random variables you created to find E(X). Also calculate the E[X] if this time 5 cards are drawn with replacement.
Consider a well shuffled deck of cards, from which 5 cards are drawn. a. Find the...
Consider a well shuffled deck of cards, from which 5 cards are drawn. a. Find the probability that you get three cards of hearts, and two cards of spades. b. Find the probability that you get three cards of the same suit, and two cards with the same suit (but different than the one of the three other cards).
Consider a reduced deck where all cards 2, 3, 4, and 5 (16 cards) are removed....
Consider a reduced deck where all cards 2, 3, 4, and 5 (16 cards) are removed. In a game of five card draw find the number of ways to draw one pair, two pair, three of a kind, straight, flush, full house, four of a kind, straight flush, and royal flush.
You draw two cards from a standard deck of 52 cards, but before you draw the...
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (Round your answer to three decimal places) 1) Find P(Ace on first card and Red card on second card) 2) Find P(Ace and King in either order) 3) If you do not replace the first card before drawing the second card, Find P(Ace on first card and King on second card)
From shuffled deck of cards, 4 cards are randomly selected without replacement from shuffled deck of...
From shuffled deck of cards, 4 cards are randomly selected without replacement from shuffled deck of 52 cards. What is the probability to get at least one ace?
A special deck of cards has 5 red cards, and 4 purple cards. The red cards...
A special deck of cards has 5 red cards, and 4 purple cards. The red cards are numbered 1, 2, 3, 4, and 5. The purple cards are numbered 1, 2, 3, and 4. The cards are well shuffled and you randomly draw one card. R = card drawn is red E = card drawn is even-numbered a. How many elements are there in the sample space? b. P(E) = Round to 4 decimal places.
You draw cards from a standard deck of 52 playing cards. There are 12 “face cards”...
You draw cards from a standard deck of 52 playing cards. There are 12 “face cards” in the deck (J, Q, or K). Let X be the number of drawings (with replacement) it takes until you get your first face card. Let Y be the number of drawings (with replacement) it takes until you get your fifth face card. Let Z be the number of face cards removed if you draw 10 cards without replacement. (a) Calculate P(X = 5)....
Imagine I offer you the following gamble. I shuffle an ordinary deck of cards (52 cards of 4 suits; no “jokers”). I draw one card from the deck
  Imagine I offer you the following gamble. I shuffle an ordinary deck of cards (52 cards of 4 suits; no “jokers”). I draw one card from the deck. If I draw a Heart, you win $8. If I draw any other suit, you lose (pay me) $2 A. What’s the probability that you’d win the bet (i.e., I draw a Heart)? What’s the probability that you’d lose the bet? B.What’s the expected value of the gamble? (For this problem,...
Cards: Suppose you draw one card from a single deck of cards. (a) What is the...
Cards: Suppose you draw one card from a single deck of cards. (a) What is the probability that you draw an queen? Round your answer to 3 significant digits*. (b) What is the probability that you draw a heart? Round your answer to 3 significant digits*. (c) What is the probability that you draw the queen of hearts? Round your answer to 3 significant digits*. ............................................... *Significant Digits: Here are some probabilities expressed to 3 significant digits. You start counting...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT