You are not logged in.

- Topics: Active | Unanswered

Any of them

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Let's look at the first one:

You would initialize 3 variables probably in an array to keep track of where the mouse is. You start him in one and then generate random numbers to move from room to room. You would tally up the number of times it leaves from room1, room 2 and room 3. You would run millions of these and then compute the percentage from room 3.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **A number by itself is useful, but it is far more useful to know how accurate or certain that number is.**

Offline

Why 3 variables?

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Because there are 3 rooms to exit from.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **A number by itself is useful, but it is far more useful to know how accurate or certain that number is.**

Offline

So how would I count the things basically? I am confused

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Hi;

You start in box one;

So say box[1]=1 now generate a random number between 0 and 1. If the number is <.5 then exit and count it as an exit from box A. Else you goto box 2

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.** **A number by itself is useful, but it is far more useful to know how accurate or certain that number is.**

Offline

Is it possible that we can do it manually?

There are not many rooms

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Not really the problem is it is difficult to tree because the rat can go to 2 and then back to 1. Because he can can backwards the rats path could be very large.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

And if we simulate we have to simulate each case for a finite amount of turns

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

I would choose something like 100 moves. It is possible the rat might still be in the maze but very improbable. So you would have a good estimate, which is what a simulation is.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

Okay let me do it

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

One question, can the rat enter once it has left?

*Last edited by Agnishom (2013-03-31 00:21:57)*

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Once the rat has left the rooms to go into the outer chamber the game is over.

Your answer is quite close.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

Is my simulation okay?

For b) I am getting 0.49939447

*Last edited by Agnishom (2013-03-31 00:37:22)*

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Your answer is close to the exact answer of 2 / 13 for a.

For b, I have not done the problem yet. When the OP did not come back I stopped working on it. I have to do a chore and then I will start on it.

You have done well being able to write the simulation.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

Thank you

I just edited the last post

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

For c) I am getting 0.352179

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

That is very good thinking, notice that your simulation backs that idea up.

b) 1 / 2 is correct.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

Please check c)

And please c my new problem and tell something about it

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

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

Hi bobbym

How do you do simulations like this in M?

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Which M are you talking about?

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

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

The one and only. Mathematica.

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

Mathematica is superior to all when it concerns mathematical programming. I have tried them all and will not use anything else.

How to do it? I am doing it now. But the first parts have been already solved using M's probability commands.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline

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

But, I want you to show me how to do simulations in it.

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

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 104,193

There are many ways to use M's probability functions to get simulations. If you have the PDF or the Markov matrix, M can run a simulation just from that.

Also, you can use M's lisp type functional programming to do it. As soon as I do it for c) I will post it for you. Right now I have administrative matters to deal with and they are slowing me down.

**In mathematics, you don't understand things. You just get used to them.****If it ain't broke, fix it until it is.**

Offline