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

You are not logged in.

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

bobbym

Offline

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

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

#2 2013-06-10 12:12:41

Agnishom
Real Member

Online

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'
'The whole person changes, why can't a habit?' -Alokananda

#3 2013-06-10 15:31:20

bobbym

Offline

Re: Expected distance and geogebra.

Hi Agnishom;

In mathematics, you don't understand things. You just get used to them.
Some cause happiness wherever they go; others, whenever they go.
If you can not overcome with talent...overcome with effort.

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

gAr
Star Member

Offline

Re: Expected distance and geogebra.

Hi,

Here's a simulation with j

Code:

```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."

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

anonimnystefy
Real Member

Offline

Re: Expected distance and geogebra.

Hi gAr

I see you know J! How good are you with it.

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

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

gAr
Star Member

Offline

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."

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

anonimnystefy
Real Member

Offline

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?

The limit operator is just an excuse for doing something you know you can't.
“It's the subject that nobody knows anything about that we can all talk about!” ― Richard Feynman
“Taking a new step, uttering a new word, is what people fear most.” ― Fyodor Dostoyevsky, Crime and Punishment

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

gAr
Star Member

Offline

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."