Math Is Fun Forum

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

You are not logged in.

#26 2012-04-27 06:00:24

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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

Offline

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

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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

Offline

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

Raito
Member
Registered: 2012-04-27
Posts: 50

Re: anyone good with doing math on excel?

I am sorry,phrontister smile

Offline

#29 2012-04-27 06:03:39

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#30 2012-04-27 06:12:04

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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! sleep


"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

Offline

#31 2012-04-27 06:14:05

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

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

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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

Offline

#33 2012-04-27 06:16:02

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#34 2012-04-27 06:16:50

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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

Offline

#35 2012-04-27 06:17:34

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

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

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

Re: anyone good with doing math on excel?

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

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

Last edited by phrontister (2017-02-26 00:17:51)


"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

Offline

#37 2013-05-02 21:17:41

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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:

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:

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-02 21: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

Offline

#38 2013-05-02 21:26:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#39 2013-05-02 21:28:41

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,879

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-02 21: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

Offline

#40 2013-05-02 21:43:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#41 2013-05-02 22:02:59

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: anyone good with doing math on excel?

Have you tried using

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

“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#42 2013-05-02 22:08:47

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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:

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

B) Can be adjusted like this,

(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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#43 2013-05-02 22:50:03

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: anyone good with doing math on excel?

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


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#44 2013-05-02 22:57:42

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#45 2013-05-02 23:00:51

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: anyone good with doing math on excel?

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


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#46 2013-05-02 23:04:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#47 2013-05-02 23:06:05

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: anyone good with doing math on excel?

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


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#48 2013-05-02 23:12:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#49 2013-05-02 23:35:45

anonimnystefy
Real Member
From: Harlan's World
Registered: 2011-05-23
Posts: 16,049

Re: anyone good with doing math on excel?

Here is my own code with no strings:

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

Last edited by anonimnystefy (2013-05-02 23:37:32)


“Here lies the reader who will never open this book. He is forever dead.
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment
The knowledge of some things as a function of age is a delta function.

Offline

#50 2013-05-02 23:45:23

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: anyone good with doing math on excel?

You will find this to be faster:

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.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

Board footer

Powered by FluxBB