I believe quadruple integration for the example of this thread would
require a different expression. If you want to buy me a mathematica
license, I might be inclined to install it on a machine and test this,
but for now, I just think it would look something like this:
Int[
Int[
Int[
Int[
16*(1-x[0])*(1-x[1])*(1-x[2])*(1-x[3])*Sqrt[(x[0]^2+x[1]^2+x[2]^2+x[3]^2)],
{x[0],0,1}]
{x[1],0,1}]
{x[2],0,1}]
{x[3],0,1}]
Though, of course, the dummy variable names can be changed as long as
that is done consistently.
Unfortunately, in J, I do not know how to represent that, though I
have a sinking feeling that it might involve something like this:
S ((2*#) * */@:-. * +/&.:*:) D._4 >{4#<4 4$#:i.16
(where I have not defined S ... but ((2*#) * */@:-. * +/&.:*:) D._4
already throws a nonce error, so the point is moot.)
--
Raul
On Thu, Jul 7, 2016 at 10:59 AM, David Lambert <[email protected]> wrote:
> 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, [email protected] wrote:
>>
>> Date: Wed, 6 Jul 2016 12:59:25 +0000 (UTC)
>> From: "'Jon Hough' via Programming"<[email protected]>
>> To:<[email protected]>
>> Subject: Re: [Jprogramming] Average distance between two points in a
>> square
>> Message-ID:
>> <[email protected]>
>> 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.
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm