source:
git/Tst/Manual/laguerre_solve.tst
@
894057
Last change on this file since 894057 was 894057, checked in by , 13 years ago | |
---|---|
|
|
File size: 624 bytes |
Line | |
---|---|
1 | LIB "tst.lib"; tst_init(); |
2 | LIB "solve.lib"; |
3 | // Find all roots of an univariate polynomial using Laguerre's method: |
4 | ring rs1= 0,(x,y),lp; |
5 | poly f = 15x5 + x3 + x2 - 10; |
6 | // 10 digits precision |
7 | laguerre_solve(f,10); |
8 | // Now with complex coefficients, |
9 | // internal precision is 30 digits (default) |
10 | printlevel=2; |
11 | ring rsc= (real,10,i),x,lp; |
12 | poly f = (15.4+i*5)*x^5 + (25.0e-2+i*2)*x^3 + x2 - 10*i; |
13 | list l = laguerre_solve(f); |
14 | l; |
15 | // check result, value of substituted polynomial should be near to zero |
16 | // remember that l contains a list of strings |
17 | // in the case of a different ring |
18 | subst(f,x,l[1]); |
19 | subst(f,x,l[2]); |
20 | tst_status(1);$ |
Note: See TracBrowser
for help on using the repository browser.