MtxIntDiff.WeightsNewtonCotes Method

procedure WeightsNewtonCotes(PolyOrder: Integer; const Points: TVec; const Weights: TVec; const FloatPrecision: TMtxFloatPrecision);

Newton-Cotes base points and weights.

#NameDescription
1PolyOrderDefines the interpolating polynomial order.
2PointsReturns base points coordinate.
3WeightsReturns weights.
4FloatPrecisionSpecifies the precision of the weights to be returned.

Result: stored in self (calling object)

Remarks:

Uses the Newton-Cotes formulas to calculate base points and weights for numerical integration. Check the following link to learn more about Newton-Cotes formulas.

Examples
// Integrating function
function IntFunc(const Parameters: TVec; const Constants: TVec; const ObjConst: Array of TObject): double;
var x: double;
begin
    x := Parameters[0];
    IntFunc := Sin(x);
end;
// Integrate
procedure DoIntegrate;
var bpoints,weights: Vector;
area: double;
begin
    WeightsNewtonCotes(2,bpoints,weights); // 2 means Simpson
    area := QuadGauss(IntFunc,0,PI,bpoints,weights,1);
end;
See Also: MtxIntDiff.WeightsChebyshevGauss, MtxIntDiff.WeightsGauss