Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

Login

Username

Password

Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno
Options

Go back

Topic review (newest first)

bobbym
2012-07-31 01:55:30

Hi;

Go at your own pace. You did well.

phrontister
2012-07-31 01:48:34

Hi Bobby,

That's really the only way I'll get anywhere with M for now. Anything that would require more dedicated study effort will have to wait until I get more time to be able to spend at it...but little by little I'm picking a few things up. Thanks for dangling the "extra credit" carrot...it motivated me. smile

bobbym
2012-07-31 01:39:48

Hi phrontister;

That is fine. It is okay to go from one language to another looking for the same type of commands in each language.

phrontister
2012-07-30 23:44:11

Hi Bobby,

Here's my M code. As you'll see, I was thinking LB while coding M...but it works. smile

My initial code was slow because I was testing for '200 ones' from the first pick ( sad ), but changing the test to commence after 199 picks reduced processing time to 1/7th of previous.

My LB code for 100,000 cycles took well over 9 hours c.f. M's 271 seconds.

Code:

In[1]:= Timing[sum = 0; c = 0; s = Table[0, {1000}];
         N[While[c < 100000, t = 199; ss = s;
          Do[ss[[RandomInteger[{1, 1000}]]] = 1, {t}] 
           While[Count[ss, 1] < 200, ss[[RandomInteger[{1, 1000}]]] = 1;t++]; 
          sum = sum + t; c++]; sum/c]]

Out[1]= {270.985, 223.00152}

So, again, just a touch > 223.

bobbym
2012-07-30 21:11:39

Hi phrontister;

I got a shade over 223 also.

anonimnystefy
2012-07-30 17:52:40

Hi phrontister

I started running 10 100000-cycles, but I wasn't at the computer long enough to check.

phrontister
2012-07-30 16:56:21

Hi Bobby and stefy,

I've run several 10,000-cycle simulations in LB and each result was a smidge over 223.0. The result of a 100,000 cycle was 223.03524.

My Excel results varied more, but all were still only just < or > 223. I only tested up to about 1,000 cycles, which would account for the variation difference between the two programs.

bobbym
2012-07-30 06:26:22

To get the sd we would have to run the simulation many times and use the formula. But by inspection you can see the dispersion is going to be small.

anonimnystefy
2012-07-30 06:24:25

Oh. Okay.

bobbym
2012-07-30 06:20:33

I do not know. But looking at the data the values are very close.

anonimnystefy
2012-07-30 06:17:39

How small?

bobbym
2012-07-30 06:16:11

Yes, it is quite small.

anonimnystefy
2012-07-30 06:14:45

Standard deviation?

bobbym
2012-07-30 06:13:17

Yes, it looks fine to me. The sd is very small on this problem.

anonimnystefy
2012-07-30 06:11:00

Did you see the edited post 19?

Board footer

Powered by FluxBB