IntegrateData2D - Maple Help

SignalProcessing

 IntegrateData2D
 calculate the volume under a 2-D data set

 Calling Sequence IntegrateData2D( X, Y, Z, options ) IntegrateData2D( Z, options )

Parameters

 X, Y - one-dimensional rtables or lists of independent data values of type realcons Z - two-dimensional rtable or list of dependent data values of type complexcons

Options

 • compiled: Either true or false, specifies if auxiliary procedures are to be compiled if they are currently uncompiled. The default is false.
 • method: One of bottomleftcorner, topleftcorner, toprightcorner, bottomrightcorner, averagecorner, and simpson. The default is averagecorner.
 • sortdata: Either true or false, specifies if the data is to be sorted. The default is true.
 • steps: List of two numeric values, specifies the constant spacing of the independent data for the IntegrateData2D(Z) calling sequence. The default is [1,1].
 • tolerance: Positive numeric value which specifies the tolerance for determining if the independent data in X and Y are uniformly spaced. The default is HFloat(5,-15).
 • uniform: Either true or false, specifies if the independent data in X and Y are to be assumed uniform. The default is false.

Description

 • The IntegrateData2D command approximates the volume beneath a 2-D data set using the specified method.
 • For the IntegrateData2D(X,Y,Z) calling sequence, Z must have numelems(X) rows and numelems(Y) columns. The values of Z are assumed to have been generated by some hypothetical function $f\left(x,y\right)$ and satisfy ${Z}_{i,j}=f\left({X}_{i},{Y}_{j}\right)$ for each $i$ and $j$.
 • Internally, the complex case (where Z is complex) is reduced to the real case by applying IntegrateData2D separately to the real and imaginary parts of Z. That is:

$\mathrm{IntegrateData2D}\left(X,Y,Z\right)=\mathrm{IntegrateData2D}\left(X,Y,\mathrm{\Re }\left(Z\right)\right)+I\mathrm{IntegrateData2D}\left(X,Y,\mathrm{\Im }\left(Z\right)\right)$

 For the discussion below, assume the values in Z are real-valued.
 • When method is any of the "corner methods" and Z has less than two rows or columns, or when method is simpson and Z has less than three rows or columns, the result will be Float(undefined).
 • Suppose sortdata=true. For the IntegrateData2D(X,Y,Z) calling sequence, X and Y are sorted to be in non-decreasing order and Z is sorted in tandem. For the IntegrateData2D(Z) calling sequence, if one or both values in steps is negative, then the absolute values of these widths is used, and the elements of Z are sorted accordingly. For example, if ${\mathrm{steps}}_{1}<0$ and $0<{\mathrm{steps}}_{2}$, then the rows of Z are sorted in reverse order.
 • When sortdata=false, the onus is on the user to ensure that the data passed is sorted. For the IntegrateData2D(X,Y,Z) calling sequence, if the data is in fact not sorted, then the result may be useless. For example, if method=simpson and ${X}_{i+1}={X}_{i}$ for some $i$, then a division by zero occurs and the computed volume will be Float(undefined).
 • For the IntegrateData2D(X,Y,Z) calling sequence, when uniform=true, it is assumed that X and Y are uniformly spaced, with respective spacings ${X}_{2}-{X}_{1}$ and ${Y}_{2}-{Y}_{1}$. When uniform=false, however, the procedure first checks if X and Y are uniform before deciding which auxiliary procedure to use to compute the volume. For X to be considered uniformly spaced, for example, it must satisfy $\left|{\mathrm{\Delta }}_{i}-{\mathrm{\Delta }}_{j}\right|\le \mathrm{\tau }$ for each $i$ and $j$, where ${\mathrm{\Delta }}_{i}={X}_{i+1}-{X}_{i}$ and $\mathrm{\tau }=\mathrm{tolerance}$.
 • Computations using regular/uniform data, compared with irregular/non-uniform data, tend to be quicker and have smaller numerical error in the final result. Regarding speed, for one of the "corner methods" with a fixed number of values in X and Y, the computation typically takes twice as long if X and Y are irregular than if they are regular. For Simpson's Method, the time taken for irregular data is approximately quadruple the time taken for regular data.
 • The main computations are handled internally by compilable auxiliary procedures. When IntegrateData2D is called for the first time with compiled=true, these procedures will be compiled before being used. Subsequent calls to IntegrateData2D will used these compiled versions, even if compiled=false, and execute much more quickly. If IntegrateData2D has yet to be called in the session with the compiled=true option, then the auxiliary procedures will be called in evalhf mode. Note: There will be a slight time delay when the procedures are first compiled.
 • Use of compiled=true is recommended when the number of data points in large, on the order of 10^5 or larger, or if IntegrateData2D is to be called many times in a Maple session. Typically, when the number of data points is large, the compiled version will run approximately ten times faster than the uncompiled version.
 • For any of the "corner methods", the following formula is used:

