You are here: Symbol Reference > Polynoms Namespace > Functions > Polynoms.DeConv Function
MtxVec VCL
ContentsIndex
Example

Below are two cases. In the first case the following division is performed. 

 

(x - 1) * (x - 2) * (x - 2) -------------------------------- = (x - 1) * (x - 2) 1*x^3 - 5*x^2 + 8x - 4 -------------------------- = x - 2 x^2 - 3x + 2

 

For the first example the ratio is x-1, and the reminder is zero. The second case demonstrates that division can be done also for complex polynomials giving complex result and reminder.

uses MtxExpr, Math387, MtxVec, MtxVecEdit, MtxVecTee,Polynoms; procedure TForm1.Button1Click(Sender: TObject); var A, B, AR, BR, Q, R: Vector; begin // Case 1 Ar.SetIt(false,[1,2]); // Define roots of the polynomial A: PolyCoeff(Ar,A); // get coefficients = (X - 1)* (X - 2) Br.SetIt(false,[1,2,2]); // Define roots of the polynomial B: PolyCoeff(Br,B); //get coefficents = (X - 1)* (X - 2) * (X - 2) DeConv(B,A,Q,R); // Q = [ 1, -2 ] // = polynomial: x - 2 // R = [ 0 ] ViewValues(Q,'Q',true); ViewValues(R,'R',true); // Case 2 B.SetIt(true,[2,-1, 2,3, 0,5]); A.SetIt(true,[0,2, 1,-3, 2,2]); DeConv(B,A,Q,R); // Q = [ -0.5 - i ] // R = [ 0 , 5.5 + 2.5i, -1 + 8i] ViewValues(Q,'Q',true); ViewValues(R,'R',true); end;

 

#include "MtxExpr.hpp" #include "Polynoms.hpp" #include "MtxVecTee.hpp" #include "MtxVecEdit.hpp" void __fastcall TForm1::BitBtn1Click(TObject *Sender) { sVector A, B, Ar, Br, Q, R; // Case 1 Ar.SetIt(false,OPENARRAY(double,(1,2))); // Define roots of the polynomial A: PolyCoeff(Ar,A); // get coefficients = (X - 1)* (X - 2) Br.SetIt(false,OPENARRAY(double,(1,2,2))); // Define roots of the polynomial B: PolyCoeff(Br,B); //get coefficents = (X - 1)* (X - 2) * (X - 2) DeConv(B,A,Q,R); // Q = [ 1, -2 ] // R = [ 0 ] ViewValues(Q,"Q",true); ViewValues(R,"R",true); // Case 2 B.SetIt(true,OPENARRAY(double,(2,-1, 2,3, 0,5))); A.SetIt(true,OPENARRAY(double,(0,2, 1,-3, 2,2))); DeConv(B,A,Q,R); // Q = [ -0.5 - i ] // R = [ 0 , 5.5 + 2.5i, -1 + 8i] ViewValues(Q,"Q",true); ViewValues(R,"R",true); }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.