# Singular

#### D.8.3.4 mp_res_mat

Procedure from library `solve.lib` (see solve_lib).

Usage:
mp_res_mat(i [, k] ); i ideal, k integer,
k=0: sparse resultant matrix of Gelfand, Kapranov and Zelevinsky,
k=1: resultant matrix of Macaulay (k=0 is default)

Assume:
The number of elements in the input system must be the number of variables in the basering plus one;
if k=1 then i must be homogeneous.

Return:
module representing the multipolynomial resultant matrix

Example:
 ```LIB "solve.lib"; // compute resultant matrix in ring with parameters (sparse resultant matrix) ring rsq= (0,u0,u1,u2),(x1,x2),lp; ideal i= u0+u1*x1+u2*x2,x1^2 + x2^2 - 10,x1^2 + x1*x2 + 2*x2^2 - 16; module m = mp_res_mat(i); print(m); ==> -16,0, -10,0, (u0),0, 0, 0, 0, 0, ==> 0, -16,0, -10,(u2),(u0),0, 0, 0, 0, ==> 2, 0, 1, 0, 0, (u2),0, 0, 0, 0, ==> 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, ==> 0, 0, 0, 0, (u1),0, -10,(u0),0, -16, ==> 1, 0, 0, 0, 0, (u1),0, (u2),(u0),0, ==> 0, 1, 0, 0, 0, 0, 1, 0, (u2),2, ==> 1, 0, 1, 0, 0, 0, 0, (u1),0, 0, ==> 0, 1, 0, 1, 0, 0, 0, 0, (u1),1, ==> 0, 0, 0, 0, 0, 0, 1, 0, 0, 1 // computing sparse resultant det(m); ==> (-2*u0^4+18*u0^2*u1^2+4*u0^2*u1*u2+22*u0^2*u2^2-16*u1^4+80*u1^3*u2-52*u1^\ 2*u2^2-120*u1*u2^3-36*u2^4) // compute resultant matrix (Macaulay resultant matrix) ring rdq= (0,u0,u1,u2),(x0,x1,x2),lp; ideal h= homog(imap(rsq,i),x0); h; ==> h[1]=(u0)*x0+(u1)*x1+(u2)*x2 ==> h[2]=-10*x0^2+x1^2+x2^2 ==> h[3]=-16*x0^2+x1^2+x1*x2+2*x2^2 module m = mp_res_mat(h,1); print(m); ==> x0, x1, x2, 0, 0, 0, 0,0, 0, 0, ==> 0, x0, 0, x1,x2,0, 0,0, 0, 0, ==> 0, 0, x0, 0, x1,x2,0,0, 0, 0, ==> -10,0, 0, 1, 0, 1, 0,0, 0, 0, ==> 0, 0, 0, 0, x0,0, 0,x1,x2,0, ==> -16,0, 0, 1, 1, 2, 0,0, 0, 0, ==> 0, -10,0, 0, 0, 0, 1,0, 1, 0, ==> 0, 0, -10,0, 0, 0, 0,1, 0, 1, ==> 0, -16,0, 0, 0, 0, 1,1, 2, 0, ==> 0, 0, -16,0, 0, 0, 0,1, 1, 2 // computing Macaulay resultant (should be the same as above!) det(m); ==> 2*x0^4-18*x0^2*x1^2-4*x0^2*x1*x2-22*x0^2*x2^2+16*x1^4-80*x1^3*x2+52*x1^2*\ x2^2+120*x1*x2^3+36*x2^4 // compute numerical sparse resultant matrix setring rsq; ideal ir= 15+2*x1+5*x2,x1^2 + x2^2 - 10,x1^2 + x1*x2 + 2*x2^2 - 16; module mn = mp_res_mat(ir); print(mn); ==> 15,0, -10,0, 0, 0, 0, -16,0, 0, ==> 5, 15,0, -10,0, 0, 0, 0, -16,0, ==> 0, 5, 1, 0, 0, 0, 0, 2, 0, 0, ==> 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, ==> 2, 0, 0, 0, 15,0, -10,0, 0, -16, ==> 0, 2, 0, 0, 5, 15,0, 1, 0, 0, ==> 0, 0, 0, 0, 0, 5, 1, 0, 1, 2, ==> 0, 0, 1, 0, 2, 0, 0, 1, 0, 0, ==> 0, 0, 0, 1, 0, 2, 0, 0, 1, 1, ==> 0, 0, 0, 0, 0, 0, 1, 0, 0, 1 // computing sparse resultant det(mn); ==> -7056 ```