Neil, thanks for being so responsive. First, I would like you to see the attached file for the output of running your second segment of code. Specifically the following
ClearAll[integral2];
integral2[nx_, ny_, delta_] :=
integral2[nx, ny, delta] =
integral2[nx - delta, ny - delta, delta] +
NIntegrate[func2[x, y], {x, 30, nx - delta}, {y, ny - delta, ny}] +
NIntegrate[func2[x, y], {x, nx - delta, nx}, {y, 0, ny}]
integral2[30, 30, 1] = 0;
And
AbsoluteTiming[
Export["FileToSaveToFast.csv",
Table[integral2[i, i, 1/10], {i, 30, 139, 1/10}]]]
The output came to be the same for both my and your function. I am not sure how were you able to get a valid output, setting delta to 1/10 would always yield a similar output.
Second, regarding implementing your function for different x and y, below are my thoughts
ClearAll[integral2];
integral2[nx_, ny_, delta_] :=
integral2[nx, ny, delta] =
integral2[nx - delta, ny - delta, delta] +
NIntegrate[func2[x, y], {x, 30, nx - delta}, {y, ny - delta, ny}] +
NIntegrate[func2[x, y], {x, nx - delta, nx}, {y, 5, ny - delta}]
integral2[30, 30, 1] = 0;
And
AbsoluteTiming[
Export["FileToSaveToFast.csv",
Table[integral2[i, j, 1/10], {i, 30, 139, 1/10}, {j, 5, 14, 1/10}]]]
Needles to say, this incorrect but I am not really sure for example what this line is for
integral2[30, 30, 1] = 0;
Regards, Abdullah
Attachments: