Polynoms.PolyEval Method

Overload List

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

Overload 1: TCplx PolyEval(TCplx Val, TVec Coeff)

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.

Examples
using Dew.Math;
using Dew.Math.Units;
using Dew.Math.Tee;

namespace Dew.Examples
{
    private void Example()
    {
        Vector X = new Vector(0);
        Vector Y = new Vector(0);
        Vector Coeff = new Vector(0);

        X.Size(10);
        X.Ramp(-5,1); // X = [-5,-4,-3,-2,-1, 0, 1, 2, 3, 4]
        // construct a parabola
        Coeff.SetIt(false,new double[] {2, -1, 3});
        Polynoms.PolyEval(X,Coeff,Y);

        // Y now holds the values of polynomial, evaluated at all X.Values
        MtxVecTee.DrawIt(X,Y,"Parabola",false);
    }
}
See Also: Polynoms.PolyFit, TPiecePoly

Overload 2: void PolyEval(TVec Val, TVec Coeff, TMtx R, Int32 DegFreedom, Double L2R, TVec EvalResult, TVec Delta)

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 Dew.Math.Units.Polynoms.PolyFit additional parameters have to be passed to the routine.

Overload 3: void PolyEval(TVec Val, TVec Coeff, TVec EvalResult)

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: Double PolyEval(Double Val, TVec Coeff)

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.