01-14-2016, 11:04 AM
eg1. how([1,4,3,2,1,4,4])--> Error: Bad argument type, M0(B,A):=-DET(M9)/M8(2,1) cant be executed.
eg2. how([1,4,k,2,1,4,4])-> expecting [1,k,1,4] into M0 but Error: Bad argument type
eg2. how([1,4,k,2,1,4,4])-> expecting [1,k,1,4] into M0 but Error: Bad argument type
Code:
#pragma mode( separator(.,;) integer(h32) )
exc();
dett();
#cas
how(den):= //"Error: Bad argument type if variable say k is insert into the vector den"
BEGIN
n:=length(den);
m:=length(den);
nx:=simplify(poly2symb(den));
IF even(n-1) THEN rw:=((n-1)/2)+1; ELSE rw:=(n)/2 END;
M0:=makemat(n,rw);
c:=0;
WHILE n>0 DO
a:=1;L1:={};c:=c+1;
IF n==0 THEN
L1(a):=coeff(nx,n);
ELSE
nl:=n-1;
FOR j FROM c TO length(den) STEP 2 DO
L1(a):=coeff(nx,x,nl); // "Error: Bad argument type"
a:=a+1;
nl:=nl-2;
END;
END;
L2(n):=length(L1);
FOR j FROM 1 TO length(L1) DO
M0(c,j):=L1(j);
END;
n:=n-1;
END;
hw:=M0;
exc();
END;
#end
#cas
exc()
BEGIN
FOR j FROM 1 TO m-2 DO
k:=j+1;
B:=j;
M8:=subMat(M0,j,1..rw,k,1..rw);
dett();
END;
END;
#end
#cas
dett()
BEGIN
//M9:=subMat(M8,1,1,2,2);
M9:=matrix(2,2);
B:=B+2;
A:=1;
FOR j FROM 2 TO rw DO
M9(1,1):=M8(1,1);
M9(2,1):=M8(2,1);
M9(1,2):=M8(1,j);
M9(2,2):=M8(2,j);
M0(B,A):=-DET(M9)/M8(2,1); //"Error: Bad argument type"
A:=A+1;
END;
END;
#end