Question: 3D Numerical Integration

Hi, Maple community

I am trying to integrate a 3D data numerical set. I managed to execute an array interpolation algorithm and apply it to plot a smooth surface but I do not know how to integrate it numerically. I want to be able to integrate the data not only in its domain but also in sub-domains for multiple purposes.

I've found here a topic about it and tried to apply suggestions made with no success.

Here I copy the worksheet steps:

restart:
with(LinearAlgebra):
with(CurveFitting):
with(plots):

Initial Parameters

Nx:=8;    Points in the x direction
Nz:=6;    Points in the z direction
Lx:=3;    This means x goes from 0 to 3
Lz:=2;    This means z goes from 0 to 2
Delta[ze]:=evalf(Lz/(Nz-1));
Delta[xe]:=evalf(Lx/(Nx-1));

DataPn:=Matrix(Nx,Nz,0):         Matrix to store values in the 3rd direction

The following step is a function that I used to simulate data that I will later on will get by measurings.

for i from 1 to Nx do
 for j from 1 to Nz do
  DataPn[i,j]:=evalf(sin(Pi*(i-1)*Delta[xe]/Lx)*sin(Pi*(j-1)*Delta[ze]/Lz)):
 end do;
end do;

Setting data to use ArrayInterpolation

datax:=Array([seq((i-1)*Delta[xe],i=1..Nx)]);
dataz:=Array([seq((j-1)*Delta[ze],j=1..Nz)]);

In this step here, I don't really understand what this argument [[a],[b]] means but ArrayInterpolation cannot work without it.

MI:=(a,b)->ArrayInterpolation([datax, dataz],Array(DataPn),[[a],[b]],'method' = 'spline')[1,1];

Plot and display the interpolation and the real function to compare the quality of the interpolation, actually it does an excellent job, at least with this data.

G1:=plot3d(MI, datax[1]..datax[Nx], dataz[1]..dataz[Nz],labels=[x,z,Pn]);
G2:=plot3d(evalf(sin(Pi*x/Lx)*sin(Pi*z/Lz)),x=0..3,z=0..2,color=red);
display(G1,G2);

And finally I found this integration method here in mapleprimes

evalf(Int(x->evalf(Int( y->MI(x,y), 0..3,method=_d01akc)),0..2,method=_d01akc));

And the result is 1.102279199. I thought maybe I was setting wrongly the integration limits or the order in the command but in any case the result was near the analytic case which was:

int(evalf(sin(Pi*x/Lx)*sin(Pi*z/Lz)),x=0..3,z=0..2);

2.431708408

In this scenario I know the result is wrong because I can compute the exact solution, but later on I won't be able to do so. Also, later I'm interested in the integration, let's say, x from 0..0.5 and later from 0.5..1 and so on (keeping z always from 0 to 2) So, the main questions are:

1. Am I setting something wrong?
2. If I delete the method option in the integral, it takes a lot of time for the program to compute any result. Why?
3. Is there any other way to integrate this? I mean, any other way to write the command to compute the integral.
4. What does the [[a],[b]] argument stands for in ArrayInterpolation?

Regards and thanks for your help.

Please Wait...