1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#define DEG 64
#include <cassert>
#include <cstdlib>
//#include <fstream>
#include <iostream>
#include <kratpoly.h>
#include <root1.h>
using namespace std;
int main(int argc, char* argv[])
{
// ifstream in_file;
// ofstream out_file;
unsigned long i;
long t;
K_RATPOLY P, Q;
P = K_RATPOLY(1, 0, 1);
for (i = 2; i <= DEG; i++)
{
Q = K_RATPOLY(1, 0, i);
P = P * Q;
}
cerr << " P = " << endl << P << endl << flush;
bigrational tol = bigrational(1, 65536);
ROOT1* R_0;
unsigned long num_R_0;
ROOT1 R_0_proto(P, - 1, DEG + 1);
// num_R_0 = R_0_proto.isolate_roots(R_0, tol, 1);
num_R_0 = R_0_proto.isolate_roots(R_0, tol);
cerr << "num_roots: " << num_R_0 << endl << flush;
cerr << "roots: " << endl << flush;
for (i = 0; i < num_R_0; i++)
cerr << R_0[i] << endl << flush;
cerr << "----------------------------------------" << endl << flush;
if (num_R_0 > 0)
delete [] R_0;
ROOT1* R_1;
unsigned long num_R_1;
ROOT1 R_1_proto(P, - 1, DEG + 1);
// num_R_1 = R_1_proto.isolate_roots(R_1, tol, 0);
num_R_1 = R_1_proto.isolate_roots(R_1, tol);
cerr << "num_roots: " << num_R_1 << endl << flush;
cerr << "roots: " << endl << flush;
for (i = 0; i < num_R_1; i++)
cerr << R_1[i] << endl << flush;
cerr << "----------------------------------------" << endl << flush;
if (num_R_1 > 0)
delete [] R_1;
return 0;
}
|