1

I have a uniform 2D grid of points which represents some unknown function. I wish to normalise the function s.t. it integrates to 1.

Is there some method which is best suited for this problem? I had been numerically integrating using the trapezium rule and dividing by the volume.

Mike Miller
  • 2,453

1 Answers1

1

Sadly, there is no general solution to this problem.

You need to commit to a model, and tune the model parameters to suit the known points.

If there is no noise involved and the points are not shaped in an easily recognizable shape then I would use the lowest polynomial fit that passes through all the points and use the integral of that as an approximation of the wanted integral.

Your approach is also sensible, though it will only work reasonably if there is a high volume of points.

If the approximation is important then you can also try writing a program which generates fits using different combinations of typical functions (in the Wolfram Language this is somewhat easy to achieve) and pick the function which fits with the lowest complexity (where complexity can be measured in number and weirdness of terms or similar. Again, in Wolfram Language there are facilities for this).

Jsevillamol
  • 4,668
  • 2
    A full polynomial fit typically has very poor performance. Local fits are essential except in very specific situations (e.g. periodic signals). – Ian Sep 19 '16 at 11:59
  • @Ian I would be inclined to agree if there was noise involved. But if the samples are perfect, then all the weird stuff that a full polynomial fit may do is justified IMHO. I am interested in you expanding your comment about local fits if you have a better insight. – Jsevillamol Sep 19 '16 at 12:09
  • @Ian Jsevillamol My problem is that I'm solving a PDE which requires 2 functions to have the same volume. Both functions are represented by 28 x 28 grids - but my results are slightly worse than I expected (using trapezium) and I suspect it is down to my normalisation. Could you possibly make a suggestion in this case? – Mike Miller Sep 19 '16 at 12:09
  • 2
    @Jsevillamol When I say local fits, I mean fitting your data to a piecewise function, such as a piecewise linear or piecewise cubic function. The other common alternative is inexact fits (which is a natural choice in the presence of noise). Global fits tend to create qualitatively wrong behavior, like large amplitude "oscillation" in between grid points that shouldn't be there. Runge's phenomenon (i.e. the very poor performance which occurs when performing polynomial interpolation on $\frac{1}{x^2+1}$ on a large interval centered at zero using a uniform mesh) is one example of this. – Ian Sep 19 '16 at 12:18
  • @Ian Thanks - this was very useful, as was your answer Jsevillamol :) – Mike Miller Sep 19 '16 at 13:48