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

You are not logged in.

#1 2013-06-09 11:45:09

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 97,080

Expected distance and geogebra.

Hi;

What is the expected distance between 2 points that are randomly placed in a square that is 1 foot by 1 foot?

There is an analytical method but let's see what geogebra can do. Or rather, what I can do with geogebra.

For this one we will use some different features of geogebra like the spreadsheet.

1) Open up a spreadsheet and in column A,B,C and D put at the top random(). Pull the 4 columns down till you have 4 columns of 1000 random numbers.

2) Highlight columns A and B and right click and create a list of points.

3) Use the regular polygon tool to draw and click on (0,0) and (1,0) and enter 4 sides.

4) You should see something like the figure below.

5) In column E write Distance[(A1,B1),(C1,D1)] and pull it down until you have 1000 distances.

You should have 5 column of 1000 entries in each.

Enter in column F, Mean[E1:E1000] and see what you get. I got .51349 which is quite close to the exact analytical answer of

View Image: 2013-06-09_164151.gif

In mathematics, you don't understand things. You just get used to them.

If it ain't broke, fix it until it is.

Offline

#2 2013-06-09 14:12:41

Agnishom
Real Member
From: Riemann Sphere
Registered: 2011-01-29
Posts: 21,935
Website

Re: Expected distance and geogebra.

Could you please enlighten us with the analytical solution?


'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'
'But our love is like the wind. I can't see it but I can feel it.' -A Walk to remember

Offline

#3 2013-06-09 17:31:20

bobbym
Administrator
From: Bumpkinland
Registered: 2009-04-12
Posts: 97,080

Re: Expected distance and geogebra.

Hi Agnishom;


In mathematics, you don't understand things. You just get used to them.

If it ain't broke, fix it until it is.

Offline

#4 2013-09-01 00:59:02

gAr
Member
Registered: 2011-01-09
Posts: 3,479

Re: Expected distance and geogebra.

Hi,

Here's a simulation with j

samp =: 100000
(+/%#)((((?samp$0)-(?samp$0))^2)+((?samp$0)-(?samp$0))^2)^%2

A result I got ≈ 0.520588


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#5 2013-09-01 01:12:36

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

Re: Expected distance and geogebra.

Hi gAr

I see you know J! How good are you with 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

#6 2013-09-01 01:22:11

gAr
Member
Registered: 2011-01-09
Posts: 3,479

Re: Expected distance and geogebra.

Hi anonimnystefy,

That was my first program for a simulation!
I was thinking that it may be a good choice for simulations: fast to code and execute.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

#7 2013-09-01 01:26:16

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

Re: Expected distance and geogebra.

It's fast to code in it only when you have a certain proficiency with it. Otherwise it takes a lot of time looking at the glossary for each individual character. I am guessing you've been using J for a while then?


“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

#8 2013-09-01 01:30:31

gAr
Member
Registered: 2011-01-09
Posts: 3,479

Re: Expected distance and geogebra.

That's right, we must know the glossary first.
Spent a couple of days going through that, this is my first j program of some  use.


"Believe nothing, no matter where you read it, or who said it, no matter if I have said it, unless it agrees with your own reason and your own common sense"  - Buddha?

"Data! Data! Data!" he cried impatiently. "I can't make bricks without clay."

Offline

Board footer

Powered by FluxBB