# It is possible to calculate a two vector integral

I have this problem: calculate the integral of:

-1+Sqrt[2*d+1]


with d being a distance of two points in a 60$\times$60 box (inside or on the boundaries).

I know nothing of Mathematica.

I realize who to define functions with two variables and then calculate the integral in a specific interval for each variable (in this case [0,60]). But I do not know how to define a function with two vectors and then calculate the integral giving interval for each vector.

Well instead of using two vectors I can use 4 variables. The function seams to be defined correctly, but when I Integrate I don't get a result.

f[x_, y_, z_, w_] := Sqrt[(x - y)^2 + (z - w)^2]
f[1, 2, 3, 4]


(* Sqrt[2] *)

h[x_, y_, z_, w_] := -1 + Sqrt[1 + 2*f[x, y, z, w]]
h[1, 2, 3, 4]


(* -1 + Sqrt[1 + 2 Sqrt[2]] *)

Integrate[
h[x, y, z, w], {x, 0, 60}, {y, 0, 60}, {z, 0, 60}, {w, 0, 60}]


Any help will be greatly appreciated. I am stuck.

• Welcome to Mathematica.SE! Please provide a minimal example of what you tried so far, using proper formatting (note the "help"-menu on the top of this site). Did you already take a look at the Mathematica online documentation (at all)? Apr 9 '15 at 18:35
• take a stab at writing some mathematica code. I can't tell where you are stuck, and the problem isn't clearly posed. Apr 9 '15 at 18:35

I think this is what you're seeking:

$\int _0^{60}\int _0^{60}\int _0^{60}\int _0^{60}\left(-1+\sqrt{2 \sqrt{(\text{ax}-\text{bx})^2+(\text{ay}-\text{by})^2}+1}\right) d\text{by}\ d\text{bx}\ d\text{ay}\ d\text{ax}$

NIntegrate[
-1 + Sqrt[2 Sqrt[(ax - bx)^2 + (ay - by)^2] + 1],
{ax, 0, 60}, {ay, 0, 60}, {bx, 0, 60}, {by, 0, 60}] // Quiet


(* $8.70647\times 10^7$ *)

• However, the error estimate of this integral is quite huge... Apr 9 '15 at 18:58
• @Jinxed Huge... and yet correct. I suspect you've mis-stated your problem. Please revisit your problem carefully. Perhaps you want to compute an average... but nobody can tell from your question. Apr 9 '15 at 19:01
• Me? Are you sure? Apr 9 '15 at 19:05
• I suppose you meant the OP, not me. Apr 9 '15 at 19:17
• @Jinxed David has been exercising this for a while mathematica.stackexchange.com/q/79334/193 :) Apr 9 '15 at 19:21