TheKingDanQc

10 Reputation

One Badge

8 years, 363 days

MaplePrimes Activity


These are questions asked by TheKingDanQc

I tried to make a procedure that would find the determinant of any 3x3 matrix but I keep getting unterminated procedure what should I change??

Code:
DeterminantMat:=proc(matA::Array)
    local  i::integer,  j::integer,  x::integer,  y::integer,  A::integer,  B::integer,  indice::integer,  S::integer:
      A:=0:  B:=0:  S:=0: i:= 1:  j:=1:  x:=1:  y := 1:  indice:=1:

for x from 1 to 3 do
   indice := 1:  
   for i  from 1 to  3 do  
       if x = i then
           end do:
        else if x <>i then
           for j from 1 to 3 do
                  if y = j then  end do:  
                  else if indice = 1 then  A := matA(i,j):  indice := 2:  
                     else if indice = 2 then  B:=matA(i,j):  indice :=3:    
                       else if indice = 3 then  B :=B * matA(i,j):  indice :=4:    
                         else if indice = 4 then  A := A * matA(i,j):      
                             if x = 2 then  S := S + (-1 * matA(x,y)) * (A-B):
                               else  S := S + matA(x,y) * (A-B):   end if:   end if:
 end do:
 end if:
 end do:
 end do:
 end proc:

Page 1 of 1