|
D.7.2.1 ures_solve
Procedure from library solve.lib (see solve_lib).
- Usage:
- ures_solve(i [, k, p, m] ); i=ideal, k,l,m=integers,
k=0: use sparse resultant matrix of Gelfand, Kapranov and Zelevinsky,
k=1: use resultant matrix of Macaulay,
p>0: defines precision of fractional part if ground field is Q,
m=0,1,2: number of iterations for approximation of roots,
(default: k,p,m=0,30,2)
- Assume:
- the ground field has char 0;
i is a zerodimensional ideal with
nvars(basering) = ncols(i) = number of vars actually occuring in i
- Return:
- list of all (complex) roots of the polynomial system i = 0;
the result is
| of type number: if the ground field are the complex numbers,
of type string: if the ground field are the rational or real numbers
|
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,8);
==> [1]:
==> [1]:
==> 1
==> [2]:
==> -3
==> [2]:
==> [1]:
==> -1
==> [2]:
==> 3
==> [3]:
==> [1]:
==> 2.82842712
==> [2]:
==> 1.41421356
==> [4]:
==> [1]:
==> -2.82842712
==> [2]:
==> -1.41421356
// result is a list (x,y)-coordinates as strings
// now with complex coefficient field, precision is 10 digits
ring rsc= (real,10,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);
==> // ** rootArranger::arrange: No match? coord 0, root 0.
==> // ** rootArranger::arrange: No match? coord 0, root 1.
==> // ** rootArranger::arrange: No match? coord 0, root 2.
==> // ** rootArranger::arrange: No match? coord 0, root 3.
// result is a list of (x,y)-coordinates of complex numbers
l;
==> [1]:
==> [1]:
==> (1.31539291-I*0.7046823061)
==> [2]:
==> (0.09200663959+I*0.2090211204)
==> [2]:
==> [1]:
==> (-1.3153929106+I*0.7046823062)
==> [2]:
==> (-0.09200663959-I*0.2090211204)
==> [3]:
==> [1]:
==> (-1.3158458643+I*0.7039675583)
==> [2]:
==> (-0.1229264654-I*0.192457274)
==> [4]:
==> [1]:
==> (1.3158458645-I*0.7039675584)
==> [2]:
==> (0.1229264654+I*0.192457274)
// check the result
subst(subst(i[1],x,l[1][1]),y,l[1][2]);
==> (-0.000669441281-I*0.009081511946)
|
|