ahmedco31

100 Reputation

4 Badges

10 years, 239 days

MaplePrimes Activity


These are replies submitted by ahmedco31

I got the correct result after using your solution. Thank you Carl

I got the correct result after using your solution. Thank you Carl

here is the text

> with(LinearAlgebra);

> with(ArrayTools);

> with(combinat); > with(MTM);

> g := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (2, 1) = 1, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 1, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0});

> gn := Matrix(4, 4, {(1, 1) = 0, (1, 2) = 1, (1, 3) = 1, (1, 4) = 1, (2, 1) = 1, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (3, 1) = 1, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (4, 1) = 1, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0});

> k, l := Size(g);

> s := choose(k);

> n := nops(%);

> delta := 1/2; check1 := 1;

printlevel := 6;

for i to n do gn := g;

if nops(s[i])>= 2 then a := SubMatrix(g, s[i], s[i]);

u, v := Size(a); t := Matrix(u, shape = identity);

v := Vector[column](u, 1);

if Determinant(t+delta.a) <> 0 then x := 1/(t+delta.a).v end if;

for m to u do if x[m] < 0 then check1 := 0 end if end do;

for j to k do for n to k do if `and`(member(j, s[i]) = true, member(n, s[i]) = true) then gn[j, n] := 0 end if;

if `and`(member(j, s[i]) = false, member(n, s[i]) = false) then gn[j, n] := 0

end if

end do

end do

end if;

end do;

Page 1 of 1