$\mathrm{IntegrateData2D}\left(X,Y,Z\right)={\sum }_{i=1}^{m-1}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{\sum }_{j=1}^{n-1}{z}_{i,j}\left({X}_{i+1}-{X}_{i}\right)\left({Y}_{i+1}-{Y}_{i}\right)$

 where $m=\mathrm{numelems}\left(X\right)$ and $n=\mathrm{numelems}\left(Y\right)$. For method=bottomleftcorner:

${z}_{i,j}={Z}_{i,j}$

 For method=topleftcorner:

${z}_{i,j}={Z}_{i,j+1}$

 For method=toprightcorner:

${z}_{i,j}={Z}_{i+1,j+1}$

 For method=bottomrightcorner:

${z}_{i,j}={Z}_{i+1,j}$

 For method=averagecorner:

${z}_{i,j}=\mathrm{Typesetting}:-\mathrm{_Hold}\left(\left[\mathrm{%/}\left({Z}_{i,j}+{Z}_{i,j+1}+{Z}_{i+1,j}+{Z}_{i+1,j+1},4\right)\right]\right)$

 Note: method=averagecorner is the 2-D analogue of the Trapezoid Method in 1-D, and for a given sub-box consisting of ${X}_{i}$, ${X}_{i+1}$, ${Y}_{j}$, and ${Y}_{j+1}$, the volume is that of the best-fit plane through the four points.
 • We will omit the long and complicated formulas for method=simpson, and include only a description of the derivation. Suppose first that m and n are odd, where $m=\mathrm{numelems}\left(X\right)$ and $n=\mathrm{numelems}\left(Y\right)$. Now, partition the grid into non-overlapping sub-boxes with nine points each, formed by points consisting of ${X}_{p}$, ${X}_{p+1}$, ${X}_{p+2}$, ${Y}_{q}$, ${Y}_{q+1}$, and ${Y}_{q+2}$, where $p=1..\mathrm{Typesetting}:-\mathrm{_Hold}\left(\left[\mathrm{%/}\left(m-1,2\right)\right]\right)$ and $q=1..\mathrm{Typesetting}:-\mathrm{_Hold}\left(\left[\mathrm{%/}\left(n-1,2\right)\right]\right)$. The formula for the approximate volume over one of these sub-boxes is found by integrating over the sub-box the unique quadratic bivariate polynomial which interpolates these nine points. When one or more of m and n is even, however, sub-boxes of nine points are again considered, but the integration is performed only over the parts that have not yet been counted using the above method.
 • Any input rtable/list of independent data is converted to an rtable of float[8] datatype having no infinite or undefined values, and an error is thrown if this is not possible. Similarly, the input rtable/list of dependent data is converted to an rtable of either float[8] or complex[8] datatype having no infinite or undefined values, and an error is thrown if this is not possible. For this reason, it is most efficient for any input to already be an rtable having the appropriate datatype. Note: The rtables cannot have an indexing function, and they need to have rectangular storage.
 • The IntegrateData2D command is not thread safe.

