5745 Reputation

24 Badges

15 years, 136 days

MaplePrimes Activity

These are questions asked by Christopher2222

So, every year our family picks names for Christmas, but this year seemed odd.  My wife pointed out that one family always just happens to randomly pick another families name.  That is the majority of the time most of one family is always trading with another, the only rule is that each family member can not trade with a member of their own family. 

I was wondering if someone could come up with a way to calculate just how random the choice actually was from the previous year or years using whatever means necessary .. graph theory came to mind.  The draw was done behind closed doors, so my wife questioned how failrly that was done, and so brought me here with the question ...
Was the name choosing really random or was it actually a fixed draw?

In our group there are total of 9 adults and 9 children, but actually the 2 youngest children swap gifts so it's really 9 adults and 7 children who can swap presents.  But I will breakdown the families less the two trading children.

Family A - 2 adults 1 child
Family B - 2 adults 2 children
Family C - 2 adults 2 children
Family D - 2 adults 2 children
Family E - 1 adult

Oh, a child can trade with another child or a parent and similarily a parent can trade with another parent or a child.  

Something to be aware of.  I realized you can't use rand in an equation with other rand's since the calculation affects the other call to it. 

Here is an example:

A simulation of 3 six sided die rolls added together for 50 trials. 

for i from 1 to 50 do
end do:

You'll notice the rand calls have affected the other calls to rand, and has eliminated some possible results.  

[added by moderator, from a Reply by the OP]

The idea was to generate values from 1 to 20 (I just chose 20 as an example) using 6 sided dice, and one that which produces as uniform a distrubution as possible. I appreciate the explanations.  I chose 4 as the smallest number of rolls needed. In the physical world as n approaches large numbers rolling that many becomes increasingly more difficult and time consuming.

So just wondering what the best solution would be for a uniform distribution in a range from 1 to n using only six sided dice?

map seems to work differently on lists and Matricies.  How do I get map to work on the Matrix?

a := [[1.2, 4.3], [3.2, 5.3]]

[[1.2, 4.3], [3.2, 5.3]]






[1.2, 4.3]


b := map(proc (x) options operator, arrow; [floor(x[1]), x[2]] end proc, a)

[[1, 4.3], [3, 5.3]]


c := convert(a, Matrix)

Matrix(%id = 36893488148073393796)






Vector[row](%id = 36893488148073381388)


d := map(proc (x) options operator, arrow; [floor(x[1]), x[2]] end proc, c)

Matrix(%id = 36893488148073382844)




The interrupt button is great for stopping long calculations. But if there is an accidental calculation of a long list that has a mistype for example and the computer is busy calculating behind the scenes getting ready to output to the screen (evaluating icon has a heartbeat) there is no interrupt for that.  You either wait for the output or kill maple and start again (you may be able to save the worksheet before you close it - that might be an option).

map won't work with left quotes


1 2 3 4 5 6 7 Last Page 1 of 93