## 5800 Reputation

16 years, 59 days

## New function?...

I was just starting to get used to unapply.  The problem with that now is that future applications by people who prefer to use, or start using, MakeFunction will fail in older versions of Maple.

In the first example on the help page I can see the logic of the new function.

This is the way I interpret it anyways - f equals make a function out of p in terms of x.  But it can be confusing because literally it says MakeFunction(p,x) - ok so what happened to p, I would kind of expect the variable p to be in the output.

Anyways, it's a play on words.

## order...

@Carl Love Thanks Carl.  Indeed I thought order was playing a factor, and of course always a consideration.

Of course, the simulations are the more nteresting parts.

## Problem 2...

@mmcdara So problem 2 is what I was getting at.  And I see you've arrived at the same probability I came up with 1.11E-06 Setting the containers to be analogous to colored balls.  Carl love and you had some great code for me to digest.

Thanks!

## Containers...

@Carl Love So I did this while I was falling asleep, and had to calculate it in the morning.  I get a different result than the one you found at the party.

I think the analogy is close to a container with colored balls each.  Just picking all of family B and all of family C the probabilty works out as 4 choose 16 times 3 choose 15 etc ...

4/16*3/15*2/14*1/13*4/12*3/11*2/10*1/9 = 1.11*10^(-6)  Not sure yet, exactly why my result is 6x less in probability than your result.

## Not symmetric...

@Carl Love Yes you are correct the permutations do not have to be symmetric.  Thanks for the different approach.

Also thanks Mmcdara for the code you created, symmetric or not - a second drawing of the same family is not impossible but still highly improbable and all the more reason to be skeptical of the draw.

## fixed...

@Carl Love ok thanks for randperm, in the meantime I've fixed what I had and gave the variables some random names.

 (1)

 (2)

 (3)

So Thomas will buy for Natalie, Christine will buy for Sandra, etc ...

## Sample drawing...

So just developed a simple sample drawing from a hat.

Maybe not efficient but it's easy to follow.  So a little code for one random draw.

 (1)

 (2)

edit *** oops, sorry that's only half of the draws.

## forensic mathematics...

@Carl Love yes forensic mathematics!

So the odds if it happening 2 years in a row is so small that the chance that the drawing was fixed is a very high probability.  So caught red handed by induction.

## clarification...

The number of adults and children I guess doesn't really matter.  What matters is that families can't choose other family members for a trade.

I didn't give historical results, but for just one year back lets just say all of Family B had members trading with all of Family C the previous Christmas, and the same thing happened this Christmas.

How likely was it that the same Family B just so happens to trade with all of Family C again two years in a row?

## Thanks and cat out of the bag....

Thanks Acer, mmacdara and Sand15 for your inputs.  Much appreciated.

mmacdara, I did see another post of yours with 2 dice - lengthy haven't gone through it yet.  I appreciate all the replies.

To put things into perspective, cat out of the bag so to speak.  It all spurred from my son who wanted to randomly pick a 5 player team from the 120 common hockey cards from this years Tim Hortons Hockey card collection.  He only has a 6 sided dice, and he's memorized which player belongs to which number so randomly had to be done.  And had to do it simply enough for him - eneded up teaching him about modular numbers which he gets but it's many years ahead of his math level.

## Thanks...

@acer Thanks  This is good.

I also thought about dividing the 20 up a few times.  roll of 1-3 would select values 1 to 10 and 4-6 select 11 to 20. Then roll again to split that up 1-3 for 1-5 and 4-6 for 6-10 etc.

Then I was left with choosing 5 numbers with a 6 sided die.  Just to continue on this track for a minute, I would have a loop that would just roll again if a 6 came up - I thought that was the simplest way to settle that thought.  But I got stuck trying to develop a while loop that would work.  Got stuck with the recursive assignment.  Any suggestions for that type of loop?

## uniform distribution...

@mmcdara Thanks for the inputs.

[moderator: moved description of the OP's actual goal to the body of the original Question.]

## distribution...

@sand15 Interesting thanks.  I came up with something similar but it seems my way doesn't result in a uniform distribution.

So picking a range from 1 to 20 using a six sided die I came up with this

with(Statistics):
d1 := RandomVariable(DiscreteUniform(1, 6)):

# for 500 samples of 4 rolls added
a := [seq((round(add(Sample(d1, 4))) mod 20) + 1, i = 1 .. 500)]

Histogram(a)

Distribution isn't fair.  Maybe your idea is better?

## divisible by 3...

@Thomas Richard yeah, only values divisible by 3 are showing up.
That is the sum of N rands only outputs solutions divisible by N.

Basically I was trying to use a 6 sided die to come up with a random number from a set range using mod.  Was looking at the distribution when I came across the rand issue.  Concluding me to look for another option.

## Lissajous...

Great post Daniel Skoog.  One thing though, your Lissajous knot is actually an unknot.  Using cos(7*t) produces a curve that can be unwound without knotting.  I believe you mean to use cos(5*t) which can not be unwound without knotting.

 1 2 3 4 5 6 7 Last Page 3 of 156
﻿