Overload List
| # | Signature | Description |
|---|---|---|
| 1 | TCplx PolyEval(TCplx Val, TVec Coeff) | Evaluates a polynomial with coefficients Coeff at complex value Val and returns complex results. |
| 2 | void PolyEval(TVec Val, TVec Coeff, TMtx R, Int32 DegFreedom, Double L2R, TVec EvalResult, TVec Delta) | Evaluate a polynomial. |
| 3 | void PolyEval(TVec Val, TVec Coeff, TVec EvalResult) | Evaluates a polynomial with coefficients Coeff at value Val and returns the results in EvalResult. |
| 4 | Double 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.
Returns: TCplx (complex)
Evaluates a polynomial with coefficients Coeff at complex value Val and returns complex results.
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);
}
}
Overload 2: void PolyEval(TVec Val, TVec Coeff, TMtx R, Int32 DegFreedom, Double L2R, TVec EvalResult, TVec Delta)
Evaluate a polynomial.
| # | Name | Description |
|---|---|---|
| 1 | Val | Stores values doe which the polynomial will be evaluated (x values). |
| 2 | Coeff | Stores polynomial coefficients for which the polynomial will be evaaluted. |
| 3 | R | Returns the Cholesky factor of the Vandermonde matrix. |
| 4 | DegFreedom | Returns the residuals degree of freedom. |
| 5 | L2R | Returns the L2 norm of the residuals. |
| 6 | EvalResult | Returns the results P(x), evaluated at Val. |
| 7 | Delta | Returns the error estimates for Results. |
Result: stored in self (calling object)
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.
Result: stored in self (calling object)
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.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | Val | Double | scalar |
| 2 | Coeff | TVec | source TVec |
Returns: Double
Evaluates a polynomial with coefficients Coeff at real value Val and returns real result.