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

You are not logged in.

#1751 2013-04-17 04:52:58

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

But they say it like this Yaaaaaaaaay geogebra!


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1752 2013-04-17 04:57:49

anonimnystefy
Real Member
From: The Foundation
Registered: 2011-05-23
Posts: 15,522

Re: Is this cool with you?

Yes, I know. I prefer the way they would say Go geogebra.


“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

Offline

#1753 2013-04-17 05:05:10

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Maybe the german is better, Ja Geogebra!


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1754 2013-04-17 05:13:45

anonimnystefy
Real Member
From: The Foundation
Registered: 2011-05-23
Posts: 15,522

Re: Is this cool with you?

I love the German accent. Actually, I love all accents except the American.


“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

Offline

#1755 2013-04-17 05:16:07

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Unless you are from the south where My geogebra becomes Ma geogebra.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1756 2013-04-17 14:45:20

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

Re: Is this cool with you?

Hi Bobby,

bobbym wrote:

New Problem:

A used car salesman has 8 lots with 100 cars each. He wants to repaint all his cars. Each day one of his employees picks 35 cars at random from all his cars and paints them. Then he returns them to the lots. Since they do not keep records some cars get painted more than once. After 23 days the manager would like to know how many cars have been painted. he wants to do this without going down to the lots. Can you figure it for him?

A says) 522.
B says) I do not have an answer but I know that A's answer is wrong.
C says) I got that, and it is definitely wrong.
D says) No answer yet.
E says) I got it!

I did a simulation in Excel and after just over 1 million iterations got about 514.67, which is very close to gAr's simulation result of about 514.4.


"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

#1757 2013-04-17 18:55:32

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Hi Phrontister;


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1758 2013-04-18 03:37:06

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

Re: Is this cool with you?

Hi Bobby,


"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

#1759 2013-04-18 03:41:10

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Hi;

3. Why is the output shown as a fraction instead of a decimal number?

You are working with exact arithmetic so the answer will be the exact answer. This will be very, very slow and unnecessary.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1760 2013-04-18 04:09:20

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

Re: Is this cool with you?

Hi Bobby,

This will be very, very slow and unnecessary.

True, but I got nowhere trying to understand the methods used by you, gAr and stefy because I haven't a clue about those more advanced approaches. So I opted just for the simulation, first in Excel and then in M, and am pleased I got them to work (clunkiness aside).

Anyway, the long processing time was just right for me to have a nice cup of coffee (latte) from a new pod machine I bought recently from the local supermarket: <$100AU for coffee maker and milk frother. smile


"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

#1761 2013-04-18 04:12:53

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Hi;

He probably reduced the fraction that is why there is a smaller number on the bottom than a 1000000.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1762 2013-04-18 04:41:02

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

Re: Is this cool with you?

Ah yes...obvious answer. Thanks!


"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

#1763 2013-04-18 04:43:32

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

I am buried right now but I will try to code a simulation for you. I will post it here. Maybe you will like it. And thanks for working on the problem!


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1764 2013-04-18 04:49:21

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

Re: Is this cool with you?

Ok, looking forward to seeing it and learning some more M...which I already did a little with the simulation as some of the coding was new to me. I'm off to bed now so I'll catch you later.


"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

#1765 2013-04-18 04:58:13

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Okay, you did very well with the M code. See you later.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1766 2013-04-18 11:01:00

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

Re: Is this cool with you?

Good morning, Bobby.

Last edited by phrontister (2013-04-18 11:05:31)


"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

#1767 2013-04-18 11:09:32

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Hi;

You said: "Close to the exact answer of 514.0874001..."

Isn't that an 'exact' approximation?

It is accurate to all the digits displayed. The exact answer is a big fraction.

This is what I came up with but it is not faster ( it might be slower ) than yours.

cars=Table[0,{800}];
numbers=Range[800];
fubar[n_]:=cars[[n]]=1;


Table[cars=0*cars;
Table[pcks=RandomSample[numbers,35];fubar/@pcks,{23}];
Count[cars,1],{10}]//Mean

In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1768 2013-04-18 16:25:05

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

Re: Is this cool with you?

Hi Bobby,

Thanks for doing that code for me - I'll have a closer look at it tonight to try and understand it. dizzy

I ran it just now, and, as you thought, it's slower than mine. Your code for 1 million iterations ran for 2241 seconds, and mine for 1014 seconds.

My M code basically follows the path I took with Excel, but is much briefer than that of course.

I just found an error in my Excel approach to do with multiple automatic iterations, but I think that my basic idea there is sound...just HUGELY slower now. sad

Last edited by phrontister (2013-04-18 18:50:39)


"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

#1769 2013-04-19 00:42:58

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Hi;

The procedural style seems to be beating the functional one here. Why that is, I do not know.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1770 2013-04-19 01:52:31

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

Re: Is this cool with you?

I wondered about that too but have no answer for it.

I think we should suggest to M that he package the nuts and bolts of my procedure into a super-fast function called PhroSim to encourage sales of M in used-car yards.


"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

#1771 2013-04-19 02:02:04

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

I will ask him the next time I see him but he is an obstinate guy.

Try this:

Table[
DeleteDuplicates[Table[RandomSample[Range[800],35],{23}]//Flatten]//Length,{100000}]//Mean

It uses many of your ideas but eliminates some of the procedural constructs.

Takes 41 seconds to do 100000 on my machine, a doggy dual core.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1772 2013-04-19 02:37:36

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

Re: Is this cool with you?

Wow! Had to get the fire extinguisher out to cool down my cpu for that one! BobSim runs 4 times faster than PhroSim. up But I know why...your code is only 2/3rds the length of mine.

Took 25 seconds on my old dual core, so it would put wings onto a modern cpu.

Excellent! smile


"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

#1773 2013-04-19 02:39:57

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

Your dual core would blow the doors off of mine as we used to say.

We could try to compile it to make it faster.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

#1774 2013-04-19 02:48:12

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

Re: Is this cool with you?

I don't know how to compile, other than in LB.

I'll have to start thinking more in functional mode than in procedural, now that I've seen the benefit of it. But it's gonna be hard to convert that which is set in concrete.


"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

#1775 2013-04-19 02:51:37

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 86,299

Re: Is this cool with you?

They say once you learn procedural it is very hard to rewire your mind. It is very difficult for me too.


In mathematics, you don't understand things. You just get used to them.
Of course that result can be rigorously obtained, but who cares?
Combinatorics is Algebra and Algebra is Combinatorics.

Online

Board footer

Powered by FluxBB