I have a set of data {x_i,y_i,z_i} organized as 3-member sublists in a large (~4000 sublists) list. The z_i are functions of (x_i,y_i): z_i = f(x_i,y_i), but the function f is known only numerically. I want to bin the x_i values into prescribed, not necessarily equal length, bins, integrate over x in each of these bins and then plot within each bin z as a function of y. I tried to to this by first using Interpolations on the 2D function, but that failed with an error message because the points (x,y) were not regularly spaced. How can I do that in a clever way?

  • $\begingroup$ You have to provide more details. What are the "prescribed bins"? See HistogramList? Once you have the binned points, you could Interpolate your function in each bin, then use NIntegrate on the InterpolatingFunction you obtain. $\endgroup$ – MarcoB Jun 29 at 19:31
  • $\begingroup$ I tried to do Interpolate on the original data and then work with that InterpolatingFunction, but that did not work. Mathematica complained that the grid was unstructured and the quality of the underlying mesh is too low. By 'prescribed bins' I simply meant bins that were not regularly space and not even of equal width. Center points of these bins and width are to be provided as input. $\endgroup$ – user3584513 Jun 30 at 9:14
  • $\begingroup$ You say that you have a function $f(x, y)$ but also that you have triples $(x, y, z)$. Just to be clear, you have a function $f(x, y)$ that you know and can compute for any $(x, y)$, not just the ones in the list? $\endgroup$ – C. E. Jun 30 at 12:43
  • $\begingroup$ NO, I do not know the function f(x,y); the z-values are the function values, i.e. z = f(x,y), the function f is thus known only numerically. $\endgroup$ – user3584513 Jul 1 at 8:09