|
D.7.2.3 laguerre_solve
Procedure from library solve.lib (see solve_lib).
- Usage:
- laguerre_solve(p [, l, m] ); f=polynomial, l,m=integers,
l>0: defines precision of fractional part if ground field is Q,
m=0,1,2: number of iterations for approximation of roots,
(default: l,m=30,2)
- Assume:
- the ground field has char 0;
p is an univariate polynom
- Return:
- list of all (complex) roots of the polynomial p;
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";
// Find all roots of an univariate polynomial using Laguerre's method:
ring rs1= 0,(x,y),lp;
poly f = 15x5 + x3 + x2 - 10;
// 10 digits precision
laguerre_solve(f,10);
==> [1]:
==> (0.2930464644-I*0.9003002396)
==> [2]:
==> (0.2930464644+I*0.9003002396)
==> [3]:
==> (-0.7392783383-I*0.5355190078)
==> [4]:
==> (-0.7392783383+I*0.5355190078)
==> [5]:
==> 0.8924637479
// Now with complex coefficients, precision is 10 digits:
ring rsc= (real,10,I),x,lp;
poly f = (15.4+I*5)*x^5 + (25.0e-2+I*2)*x^3 + x2 - 10*I;
list l = laguerre_solve(f);
l;
==> [1]:
==> (0.04588498039+I*0.9133296179)
==> [2]:
==> (0.5037408279-I*0.8058051828)
==> [3]:
==> (-0.5462895588-I*0.6796668873)
==> [4]:
==> (0.8524014357+I*0.2163760334)
==> [5]:
==> (-0.8557376852+I*0.3557664188)
// check result, value of substituted poly should be near to zero
subst(f,x,l[1]);
==> 0
subst(f,x,l[2]);
==> -0.0000000003610704595
|
|