Open clamydo opened 4 years ago
In GitLab by @fkjogu on Apr 25, 2017, 19:59
This might be also import in conjunktion with Simpson's integral rule, since it also does a cell averageing.
How wrong it can be, can be seen bei a delta peak distribution, where there is a 33 % error with simpsons rule. Python code to reproduce
n = 101
h = 2*np.pi / n
f = np.zeros(n)
f[51] = 1 / h
simps(f, dx=h)
Expect 1.0
but get 1.33333
.
Whereas
n = 101
h = 2*np.pi / n
f = np.zeros(n)
f[51] = 1 / h * 0.5
f[50] = 1 / h * 0.25
f[52] = 1 / h * 0.25
simps(f, dx=h)
produces the expected result.
In GitLab by @fkjogu on Apr 25, 2017, 20:03
assigned to @fkjogu
In GitLab by @fkjogu on Apr 28, 2017, 08:45
The binning leads especially to problems at extrema of the function sampled. At maxima the function value is underestimated. Using neighboring bins for better estimation similar to Simpson's rule for integration. As mentioned before, every method of sampling needs a corresponding method of integration in order to conserve normalisation properties of the distribution numerically.
In GitLab by @fkjogu on Nov 25, 2016, 15:49
The histogram algorithm simply counts, how many particles are in one grid cell and assign them to the cell center. To smoothen the discrete nature a bit, a weighted assignment to neighboring cells could be used.
Details
missing