Polynoms.PolyCoeff Method

Overload List

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

Overload 1: procedure PolyCoeff(Mtx: TMtx; Coeff: TVec);

Returns coefficients of the characteristic polynomial.

#NameTypeDescription
1MtxTMtxsource TMtx
2CoeffTVecsource TVec

Result: stored in self (calling object)

Remarks:

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

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

var Coeff: Vector;
A: Matrix;
begin
    A.SetIt(3,3,false,[1,  4, -1,
    2,  1,  5,
    3, -2,  0]);
    PolyCoeff(A,Coeff);
    ViewValues(Coeff,'Coefficients');
end;
See Also: Polynoms.PolyRoots

Overload 2: procedure PolyCoeff(Roots: TVec; Coeff: TVec);

Converts polynomial roots to coefficients.

#NameTypeDescription
1RootsTVecsource TVec
2CoeffTVecsource TVec

Result: stored in self (calling object)

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
uses MtxExpr, Math387, MtxVec, MtxVecEdit, Polynoms;

procedure TForm1.Button1Click(Sender: TObject);
var Roots, Coeff: Vector;
begin
    // roots of the polynomial: (x - 1)*(x - 1)*(x - 2)

    Roots.SetIt(false,[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

    ViewValues(Coeff,'Coefficients');
end;