gp > hnf1(A) = H = mathnf(A,1) ; [A * H[2], H[2]];
gp > ww (n) = matrix(n,n,i,j, if(i+j == n + 1,1)) ; gp > ww(3) %1 = [0 0 1] [0 1 0] [1 0 0]
gp > {hnf2(A) = r = matsize(A) ; W1 = ww(r[1]) ; W2 = ww(r[2]) ; B = W2 * A~ * W1 ; H = mathnf(B,1) ; U = H[2] ; H = B * U ; [W1 * H~* W2, W1 * U~* W1]} gp > hnf3(A) = H = hnf1(A~) ; [H[1]~ , H[2]~] ;
gp > hnf4(A) = H = hnf2(A~) ; [H[1]~ , H[2]~] ;
gp > {A = [-2, -2, -1, -3, -3, -3; -2, -3, -3, -2, 1, 0; -2, 0, -1, -2, 1, -2; -3, -1, -1, -3, 0, -3; -1, 0, 1, -3, -2, -1]} ;
gp > hnf1(A)[1] %3 = [0 2 1 0 1 1] [0 0 2 1 1 1] [0 0 0 1 0 0] [0 0 0 0 1 0] [0 0 0 0 0 1]
gp > hnf2(A)[1] %4 = [1 0 0 4 3 2] [0 1 0 4 2 -2] [0 0 1 1 1 1] [0 0 0 7 0 -5] [0 0 0 0 4 4]
gp > hnf3(A)[1] %5 = [16 26 0 0 0 0] [15 25 1 0 0 0] [10 15 0 2 0 0] [5 9 0 0 1 0] [12 18 0 1 0 1] gp > hnf4(A)[1] %6 = [1 0 0 0 0 0] [0 1 0 0 0 0] [0 0 1 0 0 0] [0 0 0 1 0 0] [2 3 1 3 4 0]
hnf1(A) = H = mathnf(A,1) ; [A * H[2], H[2]]; ww (n) = matrix(n,n,i,j, if(i+j == n + 1,1)) ; ww(3) {hnf2(A) = r = matsize(A) ; W1 = ww(r[1]) ; W2 = ww(r[2]) ; B = W2 * A~ * W1 ; H = mathnf(B,1) ; U = H[2] ; H = B * U ; [W1 * H~* W2, W1 * U~* W1]} hnf3(A) = H = hnf1(A~) ; [H[1]~ , H[2]~] ; hnf4(A) = H = hnf2(A~) ; [H[1]~ , H[2]~] ; {A = [-2, -2, -1, -3, -3, -3; -2, -3, -3, -2, 1, 0; -2, 0, -1, -2, 1, -2; -3, -1, -1, -3, 0, -3; -1, 0, 1, -3, -2, -1]} ; hnf1(A)[1] hnf2(A)[1] hnf3(A)[1] hnf4(A)[1]
V-3 Un système modulo des entiers divers
V-4 Un système linéaire : condition de compatibilité
V-5 Le groupe multiplicatif dans les rationnels
V-9 Groupe abélien défini par générateurs et relations (1)
b = m + 5/6 * n n = m + 9/20*t t = m + 13/42*b B = 7/12(n + N) N = 9/20(t + T) T = 11/30(m + M) M = 13/42(b + B)qui conduit à la solution, z étant un paramètre entier quelconque,
{ A = [-6, 5, 6, 0, 0, 0, 0, 0; 0, -20, 20, 9, 0, 0, 0, 0; 13, 0, 42, -42, 0, 0, 0, 0; 0, 7, 0, 0, -12, 7, 0, 0; 0, 0, 0, 9, 0, -20, 0, 9; 0, 0, 11, 0, 0, 0, 11, -30; 13, 0, 0, 0, 13, 0, -42, 0] } %1 = [-6, 5, 6, 0, 0, 0, 0, 0; 0, -20, 20, 9, 0, 0, 0, 0; 13, 0, 42, -42, 0, 0, 0, 0; 0, 7, 0, 0, -12, 7, 0, 0; 0, 0, 0, 9, 0, -20, 0, 9; 0, 0, 11, 0, 0, 0, 11, -30; 13, 0, 0, 0, 13, 0, -42, 0]
gp> H = mathnf(A, 1)[1] %2 = [45, 39, 6, 32, 10, 0, 3; 0, 1, 0, 0, 0, 0, 0; 0, 0, 7, 4, 0, 0, 1; 0, 0, 0, 1, 0, 0, 0; 0, 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 0, 1]
gp> U = mathnf(A, 1)[2] %3 = [10366482 -5152434 377822331012 -39871691734469 -231909102725990 314125208121690 2649594446226 328544517685] [7460514 -3708081 271909871649 -28694721544752 -166899542932178 226068546006716 1906850989602 236445784965] [4149387 -2062359 151230771311 -15959423780508 -92826150282503 125734753116095 1060551954891 131506363548] [7358060 -3657160 268175778529 -28300661698320 -164607539221500 222963984201380 1880664521580 233198714260] [7206360 -3581760 262646839434 -27717191275459 -161213850708508 218367169768860 1841891148174 228390891960] [4893246 -2432079 178341853095 -18820463498892 -109467058282407 148275173597044 1250676692982 155081458395] [5439213 -2703441 198240457519 -20920368550692 -121680914158297 164819069347075 1390221731600 172384769652] [3515820 -1747460 128139450571 -13522590521440 -78652590294960 106536401569829 898617018380 111426748840]
gp> U[,1] %4 = [10366482, 7460514, 4149387, 7358060, 7206360, 4893246, 5439213, 3515820]~
b = 10366482z, n = 7460514z, m = 4149387z, t = 7358060z, B = 7206360z, N = 4893246z, M = 5439213z, T = 3515820z.
{ A = [-6, 5, 6, 0, 0, 0, 0, 0; 0, -20, 20, 9, 0, 0, 0, 0; 13, 0, 42, -42, 0, 0, 0, 0; 0, 7, 0, 0, -12, 7, 0, 0; 0, 0, 0, 9, 0, -20, 0, 9; 0, 0, 11, 0, 0, 0, 11, -30; 13, 0, 0, 0, 13, 0, -42, 0] } H = mathnf(A, 1)[1] U = mathnf(A, 1)[2] U[,1]
gp> mathnf(Mat([12, 43, 189, 19, 289]), 1) %1 = [Mat(1), [-289, 1032, 4536, 456, -24; 0, 1, 0, 0, 0; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 12, -43, -189, -19, 1]]
gp> U = mathnf(A, 1)[2] %2 = [-289, 1032, 4536, 456, -24; 0, 1, 0, 0, 0; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 12, -43, -189, -19, 1]
gp> A*U[2] %3 = [0, 0, 0, 0, 1]
gp> mathnf(A, 1) %4 = [[12; 43; 189; 19; 289], Mat(1)]
gp> Y = [y1, y2, y3, y4, 220]~ ;
gp> U*Y %6 = [-289*y1 + 1032*y2 + 4536*y3 + 456*y4 - 5280] [y2] [y3] [y4] [12*y1 + -43*y2 -189*y3 - 19*y4 + 220)]
A = Mat([12, 43, 189, 19, 289]) HU = mathnf(A, 1) H1 = HU[1] ; U = HU[2] H = A*U Z = 220*H1[1,1] Y = [y1,y2,y3,y4,Z]~ U*Y
gp> { vandm(a,m)= M = matrix(#a,#a,i,j,a[i]^(j-1)); M = concat(M,matdiagonal(m)); } ;
gp> A1 = vandm([53, 19, 2, 47],[85, 68, 561, 64]) ;
gp> VM = mathnf(M, 1) %2 = [[17, 0, 1, 0; 0, 68, 52, 17; 0, 0, 1, 0; 0, 0, 0, 1], [-179520, -2116395503, -89442813409, -4183688174927, -71808, 0, 111400576, 40293825; 0, 1, 0, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0, 0, 0; 0, 0, 0, 1, 0, 0, 0, 0; 2112, 24898770, 1052268360, 49219859130, 845, 0, -1310595, -474045; 2640, 31123463, 1315335486, 61524826001, 1056, 1, -1638243, -592556; 320, 3772541, 159434605, 7457554679, 128, 0, -198575, -71825; 2805, 33068679, 1397543925, 65370126111, 1122, 0, -1740634, -629591]]
gp> H = VM[1] %3 = [17, 0, 1, 0 0, 68, 52, 17; 0, 0, 1, 0; 0, 0, 0, 1]
gp> VM[2] %4 = [-179520, -2116395503, -89442813409, -4183688174927, -71808, 0, 111400576, 40293825; 0, 1, 0, 0, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0, 0, 0; 0, 0, 0, 1, 0, 0, 0, 0; 2112, 24898770, 1052268360, 49219859130, 845, 0, -1310595, -474045; 2640, 31123463, 1315335486, 61524826001, 1056, 1, -1638243, -592556; 320, 3772541, 159434605, 7457554679, 128, 0, -198575, -71825; 2805, 33068679, 1397543925, 65370126111, 1122, 0, -1740634, -629591]
gp> H^(-1)*[20, 37, 496, 61]~ %5 = [-28, -394, 496, 61]~
gp> Y0 = concat([0, 0, 0, 0], Y~)~ %6 = [0, 0, 0, 0, -28, -394, 496, 61]~
gp> S0 = vecextract(V*Y0,"1..4") %7 = [57714619645, 0, 0, 0]~
gp> K0 = S0-[43, 52, -67, 7]~ %8 = [57714619602, -52, 67, -7]~
gp> mathnf(concat(K,K0)) == mathnf(K) %9 = 1
gp> matsnf(A) %10 = [68, 17, 1, 1]
gp> matsnf(A, 1) %11 = [[-52, 1, 0, -17; -1, 0, 1, 0; 1, 0, 0, 0; 0, 0, 0, 1], [8930, -7238, -29469, -18887424, 0, -6293129, 6072323, 12689988; -5125, 4149, 12001, 11510400, 0, 3835709, -3724697, -7733550; 340, -273, -759, -768768, 0, -256187, 248943, 516516; -5, 4, 11, 11328, 0, 3775, -3669, -7611; 612, -486, -1320, -1390272, 0, -463304, 450417, 934089; 0, -7, 0, 240, 1, 80, -85, -161; 0, 0, 15, -2048, 0, -684, 732, 1376; 0, 0, 0, 3, 0, 1, -1, -2], [0, 0, 0, 0, 68, 0, 0, 0; 0, 0, 0, 0, 0, 17, 0, 0; 0, 0, 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 0, 0, 1]]
gp> U = matsnf(A, 1)[1] %12 = [-52, 1, 0, -17; -1, 0, 1, 0; 1, 0, 0, 0; 0, 0, 0, 1]
gp> B=[b1,b2,b3,b4]~;
gp> B1 = U*B %14 = [b3, 52*b3 + (17*b4 + b1), b2 + b3, b4]~
gp> U = matsnf(A, 1)[2] %15 =[8930, -7238, -29469, -18887424, 0, -6293129, 6072323, 12689988; -5125, 4149, 12001, 11510400, 0, 3835709, -3724697, -7733550; 340, -273, -759, -768768, 0, -256187, 248943, 516516; -5, 4, 11, 11328, 0, 3775, -3669, -7611; 612, -486, -1320, -1390272, 0, -463304, 450417, 934089; 0, -7, 0, 240, 1, 80, -85, -161; 0, 0, 15, -2048, 0, -684, 732, 1376; 0, 0, 0, 3, 0, 1, -1, -2]
gp> U = matsnf(A, 1)[3] %16 = [0, 0, 0, 0, 68, 0, 0, 0; 0, 0, 0, 0, 0, 17, 0, 0; 0, 0, 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 0, 0, 1]
{ vandm(a,m) = M = matrix(#a,#a,i,j,a[i]^(j-1)); M = concat(M,matdiagonal(m)); M } A1 = vandm([53, 19, 2, 47],[85, 68, 561, 64]) ; VM = mathnf(A1, 1) H = VM[1] V = VM[2] K = vecextract(V,"1..4","1..4") B = [20, 37, 496, 61] Y = H^(-1)*B~ Y1 = concat([y1,y2,y3,y4], Y~)~ Y1 = vecextract(V*Y1,"1..4") Y0 = concat([0, 0, 0, 0], Y~)~ S0 = vecextract(V*Y0,"1..4") K0 = S0-[43, 52, -67, 7]~ mathnf(concat(K,K0)) == mathnf(K)
UVS = matsnf(A1, 1) ; U = UVS[1] V = UVS[2] S = UVS[3] B = [b1,b2,b3,b4]~ B1 = U*B
gp> {A = [4, -17, -22, -9; 0, -30, 45, -18; 20, -75, 95, -39; 7, -25, 33, -14] } ;
gp> U = matsnf(A, 1)[1]; S = matsnf(A, 1)[3] %2 = [29040, 0, 0, 0 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1]
gp> B=[b1,b2,b3,b4]; U*B %2 = [133*b2 + (265*b3 + (1760*b4 - 62*b1)), 15*b2 + (12*b3 - 7*b1), b3, b4]~
gp> B = Mat([-62, 133, 265, 1760, 29040]) %3 = [-62, 133, 265, 1760, 29040]
gp> mathnf(Mat(B)) %4 = [1]
gp> mathnf(Mat(B), 1) %5 = [Mat(1), [14520, -809837, 106496610, 707298240, -401874; 0, 2, -265, -1760, 1; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 31, -1729, 227370, 1510080, -858]]
gp> mathnf(Mat(B), 1)[2] %6 = [14520, -809837, 106496610, 707298240, -401874; 0, 2, -265, -1760, 1; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 31, -1729, 227370, 1510080, -858]
gp> B*mathnf(Mat(B), 1)[2] %7 = [0, 0, 0, 0, 1]
gp> C = vecextract(mathnf(Mat(B), 1)[2],"1..3","1..4") %8 = [14520, -809837, 106496610, 707298240; 0, 2, -265, -1760; 0, 0, 1, 0]
gp> [z1,z2,z3]*C %9 = [14520*z1, -809837*z1 + 2*z2, 106496610*z1 + (-265*z2 + z3), 707298240*z1 - 1760*z2]
{A = [4, -17, -22, -9; 0, -30, 45, -18; 20, -75, 95, -39; 7, -25, 33, -14] } ; U = matsnf(A, 1)[1]; S = matsnf(A, 1)[3] B=[b1,b2,b3,b4]; U*B B = Mat([-62, 133, 265, 1760, 29040]) mathnf(Mat(B)) mathnf(Mat(B), 1) mathnf(Mat(B), 1)[2] B*mathnf(Mat(B), 1)[2] C = vecextract(mathnf(Mat(B), 1)[2],"1..3","1..4") [z1,z2,z3]*C
gp> A = [\A] ; gp> H = mathnf(A) ; W=[0,1;1,0] ; V = W * mathnf(W*A)*W ; gp> H \%3 = [\H] gp> V \%4 = [\V]
gp> { carreleur(A) = n=#A ; L=listcreate(n!) ; for(k = 1, n!, v = numtoperm(3,k); w = matrix(n, n, i, j, if(i == v[j], 1)); H = mathnf(w*A) ; B = w^(-1)*H*w ; V=vector(n, i, B[i, i]) ; listput( L, V) ; ); Vec(L)} gp> A = [5, 2, 1; -4, 2, 4; 0, 3, -6] %1 = [5, 2, 1; -4, 2,4; 0, 3, -6]
gp> carreleur(A) %3 = [[1, 12, 15], [3, 2, 30], [15, 2, 6], [5, 12, 3], [15, 4, 3], [1, 6, 30]]
A = [\A] ; H = mathnf(A) ; W=[0,1;1,0] ; V = W * mathnf(W*A)*W ; H V { carreleur(A) = n=#A ; L=listcreate(n!) ; for(k = 1, n!, v = numtoperm(3,k); w = matrix(n, n, i, j, if(i == v[j], 1)); H = mathnf(w*A) ; B = w^(-1)*H*w ; V=vector(n, i, B[i, i]) ; ); Vec(L) } A = [5, 2, 1; -4, 2, 4; 0, 3, -6] carreleur(A)
gp> {A = mattranspose([-2, -2, -2, -3, -1; -2, -3, 0, -1, 0 ; -1, -3, -1, -1, 1; -3, -2, -2, -3, -3 ; -3, 1, 1, 0, -2 ; -3, 0, -2, -3, -1]) } ;
gp> mathnf(A, 1) %2 = [2, 1, 0, 1, 1; 0, 2, 1, 1, 1; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 0, 0, 0, 0, 1]
gp> mathnf(A, 1)[2] %3 = [-13, -2, 10, -1, 3, -1; 8, 2, -6, 2, -3, 1; -5, -2, 3, -2, 2, -1; 5, 1, -4, 0, -1, 0; -7, -2, 5, -1, 2, -1; 7, 1, -5, 1, -2, 1]
gp> matsnf(A) %4 =[4, 1, 1, 1, 1]
gp> U = matsnf(A, 1)[1] %5 = [-2, 1, -1, -3, -3; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0; 0, 0, 0, 0, 1; 1, 0, 0, 0, 0]
gp> matsnf(A, 1)[2] %6 = [-13, -4, 12, 28, 24, 23; 8, 2, -6, -19, -15, -14; -5, -2, 3, 12, 9, 8; 5, 1, -5, -11, -10, -9; -7, -2, 6, 16, 13, 12; 7, 3, -6, -15, -12, -12]
gp> matsnf(A, 1)[3] %7 = [0, 4, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1]
gp> matsnf(A, 1)[1]^(-1) %8 = [0, 0, 0, 0, 1; 1, 1, 3, 3, 2; 0, 1, 0, 0, 0; 0, 0, 1, 0, 0; 0, 0, 0, 1, 0]
gp> A*matsnf(A, 1)[2] %9 = [0, 0, 0, 0, 0, 1; 0, 4, 1, 3, 3, 2; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0]
{A = mattranspose([-2, -2, -2, -3, -1; -2, -3, 0, -1, 0 ; -1, -3, -1, -1, 1; -3, -2, -2, -3, -3 ; -3, 1, 1, 0, -2 ; -3, 0, -2, -3, -1]) } mathnf(A, 1) mathnf(A, 1)[2] matsnf(A) U = matsnf(A, 1)[1] matsnf(A, 1)[2] matsnf(A, 1)[3] matsnf(A, 1)[1]^(-1) A*matsnf(A, 1)[2]
gp> {A= = [10, 10, -9, -8; -16, -6, 22, 20; 6, -1, -4, -6; 8, 12, -5, -4; 12, 8, -13, -12]};
gp> V = mathnf(A, 1)[1] %2 = [0, 2, 1; 6, 4, 4; 15, 0, 13; 0, 4, 1; 0, 0, 1]
gp> mathnf(A, 1)[2] %3 = [-4, 3, 1, -1; 2, -1, 0, 1; 4, 4, 0, 7; -7, -2, 1, -8]
gp> matsnf(A) %4 = [0, 0, 6, 1, 1]
gp> matsnf(A, 1)[1] %5 = [-2, 0, 0, 1, 1; -22, -5, 2, 16, 0; -15, -5, 0, 11, 0; 0, 0, 1, 0, 0; 11, 3, -1, -8, 0]
gp> matsnf(A, 1)[2] %6 = [4, 5, 1, -5; -2, 4, 1, 6; -4, 2, 1, 9; 7, 3, 0, -12]
gp> U1 = matsnf(A, 1)[1]^(-1) %7 = [0, 7, 8, 11, 25; 0, 1, 0, 0, 2; 0, 0, 0, 1, 0; 0, 10, 11, 15, 35; 1, 4, 5, 7, 15]
gp> mathnf(A) == mathnf(concat (A, U1[,4])) %8 = 1
gp> mathnf(A) == mathnf(concat (A, U1[,5])) %9 = 1
{A= = [10, 10, -9, -8; -16, -6, 22, 20; 6, -1, -4, -6; 8, 12, -5, -4; 12, 8, -13, -12]} V = mathnf(A, 1)[1] mathnf(A, 1)[2] matsnf(A) matsnf(A, 1)[1] matsnf(A, 1)[2] U = matsnf(A, 1)[1] U1 = U^(-1): mathnf(A) == mathnf(concat (A, U1[,4])) mathnf(A) == mathnf(concat (A, U1[,5]))
gp> { A = [8, 2, 0; 9, -20, 27; 0, 22, -24] } ;
gp> matsnf(A) time = 0 ms. %2 = [240, 2, 1] gp> matsnf(A, 1)[3] %3 = [240 0 0] [0 2 0] [0 0 1]
{ A = [8, 2, 0; 9, -20, 27; 0, 22, -24] }; matsnf(A) matsnf(A, 1)[3]
gp> { A = [3, 25, 46; 1, 8, 20; 1, 10, 11]} ;
gp> U = matsnf(A, 1)[1] %2 = [1, -12, -10; 0, 1, 0; 0, 0, 1]
gp> V = matsnf(A, 1)[2] %3 = [112, 61, 52; -9, -5, -4; -2, -1, -1]
gp> D = matsnf(A, 1)[3] %4 = [19, 0, 0; 0, 1, 0; 0, 0, 1]
gp> U^(-1) %5 = [1, 12, 10; 0, 1, 0; 0, 0, 1]
{ A = [3, 25, 46; 1, 8, 20; 1, 10, 11] } ; U = matsnf(A, 1)[1] V = matsnf(A, 1)[2] D = matsnf(A, 1)[3] U^(-1)
gp> {A = [3, -4; 2, -1; -2, 4]; }
gp> matsnf(A) %2 = [0, 1, 1]