Math Is Fun Forum

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

You are not logged in.

#401 2013-03-31 12:26:49

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

Re: PSLQ and LLL?

Can't you, please, post the code?


“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

#402 2013-03-31 12:29:26

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

Re: PSLQ and LLL?

Okay, I am now pretty sure of it's accuracy:

maze[]:=Module[{box, L={0,0,0,0}},

firstmove=RandomInteger[{1,4}];
If[firstmove==1, box=1;L[[4]]=1];
If[firstmove==2, box=2;L[[4]]=2];
If[firstmove>2, box=3;L[[4]]=3];
Do[
move=RandomInteger[{1,2}];
If [box==1 && move==1,L[[1]]=1;Return[L]];
If [box==1 && move==2,box=2];

move=RandomInteger[{1,3}];
If [box==2 && move==1,box=1];
If [box==2 && move==2,L[[2]]=1;Return[L]];
If [box==2&& move==3,box=3];

move=RandomInteger[{1,3}];
If [box==3&& move==1,box=2];
If [box==3 && move>1,L[[3]]=1;Return[L]],
{100}]
]

ans =Table[maze[],{1000000}];

(Select[ans,#[[3]]==1 && Last[#]==1&]//Length)/(Select[ans,#[[3]]==1 &]//Length)

0.07703891543158152

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

#403 2013-03-31 12:39:01

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

Re: PSLQ and LLL?

Shouldn't you be checking if Last[#] is 1. That is where he enters.

And what is the rest of the list L for?


“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

#404 2013-03-31 12:41:19

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

Re: PSLQ and LLL?

The list L contains all that information.


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

#405 2013-03-31 12:45:10

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

Re: PSLQ and LLL?

But, shouldn't you be checking if the third element is 1 and the fourth is 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

#406 2013-03-31 12:46:45

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

Re: PSLQ and LLL?

L[[4]] has the room the rat entered in

L[[1...3]] Has either a 1 or a 0. For instance L={0,1,0,3} would mean the rat entered the maze in room 3 and exited from room 2. L={1,0,0,2} would mean the rat entered the maze in room 2 and exited from room 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

#407 2013-03-31 12:51:40

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

Re: PSLQ and LLL?

Then that means you are selecting the cases where the rat has entered in room 3 and left at room 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

#408 2013-03-31 12:57:00

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

Re: PSLQ and LLL?

Yikes, that is correct. I told you not to rush me! I have adjusted the code.


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

#409 2013-03-31 12:58:19

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

Re: PSLQ and LLL?

You need #[[3]]==1 in the second select as well.


“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

#410 2013-03-31 13:01:02

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

Re: PSLQ and LLL?

Hi;

No, that is correct. Last[L] == 1 says it entered the maze in room 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

#411 2013-03-31 13:05:24

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

Re: PSLQ and LLL?

Oh, I tought that was for c).


“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

#412 2013-03-31 13:06:25

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

Re: PSLQ and LLL?

That is what I did it for:

(c) If the rat leaves the maze from Room 3 find the probability that it entered at Room 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

#413 2013-03-31 13:20:17

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

Re: PSLQ and LLL?

Well, that probability is P(entered at 1 and left at 3)/P(left at 3). That means the second Select selects the cases when the rat left at three, i.e. when #[[3]]==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

#414 2013-03-31 13:27:53

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

Re: PSLQ and LLL?

Hmmm, I think it should be
( the cases it left at 3 and started at 1) / (cases it started at 1 ).
That is what I have calculated.


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

#415 2013-03-31 13:35:05

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

Re: PSLQ and LLL?

That is not correct. That will give you the answer for a).


“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

#416 2013-03-31 13:45:10

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

Re: PSLQ and LLL?

Hi;

How about this way of thinking;

Out of 1000000 tries the rat started in room 1, 250077 times. About 1 / 4 which is
just what we expect. The number of times it left room 3 after starting in room 1 is
38522

38522 / 250077 = 0.15404 which is just what I am getting with mine.


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

#417 2013-03-31 13:48:22

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

Re: PSLQ and LLL?

Yes, but that still answers a).


“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

#418 2013-03-31 13:51:39

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

Re: PSLQ and LLL?

Maybe the answers are the same? Is there something wrong with what I did in post #416?


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

#419 2013-03-31 13:54:44

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

Re: PSLQ and LLL?

Yes, there is.

Do we agree that the probability we are looking for is P(entered at 1|left at 3)?


“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

#420 2013-03-31 13:56:10

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

Re: PSLQ and LLL?

Yes, that looks good.


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

#421 2013-03-31 13:57:46

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

Re: PSLQ and LLL?

And, do you agree that P(A|B)=P(A and B)/P(B)?

Last edited by anonimnystefy (2013-03-31 13:58:24)


“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

#422 2013-03-31 13:59:52

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

Re: PSLQ and LLL?

Yes, that is the definition.


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

#423 2013-03-31 14:01:36

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

Re: PSLQ and LLL?

That means that P(entered at 1|left at 3)=P(entered at 1 and left at 3)/P(left at 3).


“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

#424 2013-03-31 14:06:21

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

Re: PSLQ and LLL?

Hmmmm, hard to argue with that one. By golly I think you are right. I did not look at it that way.


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

#425 2013-03-31 14:08:14

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

Re: PSLQ and LLL?

Well, there you have it. What is the new result?


“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

Board footer

Powered by FluxBB