Examples

 > $\mathrm{with}\left(\mathrm{SignalProcessing}\right):$

Example 1

 • Consider this quadratic bivariate polynomial:
 > $p≔\left(x,y\right)→3-2x+5y+4{x}^{2}-10xy+7{y}^{2}$
 ${p}{≔}\left({x}{,}{y}\right){↦}{3}{-}{2}{\cdot }{x}{+}{5}{\cdot }{y}{+}{4}{\cdot }{{x}}^{{2}}{-}{10}{\cdot }{y}{\cdot }{x}{+}{7}{\cdot }{{y}}^{{2}}$ (1)
 > $a≔0:$
 > $b≔10:$
 > $c≔0:$
 > $d≔20:$
 > $\mathrm{plot3d}\left(p,a..b,c..d\right)$
 • First, create sample points:
 > $m≔7:$
 > $n≔13:$
 > $\mathrm{dx}≔\mathrm{evalhf}\left(\frac{b-a}{m-1}\right):$
 > $\mathrm{dy}≔\mathrm{evalhf}\left(\frac{d-c}{n-1}\right):$
 > $X≔\mathrm{Vector}\left(m,i→\mathrm{evalhf}\left(a+\left(i-1\right)\mathrm{dx}\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 ${X}{≔}\left[\begin{array}{c}{0.}\\ {1.66666666666667}\\ {3.33333333333333}\\ {5.}\\ {6.66666666666667}\\ {8.33333333333333}\\ {10.}\end{array}\right]$ (2)
 > $Y≔\mathrm{Vector}\left(n,j→\mathrm{evalhf}\left(c+\left(j-1\right)\mathrm{dy}\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 > $Z≔\mathrm{Matrix}\left(m,n,\left(i,j\right)→\mathrm{evalhf}\left(p\left({X}_{i},{Y}_{j}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 • Now, compute the volume using Simpson's Method:
 > $\mathrm{α}≔\mathrm{IntegrateData2D}\left(X,Y,Z,'\mathrm{uniform}','\mathrm{method}'='\mathrm{simpson}'\right)$
 ${\mathrm{\alpha }}{≔}{121933.333333333358}$ (3)
 • Since the independent data values are uniformly spaced, we can also use the other calling sequence:
 > $\mathrm{IntegrateData2D}\left(Z,'\mathrm{steps}'=\left[\mathrm{dx},\mathrm{dy}\right],'\mathrm{method}'='\mathrm{simpson}'\right)$
 ${121933.333333333358}$ (4)
 • Since Simpson's Method gives the exact answer for such cases, we can compare the result of IntegrateData2D with the expected answer:
 > $\mathrm{β}≔{\mathrm{evalf}}_{15}\left(\mathrm{int}\left(p\left(x,y\right),x=a..b,y=c..d\right)\right)$
 ${\mathrm{\beta }}{≔}{121933.333333333}$ (5)

Example 2

 • Consider the following function:
 > $f≔\left(x,y\right)→{ⅇ}^{\frac{1}{1+{x}^{2}+{y}^{2}}}$
 ${f}{≔}\left({x}{,}{y}\right){↦}{{ⅇ}}^{\frac{{1}}{{1}{+}{{x}}^{{2}}{+}{{y}}^{{2}}}}$ (6)
 > $\mathrm{plot3d}\left(f,0.0..10,0.0..10.0\right)$
 • With a uniform spacing of 1.0, Simpson's Method gives the following:
 > $X≔\mathrm{Vector}\left(\left[\mathrm{seq}\left(0.0..10.0,1.0\right)\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $Y≔X:$
 > $Z≔\mathrm{Matrix}\left(\mathrm{numelems}\left(X\right),\mathrm{numelems}\left(Y\right),\left(i,j\right)→\mathrm{evalhf}\left(f\left({X}_{i},{Y}_{j}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $\mathrm{α}≔\mathrm{IntegrateData2D}\left(X,Y,Z,'\mathrm{method}'='\mathrm{simpson}'\right)$
 ${\mathrm{\alpha }}{≔}{104.150606423932388}$ (7)
 • This approximation for the volume is good, but it could be better, as we can see from integrating the original function:
 > $\mathrm{ξ}≔\mathrm{int}\left(f\left(x,y\right),x=0.0..10.0,y=0.0..10.0,'\mathrm{numeric}','\mathrm{digits}'=15\right)$
 ${\mathrm{\xi }}{≔}{104.263869308879}$ (8)
 > $\mathrm{evalhf}\left(\left|\mathrm{α}-\mathrm{ξ}\right|\right)$
 ${0.113262884946607301}$ (9)
 • From the plot of the dependent data, we can see that more samples for $x$ and $y$ between 0.0 and 3.0 will improve the approximate volume found:
 > $\mathrm{plots}:-\mathrm{matrixplot}\left(Z\right)$
 • Since we have the access to the original function, we have the luxury of being able to sample more densely for smaller $x$ and $y$:
 > $U≔\mathrm{Vector}\left(\left[\mathrm{seq}\left(0.0..3.0,0.01\right),\mathrm{seq}\left(4.0..10.0,1.0\right)\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $V≔U:$
 > $W≔\mathrm{Matrix}\left(\mathrm{numelems}\left(U\right),\mathrm{numelems}\left(V\right),\left(i,j\right)→\mathrm{evalhf}\left(f\left({U}_{i},{V}_{j}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $\mathrm{β}≔\mathrm{IntegrateData2D}\left(U,V,W,'\mathrm{method}'='\mathrm{simpson}'\right)$
 ${\mathrm{\beta }}{≔}{104.264569012844262}$ (10)
 • This approximation is much closer:
 > $\mathrm{evalhf}\left(\left|\mathrm{β}-\mathrm{ξ}\right|\right)$
 ${0.000699703965267417516}$ (11)

Example 3

 • Here, we use the compile option on a simple example to see how long the (one-time only) compilation takes:
 > $m≔3:$
 > $n≔3:$
 > $X≔\left[\mathrm{seq}\left(1..m\right)\right]$
 ${X}{≔}\left[{1}{,}{2}{,}{3}\right]$ (12)
 > $Y≔\left[\mathrm{seq}\left(1..n\right)\right]$
 ${Y}{≔}\left[{1}{,}{2}{,}{3}\right]$ (13)
 > $Z≔\mathrm{Matrix}\left(m,n,\left[\mathrm{seq}\left(1..mn\right)\right]\right)$
 ${Z}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\\ {4}& {5}& {6}\\ {7}& {8}& {9}\end{array}\right]$ (14)
 > $\mathrm{CodeTools}:-\mathrm{Usage}\left(\mathrm{IntegrateData2D}\left(X,Y,Z,'\mathrm{compiled}','\mathrm{method}'='\mathrm{bottomleftcorner}'\right)\right)$
 memory used=27.26MiB, alloc change=0 bytes, cpu time=756.00ms, real time=756.00ms, gc time=0ns
 ${12.}$ (15)

Example 4

 • Consider the following function and box:
 > $f≔\left(x,y\right)→\sqrt{1+\mathrm{sin}\left(\mathrm{Pi}\left({x}^{2}+3{y}^{2}\right)\right)}$
 ${f}{≔}\left({x}{,}{y}\right){↦}\sqrt{{1}{+}{\mathrm{sin}}{}\left({\mathrm{\pi }}{\cdot }\left({{x}}^{{2}}{+}{3}{\cdot }{{y}}^{{2}}\right)\right)}$ (16)
 > $a≔0.0:$
 > $b≔1.0:$
 > $c≔-0.5:$
 > $d≔1.5:$
 > $\mathrm{plot3d}\left(f,a..b,c..d\right)$
 • Now, create a Matrix of sample data points:
 > $m≔1000:$
 > $n≔1000:$
 > $\mathrm{dx}≔\mathrm{evalhf}\left(\frac{b-a}{m-1}\right):$
 > $\mathrm{dy}≔\mathrm{evalhf}\left(\frac{d-c}{n-1}\right):$
 > $Z≔\mathrm{Matrix}\left(m,n,\left(i,j\right)→\mathrm{evalhf}\left(f\left(a+\left(i-1\right)\mathrm{dx},c+\left(j-1\right)\mathrm{dy}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 • Finally, approximate the volume, using two different methods:
 > $u≔\mathrm{CodeTools}:-\mathrm{Usage}\left(\mathrm{IntegrateData2D}\left(Z,'\mathrm{steps}'=\left[\mathrm{dx},\mathrm{dy}\right],'\mathrm{compiled}','\mathrm{method}'='\mathrm{averagecorner}'\right)\right)$
 memory used=7.66MiB, alloc change=7.63MiB, cpu time=34.00ms, real time=34.00ms, gc time=0ns
 ${u}{≔}{2.06220791967658945}$ (17)
 > $v≔\mathrm{CodeTools}:-\mathrm{Usage}\left(\mathrm{IntegrateData2D}\left(Z,'\mathrm{steps}'=\left[\mathrm{dx},\mathrm{dy}\right],'\mathrm{compiled}','\mathrm{method}'='\mathrm{simpson}'\right)\right)$
 memory used=7.66MiB, alloc change=7.63MiB, cpu time=22.00ms, real time=22.00ms, gc time=0ns
 ${v}{≔}{2.06221208164538305}$ (18)
 • Observe that, even though the rtables are fairly large, the time taken to approximate the volume was fairly small, due to the compilation of the internal procedures (which was performed in an earlier example).

Example 5

 • Here, will use unsorted and irregular (not uniform) independent data:
 > $f≔\left(x,y\right)→1.76965408823860471+0.0769328086078387985x-2.65475838418437826y-4.27801178528191528{x}^{2}-6.15468302818204016xy+7.04479517210091011{y}^{2}$
 ${f}{≔}\left({x}{,}{y}\right){↦}{1.76965408823860471}{+}{0.0769328086078387985}{\cdot }{x}{-}{2.65475838418437826}{\cdot }{y}{-}{4.27801178528191528}{\cdot }{{x}}^{{2}}{-}{6.15468302818204016}{\cdot }{y}{\cdot }{x}{+}{7.04479517210091011}{\cdot }{{y}}^{{2}}$ (19)
 > $X≔\mathrm{Array}\left(\left[2.44882197894116,0.934363022771893,3.97599950568532,3.82758394074501,1.90779228546504,0.0,2.19372179828199,0.172230402514544,4.75111024419177,5.0,1.58549740030430,3.47414311487909,4.11728914163646,0.485658906179238,0.230856953155770,1.38461492480445,0.159164231887103,3.53023044009804,0.855933439057809,3.27738945088778\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 ${X}{≔}\left[\begin{array}{cccccccccccccccccccc}{2.44882197894116}& {0.934363022771893}& {3.97599950568532}& {3.82758394074501}& {1.90779228546504}& {0.}& {2.19372179828199}& {0.172230402514544}& {4.75111024419177}& {5.}& {1.58549740030430}& {3.47414311487909}& {4.11728914163646}& {0.485658906179238}& {0.230856953155770}& {1.38461492480445}& {0.159164231887103}& {3.53023044009804}& {0.855933439057809}& {3.27738945088778}\end{array}\right]$ (20)
 > $Y≔\mathrm{Array}\left(\left[6.99076722656686,10.0,5.05957051665142,2.55095115459269,7.51267059305653,2.23811939491137,5.85267750979777,3.40385726666133,9.59743958516081,4.98364051982143,1.18997681558377,1.62611735194631,6.55098003973841,6.79702676853675,0.0,2.76025076998578,7.54686681982361,7.09364830858073,6.46313010111265,4.45586200710899\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 ${Y}{≔}\left[\begin{array}{cccccccccccccccccccc}{6.99076722656686}& {10.}& {5.05957051665142}& {2.55095115459269}& {7.51267059305653}& {2.23811939491137}& {5.85267750979777}& {3.40385726666133}& {9.59743958516081}& {4.98364051982143}& {1.18997681558377}& {1.62611735194631}& {6.55098003973841}& {6.79702676853675}& {0.}& {2.76025076998578}& {7.54686681982361}& {7.09364830858073}& {6.46313010111265}& {4.45586200710899}\end{array}\right]$ (21)
 > $Z≔\mathrm{Array}\left(1..\mathrm{numelems}\left(X\right),1..\mathrm{numelems}\left(Y\right),\left(i,j\right)→\mathrm{evalhf}\left(f\left({X}_{i},{Y}_{j}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right)$
 > $\mathrm{plot3d}\left(f,\mathrm{min}\left(X\right)..\mathrm{max}\left(X\right),\mathrm{min}\left(Y\right)..\mathrm{max}\left(Y\right)\right)$
 • The expected answer, for comparison, is the following:
 > $\mathrm{α}≔{\mathrm{evalf}}_{15}\left(\mathrm{int}\left(f\left(x,y\right),x=\mathrm{min}\left(X\right)..\mathrm{max}\left(X\right),y=\mathrm{min}\left(Y\right)..\mathrm{max}\left(Y\right)\right)\right)$
 ${\mathrm{\alpha }}{≔}{5546.55319312876}$ (22)
 • To approximate the volume, we will use two approaches. For the first approach, just use the sortdata option:
 > $\mathrm{ξ}≔\mathrm{IntegrateData2D}\left(X,Y,Z,'\mathrm{sortdata}'='\mathrm{true}','\mathrm{method}'='\mathrm{simpson}'\right)$
 ${\mathrm{\xi }}{≔}{5546.55319312876418}$ (23)
 • For the second approach, we will manually sort the data:
 > $P≔{\mathrm{sort}}_{'\mathrm{inplace}'}\left(X,'\mathrm{output}'='\mathrm{permutation}'\right):$
 > $Q≔{\mathrm{sort}}_{'\mathrm{inplace}'}\left(Y,'\mathrm{output}'='\mathrm{permutation}'\right):$
 > $Z≔{Z}_{P,Q}:$
 > $\mathrm{zeta}≔\mathrm{IntegrateData2D}\left(X,Y,Z,'\mathrm{sortdata}'='\mathrm{false}','\mathrm{method}'='\mathrm{simpson}'\right)$
 ${\mathrm{ζ}}{≔}{5546.55319312876418}$ (24)

Example 6

 • In this example, we show that IntegrateData2D gives the exact answer when the data is generated by a plane.
 > $\mathrm{φ}≔\left(x,y\right)→5.89801239837002367x+6.33497857715261770y-3.14488365480468168$
 ${\mathrm{\phi }}{≔}\left({x}{,}{y}\right){↦}{5.89801239837002367}{\cdot }{x}{+}{6.33497857715261770}{\cdot }{y}{-}{3.14488365480468168}$ (25)
 > $a≔0.0:$
 > $b≔10.0:$
 > $c≔0.0:$
 > $d≔5.0:$
 > $\mathrm{plot3d}\left(\mathrm{φ},a..b,c..d\right)$
 • For comparison, the int command gives the following:
 > $\mathrm{ν}≔{\mathrm{evalf}}_{15}\left(\mathrm{int}\left(\mathrm{φ}\left(x,y\right),x=a..b,y=c..d\right)\right)$
 ${\mathrm{\nu }}{≔}{2109.13123899635}$ (26)
 • Using IntegrateData2D with sorted regular data:
 > $m≔15:$
 > $n≔20:$
 > $X≔\mathrm{Vector}\left(m,i→\mathrm{evalhf}\left(a+\frac{\left(i-1\right)\left(b-a\right)}{m-1}\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $Y≔\mathrm{Vector}\left(n,j→\mathrm{evalhf}\left(c+\frac{\left(j-1\right)\left(d-c\right)}{n-1}\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $Z≔\mathrm{Matrix}\left(m,n,\left(i,j\right)→\mathrm{evalhf}\left(\mathrm{φ}\left({X}_{i},{Y}_{j}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $\mathrm{α}≔\mathrm{IntegrateData2D}\left(X,Y,Z,'\mathrm{uniform}'='\mathrm{true}','\mathrm{sortdata}'='\mathrm{false}','\mathrm{method}'='\mathrm{averagecorner}'\right)$
 ${\mathrm{\alpha }}{≔}{2109.13123899635002}$ (27)
 • Using IntegrateData2D with sorted irregular data:
 > $U≔\mathrm{Vector}\left(\left[0.0,0.344460805029088,1.86872604554379,3.17099480060861,3.81558457093008,4.38744359656398,4.45586200710899,4.89764395788231,6.46313010111265,6.94828622975817,7.65516788149002,7.95199901137063,8.23457828327293,9.50222048838355,10.0\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $V≔\mathrm{Vector}\left(\left[0.0,0.594988407791883,0.813058675973153,1.11905969745568,1.27547557729635,1.38012538499289,1.70192863333067,2.49182025991071,2.52978525832571,2.92633875489889,3.27549001986920,3.39851338426837,3.49538361328343,3.54682415429036,3.75633529652826,3.77343340991180,4.45451626267899,4.79645712602722,4.79871979258041,5.0\right],'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $W≔\mathrm{Matrix}\left(\mathrm{numelems}\left(U\right),\mathrm{numelems}\left(V\right),\left(i,j\right)→\mathrm{evalhf}\left(\mathrm{φ}\left({U}_{i},{V}_{j}\right)\right),'\mathrm{datatype}'='{\mathrm{float}}_{8}'\right):$
 > $\mathrm{β}≔\mathrm{IntegrateData2D}\left(U,V,W,'\mathrm{uniform}'='\mathrm{false}','\mathrm{sortdata}'='\mathrm{false}','\mathrm{method}'='\mathrm{averagecorner}'\right)$
 ${\mathrm{\beta }}{≔}{2109.13123899634866}$ (28)

Example 7

 • The IntegrateData2D command also works with complex data. Here, we find the volume under ${ⅇ}^{\sqrt{{x}^{2}-1}}$ for $x$ and $y$ in the interval $\left[0,2\right]$:
 > $f≔\left(x,y\right)→{ⅇ}^{\sqrt{{x}^{2}-1}}$
 ${f}{≔}\left({x}{,}{y}\right){↦}{{ⅇ}}^{\sqrt{{{x}}^{{2}}{-}{1}}}$ (29)
 > $a≔0:$
 > $b≔2:$
 > $n≔250:$
 > $h≔\mathrm{evalhf}\left(\frac{b-a}{n-1}\right):$
 > $Z≔\mathrm{Matrix}\left(n,n,\left(i,j\right)→\mathrm{evalhf}\left(f\left(a+\left(i-1\right)h,a+\left(j-1\right)h\right)\right),'\mathrm{datatype}'='{\mathrm{complex}}_{8}'\right):$
 > $v≔\mathrm{IntegrateData2D}\left(Z,'\mathrm{steps}'=\left[h,h\right],'\mathrm{method}'='\mathrm{simpson}'\right)$
 ${v}{≔}{7.74723830751058973}{+}{1.38245111945337396}{}{I}$ (30)

Compatibility

 • The SignalProcessing[IntegrateData2D] command was introduced in Maple 2022.