Christopher2222

5870 Reputation

24 Badges

16 years, 218 days

MaplePrimes Activity


These are replies submitted by Christopher2222

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

restart

hat := [a1, a2, a3, a4, b1, b2, b3, c1, c2, c3, c4, d1, d2, d3, d4, e1]

[a1, a2, a3, a4, b1, b2, b3, c1, c2, c3, c4, d1, d2, d3, d4, e1]

(1)

with(combinat)

with(StringTools)

 
c := []; hat1 := hat; for i in hat do b := [i, hat1[(rand(1 .. nops(hat1)))()]]; while Has(b[1], b[2]) = true do b := [i, hat1[(rand(1 .. nops(hat1)))()]] end do; c := [op(c), b]; hat1 := [op(`minus`({op(hat1)}, {op(b[2])}))] end do; c

[[a1, d2], [a2, b3], [a3, c4], [a4, e1], [b1, a2], [b2, d4], [b3, c1], [c1, b2], [c2, a4], [c3, a1], [c4, d1], [d1, b1], [d2, c3], [d3, c2], [d4, a3], [e1, d3]]

(2)

names := {a1 = Thomas, a2 = Christine, a3 = Nolan, a4 = Michael, b1 = Charlie, b2 = Karen, b3 = Sandra, c1 = Brad, c2 = Kristen, c3 = Laurie, c4 = Austin, d1 = Sam, d2 = Natalie, d3 = Tamara, d4 = Zoey, e1 = Barbra}

subs(names, c)

[[Thomas, Natalie], [Christine, Sandra], [Nolan, Austin], [Michael, Barbra], [Charlie, Christine], [Karen, Zoey], [Sandra, Brad], [Brad, Karen], [Kristen, Michael], [Laurie, Thomas], [Austin, Sam], [Sam, Charlie], [Natalie, Laurie], [Tamara, Kristen], [Zoey, Nolan], [Barbra, Tamara]]

(3)

``

Download Christmas_draw-4.mw

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

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.

restart

hat := [a1, a2, a3, a4, b1, b2, b3, c1, c2, c3, c4, d1, d2, d3, d4, e1]

[a1, a2, a3, a4, b1, b2, b3, c1, c2, c3, c4, d1, d2, d3, d4, e1]

(1)

with(combinat)

with(StringTools)

c := []

for i to 8 do b := randcomb(hat, 2); while Has(b[1], b[2]) = true do b := randcomb(hat, 2) end do; c := [op(c), b]; hat := [op(`minus`({op(hat)}, {op(b)}))] end do; c

[[b3, d2], [c4, d4], [a2, b2], [b1, c2], [a4, c3], [a1, d3], [c1, d1], [a3, e1]]

(2)

NULL

Download Christmas_draw.mw

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

@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.

Thanks both to your contributions. 

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 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. 

@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?

@mmcdara Thanks for the inputs. 

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

@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?

@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.

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.

 

@Traruh Synred The help states Multi-line comments are not available in 2-D math

It seemed to have worked in my 2d math, which is the default setting in document mode.  You perhaps are using the wrong brackets or missing a bracket during your construction of the comment section.

 

@segfault I have submitted a software change request. 

Maplesoft can't keep everyone happy all the time, but I think every little bit counts.  This change request should be a relatively easy one to incorporate.  In fact there may be some java trickery that could be done in an ini file or something that someone may be able to macguyver. 

@segfault I don't think they're resisting the change.  I think they just haven't allocated resources to make that change and instead have focused more on improving Maple performance.  Yes it would be a nice feature but aesthetics is probably low on their priority list. 

I'm not very familiar with Linux so I thought the Jupyter theme package would work for you.  In Linux there must be a setting to change the desktop colors.

In windows under the advanced personal settings the canvas can be changed but it occurs for all applications.  I show you below what Maple looks like when I make that change under windows 7, and also see that the notepad application canvas has also changed. 

 

For Linux (which it appears you are using) you can download the Jupyter - themes package and that will control the background color.

Same with Windows, will have to adjust the themes colors in the operating system.

But other than using the tables work around to change the color there doesn't appear to be another way. 

@sursumCorda Do you mind if you repost or reshare your alternate way?  I think it had to do with a vector approach. 

3 4 5 6 7 8 9 Last Page 5 of 158