*Originally posted by humy*

**So you are saying that;
**

∫[–∞, ∞] 1 / e^( ( 0.5/K^2 ) * ∑[n=1, m] ( x – h{n} )^2 ) dx = ∑[n=1, m] ∫[–∞, ∞] 1 / e^(( 0.5/K^2 ) * ( x – h{n} )^2 ) dx

?

But I wolf-alpha these inputs below for the LHS of that;

m=3

h{1} = 3.1

h{2} = 2.1

h{3} = -2.1

K=3

∫[–∞, ∞] 1 / e^( ( 0.5/K^2 ) * ∑[n=1, m] ( x – h{n} )^2 ) dx

= ∫[–∞, ∞] 1 / e^( ( 0.5/3^2 ) * ∑[n=1, ...[text shortened]... ntegrals seems to output the same 7.51988 figure for m=3 and K=3 regardless of their h{n} input.

I'll comment on the convergence of your integral in another post. That one can reorder sums and integrals, and for that matter double integrals, is a consequence of the fact that if a function is Riemann integrable it can be written as the limit of a sum. The order of summations can be changed: (a + b) + (c + d) = (a + c) + (b + d). The rest of this post just shows this in more detail for a double integral. The result for a sum and an integral can be obtained similarly.

It's a fundamental result in Calculus that it doesn't matter which order one does the integral in. First let's look at a 1 dimensional integral, using a simple version of Riemann's definition, which is good enough for our purposes then the definite integral of some function f(x) which is the first derivative of F(x) can be written as the limit of a sum:

F(b) - F(a) = ∫[a, b] dx f(x) = limit [N -> ∞] ∑[n=1, N] f(x_n) δx

here we're approximating the integral by a sum over n intervals of equal width and sampling the integrand at any point inside the integral. So we can choose x_n = a + (b - a)*n / N, which is just the right hand point of the interval, the width of each interval is δx = (b - a)/N. Just as a check if we choose f(x) = 1, the integral is just the length of the interval (b - a) and the sum is Nδx so we have the obvious result that the area of the whole is the sum of the areas of the parts.

A surface integral is defined similarly, suppose the region which is to be integrated over is R:

I = ∫_{R} dA f(x, y) = limit [p -> ∞] ∑[r=1, p] f(x_r, y_r) δA

Here we've approximated the region with small tiles of area δA, it does not matter what order we do the sum in. We can write this surface integral as a double integral:

I = ∫[a, b] dx ∫[c(x), e(x)] dy f(x, y).

Where a and b are the x coordinates of the left- and rightmost points in the region R and c(x) and e(x) are the top and bottom points of R for a given x coordinate. To keep things simple I'll restrict this to the case where R is a rectangle with pairs of sides parallel to the axes. This can be written as a double sum:

I = limit [M -> ∞] limit [N -> ∞] ∑[m = 1, M] ∑[n = 1, N] f(x_m, y_n) δxδy

Note that we've labeled the coordinates of the tiles differently in this sum. In the surface sum we have them labeled (x_1, y_1), (x_2, y_2), ..., (x_p, y_p). In the double sum we have them labeled (x_1, y_1), (x_1, y_2), (x_2, y_1), ..., (x_M, y_N). For a rectangular region of integration we have p = MN, so there are the same number of terms.

Here we have:

I = (f(x_1, y_1) δy + f(x_2, y_2) δy + ... + f(x_1, y_N) δy) δx + (f(x_2, y_1) δy + f(x_2, y_2) δy + ... + f(x_2, y_N) δy) δx + ... + (f(x_n, y_1) δy + f(x_n, y_2) δy + ... + f(x_n, y_N) δy) δx

I = f(x_1, y_1) δx δy + f(x_2, y_1) δx δy + f(x_1, y_2) δx δy + ...

But this can be written:

I = (f(x_1, y_1) δx + f(x_2, y_1) δx + ... + f(x_n, y_1) δx) δy + (f(x_1, y_2) δx + f(x_2, y_2) δx + ... + f(x_n, y_2) δx) δy + ... + (f(x_1, y_N) δx + f(x_2, y_N) δx + ... + f(x_n, y_N) δx) δy

I = limit [M -> ∞] limit [N -> ∞] ∑[n = 1, N] ∑[m = 1, M] f(x_m, y_n) δxδy

So we can reorder the sums. We can take the limits to get our eventual result that integrals can be reordered. We've also shown that integrals and sums can be reordered. So we have the general result that:

∫dx ∫dy f(x, y) = ∫dy ∫dx f(x, y)

∑[n = 1, N] ∫dx f_n(x) = ∫dx ∑[n = 1, N] f_n(x)

and

∑[m = 1, M] ∑[n = 1, N] f(m, n) = ∑[n = 1, N] ∑[m = 1, M] f(m, n)

I've skipped over some details regarding the boundary and this only applies if the sums and integrals are convergent.