was@form:~/129/getmagma\$ was@form:~/129/getmagma\$ Magma V2.11-10 Thu Feb 17 2005 11:07:42 on form [Seed = 4272455044] Type ? for help. Type -D to quit. Loading startup file "/home/was/magma/local/emacs.m" Loading "/home/was/magma/local/init.m" > A := Matrix(2,2,[1,2,3,4]); > A; [1 2] [3 4] > SmithForm(A); > SmithForm(A); [1 0] [0 2] [ 1 0] [-1 1] [-1 2] [ 1 -1] > SmithForm; Intrinsic 'SmithForm' Signatures: ( X) -> Mtrx, AlgMatElt, AlgMatElt [ k: RngIntElt, NormType: MonStgElt, Partial: BoolElt, RightInverse: BoolElt ] The smith form S of X, together with unimodular matrices P and Q such that P * X * Q = S. > n := 50; A := Matrix(n,n,[Random(100) : i in [1..n^2]]); time B:= SmithForm(A); Time: 0.030 > n := 100; A := Matrix(n,n,[Random(100) : i in [1..n^2]]); time B:= SmithForm(A); Time: 0.420 > n := 150; A := Matrix(n,n,[Random(100) : i in [1..n^2]]); time B:= SmithForm(A); Time: 2.510 > n := 200; A := Matrix(n,n,[Random(100) : i in [1..n^2]]); time B:= SmithForm(A); Time: 9.600 > >Q := RationalField(); > Q; Rational Field > Type(Q); FldRat > R := PolynomialRing(Q); > x; x > x in R; true > x^3 + 1; x^3 + 1 > (x^3 + 1)^5; x^15 + 5*x^12 + 10*x^9 + 10*x^6 + 5*x^3 + 1 > K := NumberField(x^3-2); > a; a > a in K; true > x in K; >> x in K; ^ Runtime error in 'in': Bad argument types > a in R; >> a in R; ^ Runtime error in 'in': Bad argument types > a^3; 2 > a^2; a^2 > (a^2+a+10)^100; 1597545916784017656835196222164318853777480198287220038244483474\ 34237714547208741787168948657103837040069312512*a^2 + 201278172872978720642893096426089114904360174248554584523278\ 378810002098794754359916854560500609472348163145728*a + 253594606887045126582752821019824261365197098233169658224970\ 924663014477823176413602486220432339643744947011584 > R := RingOfIntegers(K); Maximal Equation Order with defining polynomial x^3 - 2 over ZZ > R := RingOfIntegers(K); > R; Maximal Equation Order with defining polynomial x^3 - 2 over ZZ > Basis(R); [ R.1, R.2, R.3 ] > B := Basis(R); > B; [ R.1, R.2, R.3 ] > K!B[1]; 1 > K!B[2]; a > K!B[3]; a^2 > K := NumberField(x^2-5); > R := RingOfIntegers(K); > Basis(R); [ R.1, R.2 ] > K!R.1; 1 > K!R.2; 1/2*(a + 1) > MinimalPolynomial(\$1); x^2 - x - 1 > /* ! <-- coerce into something (int) 5.6 SphericalCow(5) */ > > > > > R := PolynomialRing(Q); > R![1,2,3,4]; 4*x^3 + 3*x^2 + 2*x + 1 > procedure ints(f) procedure> K := NumberField(f); procedure> R := MaximalOrder(K); procedure> print [K!z : z in Basis(R)]; procedure> end procedure; > load "file"; >> load "file"; ^ User error: Could not open file "file" (No such file or directory) > ints(x^3-2); [ 1, a, a^2 ] > ints(x^2-5); [ 1, 1/2*(a + 1) ] > d := 10; time ints(&+[i*x^i + 2*x+ 1 : i in [0..d]]); [ 1, 10*a, 10*a^2 + 9*a, 10*a^3 + 9*a^2 + 8*a, 10*a^4 + 9*a^3 + 8*a^2 + 7*a, 10*a^5 + 9*a^4 + 8*a^3 + 7*a^2 + 6*a, 10*a^6 + 9*a^5 + 8*a^4 + 7*a^3 + 6*a^2 + 5*a, 10*a^7 + 9*a^6 + 8*a^5 + 7*a^4 + 6*a^3 + 5*a^2 + 4*a, 10*a^8 + 9*a^7 + 8*a^6 + 7*a^5 + 6*a^4 + 5*a^3 + 4*a^2 + 3*a, 10*a^9 + 9*a^8 + 8*a^7 + 7*a^6 + 6*a^5 + 5*a^4 + 4*a^3 + 3*a^2 + 2*a ] Time: 0.090 > d := 10; time ints(&+[i*x^i + 2*x+ 1 : i in [0..d]]); [ 1, 10*a, 10*a^2 + 9*a, 10*a^3 + 9*a^2 + 8*a, 10*a^4 + 9*a^3 + 8*a^2 + 7*a, 10*a^5 + 9*a^4 + 8*a^3 + 7*a^2 + 6*a, 10*a^6 + 9*a^5 + 8*a^4 + 7*a^3 + 6*a^2 + 5*a, 10*a^7 + 9*a^6 + 8*a^5 + 7*a^4 + 6*a^3 + 5*a^2 + 4*a, 10*a^8 + 9*a^7 + 8*a^6 + 7*a^5 + 6*a^4 + 5*a^3 + 4*a^2 + 3*a, 10*a^9 + 9*a^8 + 8*a^7 + 7*a^6 + 6*a^5 + 5*a^4 + 4*a^3 + 3*a^2 + 2*a ] Time: 0.110 > d := 20; time ints(&+[i*x^i + 2*x+ 1 : i in [0..d]]); [ 1, 20*a, 20*a^2 + 19*a, 20*a^3 + 19*a^2 + 18*a, 20*a^4 + 19*a^3 + 18*a^2 + 17*a, 20*a^5 + 19*a^4 + 18*a^3 + 17*a^2 + 16*a, 20*a^6 + 19*a^5 + 18*a^4 + 17*a^3 + 16*a^2 + 15*a, 20*a^7 + 19*a^6 + 18*a^5 + 17*a^4 + 16*a^3 + 15*a^2 + 14*a, 20*a^8 + 19*a^7 + 18*a^6 + 17*a^5 + 16*a^4 + 15*a^3 + 14*a^2 + 13*a, 20*a^9 + 19*a^8 + 18*a^7 + 17*a^6 + 16*a^5 + 15*a^4 + 14*a^3 + 13*a^2 + 12*a, 20*a^10 + 19*a^9 + 18*a^8 + 17*a^7 + 16*a^6 + 15*a^5 + 14*a^4 + 13*a^3 + 12*a^2 + 11*a, 20*a^11 + 19*a^10 + 18*a^9 + 17*a^8 + 16*a^7 + 15*a^6 + 14*a^5 + 13*a^4 + 12*a^3 + 11*a^2 + 10*a, 20*a^12 + 19*a^11 + 18*a^10 + 17*a^9 + 16*a^8 + 15*a^7 + 14*a^6 + 13*a^5 + 12*a^4 + 11*a^3 + 10*a^2 + 9*a, 20*a^13 + 19*a^12 + 18*a^11 + 17*a^10 + 16*a^9 + 15*a^8 + 14*a^7 + 13*a^6 + 12*a^5 + 11*a^4 + 10*a^3 + 9*a^2 + 8*a, 20*a^14 + 19*a^13 + 18*a^12 + 17*a^11 + 16*a^10 + 15*a^9 + 14*a^8 + 13*a^7 + 12*a^6 + 11*a^5 + 10*a^4 + 9*a^3 + 8*a^2 + 7*a, 20*a^15 + 19*a^14 + 18*a^13 + 17*a^12 + 16*a^11 + 15*a^10 + 14*a^9 + 13*a^8 + 12*a^7 + 11*a^6 + 10*a^5 + 9*a^4 + 8*a^3 + 7*a^2 + 6*a, 20*a^16 + 19*a^15 + 18*a^14 + 17*a^13 + 16*a^12 + 15*a^11 + 14*a^10 + 13*a^9 + 12*a^8 + 11*a^7 + 10*a^6 + 9*a^5 + 8*a^4 + 7*a^3 + 6*a^2 + 5*a, 20*a^17 + 19*a^16 + 18*a^15 + 17*a^14 + 16*a^13 + 15*a^12 + 14*a^11 + 13*a^10 + 12*a^9 + 11*a^8 + 10*a^7 + 9*a^6 + 8*a^5 + 7*a^4 + 6*a^3 + 5*a^2 + 4*a, 20*a^18 + 19*a^17 + 18*a^16 + 17*a^15 + 16*a^14 + 15*a^13 + 14*a^12 + 13*a^11 + 12*a^10 + 11*a^9 + 10*a^8 + 9*a^7 + 8*a^6 + 7*a^5 + 6*a^4 + 5*a^3 + 4*a^2 + 3*a, 1/7*(20*a^19 + 99*a^18 + 134*a^17 + 7*a^16 + 86*a^15 + 121*a^14 + 134*a^13 + 66*a^12 + 101*a^11 + 114*a^10 + 46*a^9 + 81*a^8 + 94*a^7 + 26*a^6 + 61*a^5 + 74*a^4 + 6*a^3 + 41*a^2 + 54*a) ] Time: 4.850 > GF(NextPrime(10^20)); Finite field of size 100000000000000000039 > GF(NextPrime(10^100)); Finite field of size 1000000000000000000000000000000000000000000\ 0000000000000000000000000000000000000000000000000000000267 > GF(NextPrime(10^100)^2); Finite field of size 1000000000000000000000000000000000000000000\ 0000000000000000000000000000000000000000000000000000000267^2 >