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

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

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

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

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

Offline

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

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

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

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

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

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

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

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

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

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

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

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

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

Pages: **1**