cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Mathcad Community Challenge January 2024 - Statistics

DaveMartin
16-Pearl

Mathcad Community Challenge January 2024 - Statistics

Happy New Year!

 

DaveMartin_0-1704070647833.png

 

This month’s challenge is based around statistics, specifically permutations and combinations around shuffling a deck of cards. It’s inspired by this article:

https://www.mcgill.ca/oss/article/did-you-know-infographics/there-are-more-ways-arrange-deck-cards-there-are-atoms-earth

 

Your challenge, should you choose to accept it, is to perform the following in Mathcad Prime:

  • (Basic) Calculate the number of ways to shuffle a deck of cards. (Standard 52 card deck, no Jokers).
  • (Basic) Calculate the number of ways to shuffle a deck of cards if the suit (heart, diamond, spade, club) doesn’t matter.
  • Calculate the number of ways to shuffle a deck of cards consisting of just the face cards (jacks, queens, and kings). If you could shuffle the deck one time a second, how long would it take to shuffle each possible way? (Express the result in hours, days, or years, whichever is easiest for people to grasp.)
  • How long would it take to shuffle the face cards until there’s a 0.5 probability you’ve shuffled the same way twice? If you add the aces, how long would it take for that same 0.5 probability that you’ve shuffled the same way twice?
  • Create a Chart Component to depict the number of ways to shuffle a deck from 1 to 12 cards. (Hint: use the Chart Component’s logarithmic scale capability.)
  • (Optional) How many cards would be in a deck in which the number of ways to shuffle would be on an order of magnitude with the number of atoms in the Earth? What about the universe? Assume 10 to the 50th power for number of atoms in the Earth and 10 to the 80th for the universe.
  • (Optional) Add a header and footer to your worksheet.

As always, documentation is key. Create your worksheet in a manner that someone can understand it on its own.

 

Find the Mathcad Community Challenge Guidelines here!

 

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com
12 REPLIES 12
Werner_E
25-Diamond I
(To:DaveMartin)

OK, I'll jump in as its still January 1st over here and my avatar feels addressed by the task 😉

 

Some remarks:

I wouldn't say that the task is based around statistics but rather enumerating combinatorics and basic probability.

 

I don't think you really mean the number of ways we can shuffle a deck of cards. Because this would mean that we have to count methods like Overhand shuffle, Riffle (Dovetail) shuffle, Hindu shuffle, etc,  -> https://en.wikipedia.org/wiki/Shuffling

You rather sure mean the number of ways the cards can be arranged in sequence.

 

When you ask for the 50% probability you say "How long would it take to shuffle the face cards until there’s a 0.5 probability you’ve shuffled the same way twice? "

That's a bit unclear and you sure mean a probability of 50% or higher, don't you? Otherwise I guess there would be no solution.

Furthermore I guess you may mean twice or more and you would also be happy if the card arrangements achieved contain even more than just one pair of duplicates, correct?
I interpret that question similar to the well known Birthday-Problem, where the question is about the probability of at least two persons having the same day of birth (ignoring the year and Feb 29th). Just with 12! and 16! instead of 365.
Does my interpretation match your intention?

 

For the last but one (the first optional) I had to use the symbolics of Mathcad 15 as Primes was not capable enough and I did not want to resort to approximations and messing around with trial and error.
At least I found a way to get a solution good enough for this task even with Prime by using the Stirling formula and a little trick.

 

Anyway, find attached my 2 cents worth...

 

EDIT: Had to exchange the pdf file for one created by a different program because the one created using Primes "Save to pdf" option had some strange errors like (erroneous spaces highlighted in yellow by me)

Werner_E_0-1704150635624.png  or         Werner_E_1-1704150696844.png

 

Attacked using Prime 4 Express.

 

(Nowhere nearly as well documented as Werner's!)

Here is my attempt using Prime Express 8.  

I'm no statistical or combinatorial expert so I wouldn't be surprised if my logic is faulty somewhere!

 

Alan

 

Edit:  pdf file added

Edit 2:  pdf file replaced with an easier to read one.

 

Solution is both clever and lucid.

I haven't seen any ref to the other half of the question - number of atoms in Earth. From memory -

Mass of Earth = 6*10^24 kg.

Approx average atomic mass of Earth (a lot of iron in the core) say = 50.

Avogadro's number = 6*10^26/kmol

 

Number of atoms = 6*10^24/50*6*10^26 = 7*10^49

 

52! =8*10^67

GF_5490422
4-Participant
(To:DaveMartin)

Hello, all.

 

Here is my proposal. I´m not an expert in probability either, but trying is the best way to learn.

 

Best

Regards

Welcome to PTC Community!

And I like what you said about "trying is the best way to learn." True!

 

 

 

By the way, January 2024 lasts for only one more week. (Went by quick!) So to everyone else lurking, get your submissions in while January lasts, and we'll work to evaluate them in a blog that should release in early-mid February.

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.

What name should I use for you in the blog write-up?

 

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com
GF_5490422
4-Participant
(To:DaveMartin)

Hi,

You can use my name: Germano Freitas.

Every time I read about shuffling a 52-cards deck, my mind always get blow-away by how big of a number 52! is...

 

source : https://czep.net/weblog/52cards.html

 

Start a timer that will count down the number of seconds from 52! to 0. We're going to see how much fun we can have before the timer counts down all the way :

  1. Start by picking your favorite spot on the equator. You're going to walk around the world along the equator, but take a very leisurely pace of one step every billion years.
  2. After you complete your round the world trip, remove one drop of water from the Pacific Ocean.
  3. Now do the same thing again: walk around the world at one billion years per step, removing one drop of water from the Pacific Ocean each time you circle the globe.
  4. Continue until the ocean is empty.
  5. When it is, take one sheet of paper and place it flat on the ground.
  6. Now, fill the ocean back up and start the entire process all over again, adding a sheet of paper to the stack each time you’ve emptied the ocean.
  7. Do this until the stack of paper reaches from the Earth to the Sun.
  8. Take a glance at the timer, you will see that the three left-most digits haven’t even changed. You still have 8.063e67 more seconds to go. So, take the stack of papers down and do it all over again...
  9. One thousand times more. Unfortunately, that still won’t do it. You’re just about a third of the way done.

Last chance for this month's Mathcad Challenge! And remember, you can build on someone's previous submission. It is a community challenge.

 

 

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com

FYI, everyone has badges and the solution blog is published now!

 

Look forward to the March challenge coming... well, soon.

 

https://www.mathcad.com/en/blogs/community-challenge-playing-cards

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
Announcements

Top Tags