Polynoms::PolyCoeff Function

Overload List

#SignatureDescription
1void PolyCoeff(TVec *Roots, TVec *Coeff);Converts polynomial roots to coefficients.
2void PolyCoeff(TMtx *Mtx, TVec *Coeff);Returns coefficients of the characteristic polynomial.

Overload 1: void PolyCoeff(TVec *Roots, TVec *Coeff);

Converts polynomial roots to coefficients.

#NameTypeDescription
1RootsTVec *
2CoeffTVec *
Remarks:

The PolyCoeff procedure converts polynomial roots to coefficients. The following scheme is used to construct a coefficients from the roots:

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

n .. order of the polynomial

The length and complex property of the Coeff object are set automatically. The inverse to this routine is Polynoms::PolyRoots

Examples
#include "MtxExpr.h"
#include "Units.Polynoms.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::Polynoms;

void Example()
{
    Vector Roots, Coeff;
    // roots of the polynomial: (x - 1)*(x - 1)*(x - 2)

    Roots.SetIt(false, DewArray<double>{1, 1, 2});
    PolyCoeff(Roots, Coeff);

    // Coeff returns the coefficients of the polynomial [ 1,-4, 5,-2]
    // which can be written as:  1*x^3 + -4*x^2 + 5*x - 2
}
Declared in Dew::Math::Units::Polynoms · Dew.Math/Units.Polynoms.h · Cross-compiler

Overload 2: void PolyCoeff(TMtx *Mtx, TVec *Coeff);

Returns coefficients of the characteristic polynomial.

#NameTypeDescription
1MtxTMtx *
2CoeffTVec *
Remarks:

Returns coefficients of the characteristic polynomial: det( Mtx - Lambda * I ).

Examples
#include "MtxExpr.h"
#include "Units.Polynoms.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units;

void Example()
{
    Vector Coeff(0);
    Matrix A(0, 0);
    A.SetIt(3, 3, false, DewArray<double>{1,  4, -1,
        2,  1,  5,
        3, -2,  0});
    Polynoms::PolyCoeff(A, Coeff);
}
See Also: Polynoms::PolyRoots
Declared in Dew::Math::Units::Polynoms · Dew.Math/Units.Polynoms.h · Cross-compiler