|
D.7.2.3 ures_solve
Procedure from library solve.lib (see solve_lib).
- Usage:
- ures_solve(i [, k, p] ); i = ideal, k, p = integers
| k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky,
k=1: use resultant matrix of Macaulay which works only for
homogeneous ideals,
p>0: defines precision of the long floats for internal computation
if the basering is not complex (in decimal digits),
(default: k=0, p=30)
|
- Assume:
- i is a zerodimensional ideal with
nvars(basering) = ncols(i) = number of vars
actually occurring in i,
- Return:
- list of all (complex) roots of the polynomial system i = 0; the
result is of type
| string: if the basering is not complex,
number: otherwise.
|
Example:
| LIB "solve.lib";
// compute the intersection points of two curves
ring rsq = 0,(x,y),lp;
ideal gls= x2 + y2 - 10, x2 + xy + 2y2 - 16;
ures_solve(gls,0,16);
==> [1]:
==> [1]:
==> 1
==> [2]:
==> -3
==> [2]:
==> [1]:
==> -1
==> [2]:
==> 3
==> [3]:
==> [1]:
==> 2.82842712474619
==> [2]:
==> 1.414213562373095
==> [4]:
==> [1]:
==> -2.82842712474619
==> [2]:
==> -1.414213562373095
// result is a list (x,y)-coordinates as strings
// now with complex coefficient field, precision is 20 digits
ring rsc= (real,20,I),(x,y),lp;
ideal i = (2+3*I)*x2 + (0.35+I*45.0e-2)*y2 - 8, x2 + xy + (42.7)*y2;
list l= ures_solve(i,0,10);
// result is a list of (x,y)-coordinates of complex numbers
l;
==> [1]:
==> [1]:
==> (-1.315392899374542198+I*0.70468233142752928117)
==> [2]:
==> (0.12292646536251281054+I*0.19245727404407015049)
==> [2]:
==> [1]:
==> (1.315392899374542198-I*0.70468233142752928117)
==> [2]:
==> (-0.12292646536251281054-I*0.19245727404407015049)
==> [3]:
==> [1]:
==> (1.31584587549391830705-I*0.70396753310002259573)
==> [2]:
==> (0.092006639590217681983+I*0.20902112035965287775)
==> [4]:
==> [1]:
==> (-1.31584587549391830705+I*0.70396753310002259573)
==> [2]:
==> (-0.092006639590217681983-I*0.20902112035965287775)
// check the result
subst(subst(i[1],x,l[1][1]),y,l[1][2]);
==> 0
|
|