Алгоритм нахождения матриц.

Sibtog

Такая, задача — дана квадратная матрица размера n на n. Где n <=7, and n >= 4 ( в общем то n может быть любым). РАНГ МАТРИЦЫ равен n-1. Элементы матрицы равны 1 или 0. Нужно найти такие матрицы, которые удовлетворяют условию сложной зависимости по строкам и столбцам.
СЛОЖНАЯ ЗАВИСИМОСТЬ ПО СТРОКАМ — СУММА по i ( сi * ai ) = 0. max ( ci ) > 1. CУММ ( сi ) = 0; ci — целые, ai — строки. ci — не имеют нетривиального общего делителя.
Аналогично для столбцов.
Перенесено модератором DarkGray из раздела Programming

h_alishov

Вы с Manager-ом на одном курсе учились, что ли?

ghytr0001

лоол

Arthur8

не, я думал что это я тупой... поначалу думал ответить, идешь в библиотеку и находишь там в книшках матрицы,но зачитав просто выпал в осадок

Sibtog

я думаю написать прогу, и пусть считает, но как писать не знаю...

1sandra

Ты это имеешь в виду?
> restart:restart:restart:Digits:=10:
> AllDel:=proc(Ch::integer)::set; local i,j,del,Ch_,md,mD,Deg,alldel;
> Ch_:=ifactors(Ch)[2];
> md:=array(1..nops(Ch_; mD:=array(1..nops(Ch_:
> Deg:=1:
> for i from 1 to nops(Ch_) do md[i]:=0: mD[i]:=Ch_[i][2]+1: Deg:=Deg*mD[i]: od:
> alldel:={}:
> for i from 1 to Deg do
> del:=1:
> for j from 1 to nops(Ch_) do del:=del*Ch_[j][1]^md[j]: od:
> alldel:=alldel union {del}:
> for j from 1 to nops(Ch_) do
> if md[j]<mD[j]-1 then md[j]:=md[j]+1:break: else md[j]:=0: fi:
> od:
> od:
> alldel;
> end proc:
> AllDel(5);ifactors(11111119);
{1, 5}
[1, [[11111119, 1]]]
> SSSS:={}: h:=69923239303008375684;
h := 69923239303008375684
> for Ch from 65536 to 2*65536 do Chdel:=AllDel(Ch): r3:=evalf(root[3](Ch: S:={}: SS:={}: SSS:={}:
> for i from 1 to nops(Chdel) do
> if Chdel[i]<=r3 then
> Ch1:=Ch/Chdel[i]:
> Ch1del:=AllDel(Ch1):
> r2:=evalf(sqrt(Ch1:
> for j from 1 to nops(Ch1del) do
> if Ch1del[j]>=Chdel[i] and Ch1del[j]<=r2 then
> a:=Chdel[i]: b:=Ch1del[j]: c:=Ch/a/b:
> if a<b then d:=1 else d:=0 fi:
> S:=S union {[[a,b,c], a+b+c, d]};
> if member(a+b+c, SS) then SSS:=SSS union {a+b+c}:
> else SS:=SS union {a+b+c}: fi:
> fi:
> od:
> fi:
> od:
>
> for i from 1 to nops(SSS) do
> nR:=0: nV:=0: SSSSS:={}:
> for j from 1 to nops(S) do
> if S[j][2]=SSS[i] then
> if S[j][3]=1 then nR:=nR+1: else nV:=nV+1: fi:
> SSSSS:=SSSSS union {S[j][1]}:
> fi:
> od:
> if nR+nV>=1 then SSSS:=SSSS union {[Ch, SSS[i], SSSSS]};
> if nops(SSSSS)>3 then print([Ch, SSS[i], SSSSS]); fi;
> fi:
> od:
> od:
[65664, 194, {[18, 24, 152], [8, 72, 114], [12, 38, 144], [9, 57, 128]}]
[67200, 174, {[21, 25, 128], [10, 80, 84], [14, 40, 120], [12, 50, 112]}]
[75600, 161, {[14, 72, 75], [20, 36, 105], [15, 56, 90], [25, 28, 108]}]
[75600, 287, {[4, 108, 175], [6, 56, 225], [5, 72, 210], [15, 20, 252]}]
[83160, 185,
{[15, 44, 126], [11, 84, 90], [12, 63, 110], [22, 28, 135], [18, 35, 132]}]
[83160, 202, {[11, 56, 135], [10, 66, 126], [18, 30, 154], [9, 88, 105]}]
[85680, 215, {[21, 24, 170], [9, 70, 136], [8, 102, 105], [17, 30, 168]}]
[90720, 175, {[14, 80, 81], [27, 28, 120], [18, 45, 112], [16, 54, 105]}]
[93600, 149, {[30, 39, 80], [26, 48, 75], [25, 52, 72], [24, 60, 65]}]
[96096, 231, {[11, 52, 168], [16, 33, 182], [13, 42, 176], [8, 91, 132]}]
[100320, 450, {[3, 95, 352], [4, 66, 380], [12, 20, 418], [2, 220, 228]}]
[100320, 471, {[3, 88, 380], [5, 48, 418], [12, 19, 440], [2, 165, 304]}]
[102960, 215, {[24, 26, 165], [12, 60, 143], [15, 44, 156], [10, 88, 117]}]
[103950, 224, {[14, 45, 165], [22, 27, 175], [11, 63, 150], [9, 105, 110]}]
[105840, 200,
{[21, 35, 144], [16, 49, 135], [12, 90, 98], [18, 42, 140], [14, 60, 126]}]
[105840, 208, {[16, 45, 147], [15, 49, 144], [12, 70, 126], [14, 54, 140]}]
[110880, 175, {[30, 33, 112], [18, 77, 80], [20, 56, 99], [22, 48, 105]}]
[112200, 222, {[11, 75, 136], [17, 40, 165], [22, 30, 170], [10, 102, 110]}]
[114240, 195, {[24, 35, 136], [16, 60, 119], [15, 68, 112], [14, 85, 96]}]
[114240, 285, {[6, 119, 160], [17, 28, 240], [15, 32, 238], [10, 51, 224]}]
[116424, 209, {[12, 98, 99], [18, 44, 147], [27, 28, 154], [14, 63, 132]}]
[116424, 247, {[14, 44, 189], [18, 33, 196], [21, 28, 198], [9, 84, 154]}]
[118800, 169, {[30, 40, 99], [24, 55, 90], [22, 72, 75], [33, 36, 100]}]
[118800, 228, {[10, 108, 110], [12, 66, 150], [15, 48, 165], [25, 27, 176]}]
[118800, 247, {[12, 55, 180], [24, 25, 198], [10, 72, 165], [9, 88, 150]}]
[120960, 190, {[24, 40, 126], [27, 35, 128], [16, 84, 90], [18, 60, 112]}]
[120960, 194, {[21, 45, 128], [20, 48, 126], [16, 70, 108], [18, 56, 120]}]
[120960, 206, {[14, 72, 120], [15, 63, 128], [20, 42, 144], [18, 48, 140]}]
[121440, 297, {[11, 46, 240], [6, 115, 176], [20, 24, 253], [8, 69, 220]}]
[124800, 216, {[26, 30, 160], [20, 40, 156], [12, 100, 104], [13, 75, 128]}]
[127680, 435, {[7, 48, 380], [4, 95, 336], [16, 20, 399], [3, 152, 280]}]
[131040, 325, {[8, 65, 252], [7, 78, 240], [9, 56, 260], [12, 40, 273]}]
[131040, 331, {[8, 63, 260], [10, 48, 273], [5, 144, 182], [12, 39, 280]}]
> a1:=2234*1117; b1:=a1; c1:=10053*1117; a2:=1117*1117; b2:=6702*1117; c2:=6702*1117;
a1 := 2495378
b1 := 2495378
c1 := 11229201
a2 := 1247689
b2 := 7486134
c2 := 7486134
> a1+b1+c1 ; a2+b2+c2;
16219957
16219957
> a1*b1*c1; a2*b2*c2;
69923239303008375684
69923239303008375684
> S;
{[[16, 16, 512], 544, 0], [[32, 32, 128], 192, 0], [[32, 64, 64], 160, 1],
[[8, 16, 1024], 1048, 1], [[8, 32, 512], 552, 1], [[16, 32, 256], 304, 1],
[[16, 64, 128], 208, 1], [[1, 1, 131072], 131074, 0],
[[8, 64, 256], 328, 1], [[8, 128, 128], 264, 1], [[1, 2, 65536], 65539, 1],
[[1, 4, 32768], 32773, 1], [[1, 8, 16384], 16393, 1],
[[1, 16, 8192], 8209, 1], [[1, 32, 4096], 4129, 1],
[[1, 128, 1024], 1153, 1], [[1, 64, 2048], 2113, 1],
[[1, 256, 512], 769, 1], [[2, 2, 32768], 32772, 0],
[[2, 4, 16384], 16390, 1], [[2, 8, 8192], 8202, 1],
[[2, 16, 4096], 4114, 1], [[2, 32, 2048], 2082, 1],
[[2, 64, 1024], 1090, 1], [[2, 128, 512], 642, 1], [[2, 256, 256], 514, 1],
[[4, 4, 8192], 8200, 0], [[8, 8, 2048], 2064, 0], [[4, 8, 4096], 4108, 1],
[[4, 16, 2048], 2068, 1], [[4, 64, 512], 580, 1], [[4, 32, 1024], 1060, 1],
[[4, 128, 256], 388, 1]}
> Ch;
131073
> SS;
{160, 192, 208, 264, 304, 328, 388, 514, 544, 552, 580, 642, 769, 1048, 1060,
1090, 1153, 2064, 2068, 2082, 2113, 4108, 4114, 4129, 8200, 8202, 8209,
16390, 16393, 32772, 32773, 65539, 131074}
> SSS;
{}
> SSSS;
{[69426, 574, {[1, 174, 399], [9, 14, 551]}],
[87840, 230, {[15, 32, 183], [9, 61, 160]}],
[87840, 307, {[6, 61, 240], [4, 120, 183]}],
[69160, 285, {[4, 91, 190], [10, 28, 247]}],
[69160, 407, {[13, 14, 380], [5, 38, 364]}],
[69160, 527, {[1, 260, 266], [5, 28, 494]}],
[69160, 533, {[2, 76, 455], [4, 35, 494]}],
[69160, 555, {[1, 190, 364], [10, 13, 532]}],
[69160, 563, {[1, 182, 380], [5, 26, 532]}],
[70400, 154, {[16, 50, 88], [22, 32, 100]}], [...13767 terms...],
[118800, 155, {[33, 50, 72], [36, 44, 75]}],
[129600, 327, {[6, 96, 225], [5, 160, 162]}],
[121992, 169, {[23, 68, 78], [26, 51, 92]}],
[125610, 504, {[2, 237, 265], [3, 106, 395]}],
[129360, 435, {[8, 42, 385], [10, 33, 392]}],
[122148, 182, {[27, 39, 116], [29, 36, 117]}],
[128478, 960, {[6, 23, 931], [1, 161, 798]}],
[123480, 161, {[28, 63, 70], [35, 42, 84]}],
[131040, 329, {[5, 156, 168], [13, 36, 280]}],
[128340, 279, {[18, 31, 230], [10, 62, 207]}]}

Sibtog

++
Оставить комментарий
Имя или ник:
Комментарий: