MtxIntDiff.WeightsNewtonCotes Method

void WeightsNewtonCotes(Int32 PolyOrder, TVec Points, TVec Weights, TMtxFloatPrecision FloatPrecision)

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
private double IntFunc(TVec Parameters, TVec c, params object[] o)
{
    double x = Parameters[0];
    return System.Math.Sin(x);
}
// Integrate
private void DoIntegrate()
{
    Vector bpoints = new Vector(0);
    Vector weights = new Vector(0);
    MtxIntDiff.WeightsNewtonCotes(2,bpoints,weights); // 2 means Simpson
    double area = QuadGauss(IntFunc,0,System.Math.PI,bpoints,weights,1);
}
See Also: MtxIntDiff.WeightsChebyshevGauss, MtxIntDiff.WeightsGauss