uses MtxExpr,
Math387,
MtxVec, MtxVecEdit,
Polynoms;
procedure TForm42.Button1Click(Sender: TObject);
var Coeff, Roots: Vector;
begin
// coefficients of the polynomial 1*x^2 - 2*x + 1:
Coeff.SetIt(false,[1, -2, 1]);
PolyRoots(Roots,Coeff);
// Roots now hold the roots of the polynomial = [ 1, 1 ]
// x^2 - 2x + 1 = (x - 1) * (x - 1)
ViewValues(Roots,'Roots');
end;
#include "MtxExpr.hpp"
#include "Polynoms.hpp"
#include "MtxVecTee.hpp"
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
sVector Coeff, Roots;
// coefficients of the polynomial 1*x^2 - 2*x + 1
Coeff.SetIt(false,OPENARRAY(double,{1, -2, 1}));
PolyRoots(Roots,Coeff);
// Roots now hold the roots of the polynomial = [ 1, 1 ]
// x^2 - 2x + 1 = (x - 1) * (x - 1)
ViewValues(Roots,"Roots");
}