finesse.knm.integrators.composite_newton_cotes_weights¶
- finesse.knm.integrators.composite_newton_cotes_weights(N, order)¶
Constructs the weights for a composite Newton-Cotes rule for integration along 1-dimensional line with equally spaced steps. Newton-Cotes are a generalisation of a various discrete integration methods that are approximating an integrated by some polynomial. Common methods are:
N = 0 : Riemann sum N = 1 : Trapezoid rule N = 2 : Simpsons rule N = 4 : Simpsons 3/8 rule
Approximating a large bound with a high order polynomial can be numerically problematic. Thus a composite rule is generated by subdividing a larger area into multiple chunks and applying each rule along it.
If the order Newton-Cotes order specified does not produce a rule that fits into N, the order is decremented and that is used to fill gaps that do no fit.
See https://mathworld.wolfram.com/Newton-CotesFormulas.html
- Parameters:
- Ninteger >= 0
1D size of array being ingrated over
- orderinteger >= 0
Order of Newton-Cotes rule to use
- Returns:
- weightsarray
Array of weights to multiply data with before summing