[Jprogramming] Average distance between two points in a square
David Lambert
b49p23tivg at gmail.com
Thu Jul 7 14:59:12 UTC 2016
I vote for quadruple integration.
In mathematica notation (as I recall it),
and ignoring the 1/(1-0) unit square averaging factors
The average distance between 2 points
is the quadruple integral
Int[
Int[
Int[
Int[
Sqrt[(x[1]-x[0])^2 + (y[1]-y[0])^2],
{x[0],0,1}]
{x[1],0,1}]
{y[0],0,1}]
{y[1],0,1}]
On 07/06/2016 10:56 PM, programming-request at forums.jsoftware.com wrote:
> Date: Wed, 6 Jul 2016 12:59:25 +0000 (UTC)
> From: "'Jon Hough' via Programming"<programming at jsoftware.com>
> To:<programming at jsoftware.com>
> Subject: Re: [Jprogramming] Average distance between two points in a
> square
> Message-ID:
> <136194194.2684355.1467809965279.JavaMail.yahoo at mail.yahoo.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hi Raul,
>
> "But is it possible to perform this calculation in a reasonable fashion
> using d. (or D.)?"
>
> I'm no expert, but I doubt it. In the first answer to the question in your link, the user gave a comprehensive answer for calculating the case of a unit square. I think it can be extended to the case for any dimension (just more integrals). I'm not entirely sure how he evaluated the integral. But anyway it's a double integral, and I'm not sure how d. or D. can work with double integrals. I doubt it's possible. And it only gets worse for a cube etc, cus you'll have a triple integral etc.
More information about the Programming
mailing list