1Function: nfisisom
2Section: number_fields
3C-Name: nfisisom
4Prototype: GG
5Help: nfisisom(f,g): as nfisincl but tests whether f is isomorphic to g.
6Doc: as \tet{nfisincl}, but tests for isomorphism. More efficient if
7 $f$ or $g$ is a number field structure.
8 \bprog
9 ? f = x^6 + 30*x^5 + 495*x^4 + 1870*x^3 + 16317*x^2 - 22560*x + 59648;
10 ? g = x^6 + 42*x^5 + 999*x^4 + 8966*x^3 + 36117*x^2 + 21768*x + 159332;
11 ? h = x^6 + 30*x^5 + 351*x^4 + 2240*x^3 + 10311*x^2 + 35466*x + 58321;
12
13 ? #nfisisom(f,g)  \\ two isomorphisms
14 %3 = 2
15 ? nfisisom(f,h) \\ not isomorphic
16 %4 = 0
17 \\ comparative bench
18 ? K = nfinit(f); L = nfinit(g); B = 10^3;
19 ? for (i=1, B, nfisisom(f,g))
20 time = 6,124 ms.
21 ? for (i=1, B, nfisisom(K,g))
22 time = 3,356 ms.
23 ? for (i=1, B, nfisisom(f,L))
24 time = 3,204 ms.
25 ? for (i=1, B, nfisisom(K,L))
26 time = 3,173 ms.
27 @eprog\noindent
28 The function is usually very fast when the fields are nonisomorphic,
29 whenever the fields can be distinguished via a simple invariant such as
30 degree, signature or discriminant. It may be slower when the fields
31 share all invariants, but still faster than computing actual isomorphisms:
32 \bprog
33 \\ usually very fast when the answer is 'no':
34 ? for (i=1, B, nfisisom(f,h))
35 time = 32 ms.
36
37 \\ but not always
38 ? u = x^6 + 12*x^5 + 6*x^4 - 377*x^3 - 714*x^2 + 5304*x + 15379
39 ? v = x^6 + 12*x^5 + 60*x^4 + 166*x^3 + 708*x^2 + 6600*x + 23353
40 ? nfisisom(u,v)
41 %13 = 0
42 ? polsturm(u) == polsturm(v)
43 %14 = 1
44 ? nfdisc(u) == nfdisc(v)
45 %15 = 1
46 ? for(i=1,B, nfisisom(u,v))
47 time = 1,821 ms.
48 ? K = nfinit(u); L = nfinit(v);
49 ? for(i=1,B, nfisisom(K,v))
50 time = 232 ms.
51 @eprog
52