Math Is Fun Forum
  Discussion about math, puzzles, games and fun.   Useful symbols: √ ∞ ≠ ≤ ≥ ≈ ⇒ ∈ Δ θ ∴ ∑ ∫ π -

Login

Username

Password

Not registered yet?

Post a reply

Go back

Write your message and submit
:) :| :( :D :o ;) :/ :P :lol: :mad: :rolleyes: :cool: | :dizzy :eek :kiss :roflol :rolleyes :shame :down :up :touched :sleep :wave :swear :tongue :what :faint :dunno
Options

Go back

Topic review (newest first)

gAr
2013-09-01 23:30:31

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.

anonimnystefy
2013-09-01 23:26:16

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?

gAr
2013-09-01 23:22:11

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.

anonimnystefy
2013-09-01 23:12:36

Hi gAr

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

gAr
2013-09-01 22:59:02

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

bobbym
2013-06-10 15:31:20

Hi Agnishom;

Agnishom
2013-06-10 12:12:41

Could you please enlighten us with the analytical solution?

bobbym
2013-06-10 09:45:09

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

Board footer

Powered by FluxBB