plant icon indicating copy to clipboard operation
plant copied to clipboard

Integrate between specified heights

Open dfalster opened this issue 2 years ago • 0 comments

When calculating outputs from the size distribution, we will often want to specify the bounds of the integrals. While we can use a trapezoidal integration across the heights specified by the solver characteristics (previously called cohort boundaries), it's unlikely the heights of the solver correspond to the desired integral boundaries.

Suggested method is to

  1. Create an interpolator
  2. Interpolate to desired points (including boundaries of the integral). Could be finer than original points, which would improve accuracy if the curvature of the spline approximation reflects true non-linearities.
  3. Integrate between these, e.g. using trapezoidal integration.

Note, with spline interpolators the integral can b calculated analytically between knots (https://stackoverflow.com/questions/51540182/how-to-save-and-load-spline-interpolation-functions-in-r).

dfalster avatar Nov 08 '21 04:11 dfalster