Polynoms.PolyEval Method

Overload List

#SignatureDescription
1function PolyEval(Val: TCplx; Coeff: TVec): TCplx;Evaluates a polynomial with coefficients Coeff at complex value Val and returns complex results.
2procedure PolyEval(Val: TVec; Coeff: TVec; R: TMtx; DegFreedom: Integer; L2R: Double; EvalResult: TVec; Delta: TVec);Evaluate a polynomial.
3procedure PolyEval(Val: TVec; Coeff: TVec; EvalResult: TVec);Evaluates a polynomial with coefficients Coeff at value Val and returns the results in EvalResult.
4function PolyEval(Val: Double; Coeff: TVec): Double;Evaluates a polynomial with coefficients Coeff at real value Val and returns real result.

Overload 1: function PolyEval(Val: TCplx; Coeff: TVec): TCplx;

Evaluates a polynomial with coefficients Coeff at complex value Val and returns complex results.

#NameTypeDescription
1ValTCplxscalar
2CoeffTVecsource TVec

Returns: TCplx (complex)

Remarks:

Evaluates a polynomial with coefficients Coeff at complex value Val and returns complex results.

See Also: Polynoms.PolyFit, TPiecePoly

Overload 2: procedure PolyEval(Val: TVec; Coeff: TVec; R: TMtx; DegFreedom: Integer; L2R: Double; EvalResult: TVec; Delta: TVec);

Evaluate a polynomial.

#NameDescription
1ValStores values doe which the polynomial will be evaluated (x values).
2CoeffStores polynomial coefficients for which the polynomial will be evaaluted.
3RReturns the Cholesky factor of the Vandermonde matrix.
4DegFreedomReturns the residuals degree of freedom.
5L2RReturns the L2 norm of the residuals.
6EvalResultReturns the results P(x), evaluated at Val.
7DeltaReturns the error estimates for Results.

Result: stored in self (calling object)

Remarks:

Evaluate a polynomial with coefficients Coeff at value Val. The order of polynomial (N) is determined as: N := Coeff.Length - 1. The algorithm employed uses Horners rule. The following formula is used to evaluate the polynomial:

P(x) = coeff[0]*x^n + coeff[1]*x^(n-1) + .. + coeff[n]

To estimate the error of polynomial interpolation after a call to Polynoms.PolyFit additional parameters have to be passed to the routine.

Examples
uses MtxExpr, Math387, MtxVec, MtxVecEdit, MtxVecTee,Polynoms;

procedure TForm1.Button1Click(Sender: TObject);
var X, Y, Coeff: Vector;
begin
    X := Ramp(10,-5,1); // X = [-5,-4,-3,-2,-1, 0, 1, 2, 3, 4]

    // construct a parabola

    Coeff.SetIt(false,[2, -1, 3]);
    PolyEval(X,Coeff,Y);

    // Y now holds the values of polynomial, evaluated at all X.Values

    DrawIt(X,Y,'Parabola');
end;

Overload 3: procedure PolyEval(Val: TVec; Coeff: TVec; EvalResult: TVec);

Evaluates a polynomial with coefficients Coeff at value Val and returns the results in EvalResult.

#NameTypeDescription
1ValTVecsource TVec
2CoeffTVecsource TVec
3EvalResultTVecsource TVec

Result: stored in self (calling object)

Remarks:

Evaluates a polynomial with coefficients Coeff at value Val and returns the results in EvalResult.

Overload 4: function PolyEval(Val: Double; Coeff: TVec): Double;

Evaluates a polynomial with coefficients Coeff at real value Val and returns real result.

#NameTypeDescription
1ValDoublescalar
2CoeffTVecsource TVec

Returns: Double

Remarks:

Evaluates a polynomial with coefficients Coeff at real value Val and returns real result.