I was looking at
http://math.stackexchange.com/questions/1294800/average-distance-between-two-randomly-chosen-points-in-unit-square-without-calc
and I was wondering how one might perform this calculation in J.

It is, of course, fairly straightforward to approximate:

   (+/ %#)+/&.:*:@:(-/)?2 2 1e7$0
0.521401

And, you can just plug in the result given there:

   (1%15)*(2+]+5*[:^.1+])%:2
0.521405

But is it possible to perform this calculation in a reasonable fashion
using d. (or D.)?

More specifically, though, I would like to derive a version of this
which works for arbitrary dimension (line, square, cube, tesseract,
etc.)

But so far my attempts in that direction have just gotten me domain errors.

Perhaps what I should do is just sit down and derive the first four
values of that sequence and then see if a pattern stands out. But
before I did this, I thought I should check if this sort of thing
strikes someone else as being either familiar or interesting.

Thanks,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to