User inputs the multipolynomial
>fnArray := eval(array(1 .. 2,[x^2+6*x+3*y-4, y^2+2*x-7*y+5]));
fnArray := [x^2 + 6 x + 3 y - 4, y^2 + 2 x - 7 y + 5]
User inputs the variables he wants hidden
>varArray := array(1 .. 1,[x]);
varArray := [x]
User calls Bezout function (to compute the Bezout formulation resultant) with the multipolynomial, the desired hidden variables, and the unhidden variable
> read(`bezout.map`);
...
> q := Bezout(eval(fnArray),eval(varArray),y);
q := [[x^2 + 6 x + 3 y - 4, y^2 + 2 x - 7 y + 5], [x], y, [[2, 1, 1, 1]], [[48 y - 38 - 6 y^2,-5 - y^2 + 7 y],[ -5 - y^2 + 7 y, -2 ]],, [1, x], 0, 0, 0, 0]
User calls resultantCCode function to generate C code for numerically solving the multipolynomial system
> resultantCCode(q);
void fn1 (complex *vars, complex *rslt)
{
double t0;
double y , x ;
y = vars[0].real;
x =vars[ 1 ].real;
rslt->imag = 0;
t0 = x*x+6.0*x+3.0*y-4.0;
rslt->real = t0;
}
void fn2 (complex *vars, complex *rslt)
{
double t0;
double y , x ;
y = vars[0].real;
x =vars[ 1 ].real;
rslt->imag = 0;
t0 = y*y+2.0*x-7.0*y+5.0;
rslt->real = t0;
}
void testSolveSystem()
{
int i,j,k;
resultant resultant;
cmatrix *solns;
double t0;
int extractionRecipe[ 1 ][4] = { { 2 , 1 , 1 , 1 }, };
int *extractionRecipePtrs[ 1 ];
void ((*fn[ 2 ])(complex *, complex *)) = { fn1 , fn2 , };
for (i = 0; i < 1 ;++i) extractionRecipePtrs[i] = &extractionRecipe[i][0];
resultant.uDim = 0 ;
resultant.numVars = 1 ;
resultant.extractionRecipe = extractionRecipePtrs;
resultant.fn = fn;
resultant.matPoly = zerosMatrixPolynomial( 2 /*maxDegree*/, 2 /*size*/);
t0 = -38.0;
resultant.matPoly->matPoly[ 0 ]->mat[ 0 ][ 0 ] = t0;
t0 = 48.0;
resultant.matPoly->matPoly[ 1 ]->mat[ 0 ][ 0 ] = t0;
t0 = -6.0;
resultant.matPoly->matPoly[ 2 ]->mat[ 0 ][ 0 ] = t0;
t0 = -5.0;
resultant.matPoly->matPoly[ 0 ]->mat[ 0 ][ 1 ] = t0;
t0 = 7.0;
resultant.matPoly->matPoly[ 1 ]->mat[ 0 ][ 1 ] = t0;
t0 = -1.0;
resultant.matPoly->matPoly[ 2 ]->mat[ 0 ][ 1 ] = t0;
t0 = -5.0;
resultant.matPoly->matPoly[ 0 ]->mat[ 1 ][ 0 ] = t0;
t0 = 7.0;
resultant.matPoly->matPoly[ 1 ]->mat[ 1 ][ 0 ] = t0;
t0 = -1.0;
resultant.matPoly->matPoly[ 2 ]->mat[ 1 ][ 0 ] = t0;
t0 = -2.0;
resultant.matPoly->matPoly[ 0 ]->mat[ 1 ][ 1 ] = t0;
solns = zerosCMatrix(1,1);
solveResultant(&resultant,solns,0);
printCMatrix(solns);
}