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

You are not logged in.

#26 2012-04-28 04:00:24

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Oh, and please omit the "Mr". That makes me feel like I'm my dad!

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#27 2012-04-28 04:01:41

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Hi Bobby,

Yes, I had fun with that. I didn't know the iteration trick until the dice roll problem, but the thought sprang up in my mind and I came up with the trigger idea (B2*0 in cell B2) to utilize circular referencing. No doubt there's a proper way to do that, but mine worked and I haven't looked further.

The mathematics way I haven't got the first clue about...but, as you say, I'm sure it's a little nasty.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#28 2012-04-28 04:02:01

Raito
Full Member

Offline

Re: anyone good with doing math on excel?

I am sorry,phrontister

#29 2012-04-28 04:03:39

bobbym

Online

Re: anyone good with doing math on excel?

Hi phrontister;

Good to see you. Your a clever guy even if you aren't a little person.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#30 2012-04-28 04:12:04

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Hi Bobby,

Sorry to deflate your balloon (which all little people possess), but little people aren't at all clever. Wrong forum for this clue, I know...I'll copy it over to the right one.
Can't continue with that puzzle tonight, though, cos it's actually this morning...well, what's left of it!

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#31 2012-04-28 04:14:05

bobbym

Online

Re: anyone good with doing math on excel?

I know they are also doomed. Have a pleasant night.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#32 2012-04-28 04:14:27

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Oh...I can't do that! "Topic closed". What now?

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#33 2012-04-28 04:16:02

bobbym

Online

Re: anyone good with doing math on excel?

Sorry, it is closed pending MIF's review of it. I can do nothing right now about that. Please hold on to the clue and post tomorrow.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#34 2012-04-28 04:16:50

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Ok. G'night.

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#35 2012-04-28 04:17:34

bobbym

Online

Re: anyone good with doing math on excel?

Okay, see you later.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#36 2012-04-28 22:38:23

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

In my posts #14 & #17 I've now included a direct link to a video of animated calculation results so you can see the effect of the iterations.

Post #14 (dice rolls)

Post #17 (coin flips)

I increased column B's font size for a more vivid display...which slowed down the animations significantly.

Last edited by phrontister (2012-04-29 03:55:29)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#37 2013-05-03 19:17:41

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Hi Bobby,

Re the coin-flipping puzzle mentioned in post #17, could you please help me with my M code? I've done two versions of it, and version A works but version B's got a snag I haven't been able to fix.

Version A:

Code:

```c = 0;
For[i = 0, i < 10000, i++,
If[StringCount[ToString[FromDigits[RandomInteger[1, 10]]], "1111"] > 0, c = c + 1]]; N[c/i*100 "%"]```

Version B:

Code:

`N[Total[StringCount[Table[ToString[FromDigits[RandomInteger[1, 10]]], {10000}], "1111"]]/10000*100 "%"]`

The problem with version B is that it counts multiple occurrences of "1111" in an element: eg, "1111011110" scores 2 wins instead of 1, which incorrectly inflates the result.

Also, is there a function (something like StringCount) that can test the RandomInteger lists to see if they contain four consecutive elements that are all "1", so that I can eliminate "[ToString[FromDigits"? StringCount only works on strings (I think), and the only way I could get it to look at RandomInteger's lists was to convert the lists to numbers with FromDigits and then to strings with ToString...which seems to be two steps too many. But I couldn't find anything better (briefer).

Version A takes about 50% longer than version B.

Last edited by phrontister (2013-05-03 19:19:11)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#38 2013-05-03 19:26:07

bobbym

Online

Re: anyone good with doing math on excel?

This problem is also in another thread. I have not gone into it because the OP over there is not ready for a better idea. You unfortunately are.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#39 2013-05-03 19:28:41

phrontister
Real Member

Offline

Re: anyone good with doing math on excel?

Yes, I saw that thread and I agree with you, which is why I posted here.

Last edited by phrontister (2013-05-03 19:30:01)

"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson

#40 2013-05-03 19:43:07

bobbym

Online

Re: anyone good with doing math on excel?

Are you attempting to solve this with a simulation?

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#41 2013-05-03 20:02:59

anonimnystefy
Real Member

Offline

Re: anyone good with doing math on excel?

Have you tried using

Code:

`If[StringFreeQ[...,"1111"],0,1]`

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

#42 2013-05-03 20:08:47

bobbym

Online

Re: anyone good with doing math on excel?

The right way is not to simulate but to enumerate. I am getting 251 / 1024. The stupidity of the question is monumental! Why would they want to do a simulation of 10000 trials when there are only 1024 possibilities?

Try this:

Code:

```s = Tuples[{0, 1}, 10];
(Cases[s, {___, 1, 1, 1, 1, ___}] // Length)/1024```

B) Can be adjusted like this,

Code:

```(Select[StringCount[
Table[ToString[FromDigits[RandomInteger[1, 10]]], {10000}],
"1111"], # > 0 &] // Length)/10000.```

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#43 2013-05-03 20:50:03

anonimnystefy
Real Member

Offline

Re: anyone good with doing math on excel?

Instead of Cases[...]//Length you can just use Count[...].

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

#44 2013-05-03 20:57:42

bobbym

Online

Re: anyone good with doing math on excel?

Hi;

Yes, you can. the important thing is the difference in the method of solution. The enumeration gives the exact answer, something the simulation can never give.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#45 2013-05-03 21:00:51

anonimnystefy
Real Member

Offline

Re: anyone good with doing math on excel?

Yes, but if we wanted a simulation, phro's way is a good way to go.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

#46 2013-05-03 21:04:07

bobbym

Online

Re: anyone good with doing math on excel?

Not exactly, string operations are not necessary. It is more convenient to work with the preferred container of M. Lists!

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#47 2013-05-03 21:06:05

anonimnystefy
Real Member

Offline

Re: anyone good with doing math on excel?

I meant, in the sense of idea, bot in te sense of implementation.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

#48 2013-05-03 21:12:50

bobbym

Online

Re: anyone good with doing math on excel?

The first bit of code does run a good simulation.

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#49 2013-05-03 21:35:45

anonimnystefy
Real Member

Offline

Re: anyone good with doing math on excel?

Here is my own code with no strings:

Code:

`Count[Table[RandomInteger[], {10000}, {10}], {___, 1, 1, 1, 1, ___}]/10000 // N`

Last edited by anonimnystefy (2013-05-03 21:37:32)

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

#50 2013-05-03 21:45:23

bobbym

Online

Re: anyone good with doing math on excel?

You will find this to be faster:

Code:

```Count[Table[
RandomVariate[DiscreteUniformDistribution[{0, 1}],
10], {10000}], {___, 1, 1, 1, 1, ___}]```

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.