################ (2021) Dr.W.G. Lindner, Leichlingen DE ### craBox Functions for Cramer rule etc. ################ Replace(p,M,i) = do(X=M, Xt=transpose(X), Xt[i]=p, transpose(Xt)) -- 2 x 2 Cramer2(A,B) = ( det(Replace(B,A,1))/det(A), det(Replace(B,A,2))/det(A) ) -- 3 x 3 Cramer3(A,B) = ( det(Replace(B,A,1))/det(A), det(Replace(B,A,2))/det(A), det(Replace(B,A,3))/det(A) ) -- n x n Cramer(A,B) = do( n = dim(A,1), Z = zero(2,n), Y = Z[1], for( i,1,n, Y[i] = det(Replace(B,A,i))/det(A) ), Y ) CramerAdj(A,B) = dot(adj(A),B)/det(A) Cramer3x(M,R)= do( M=transpose(M), Box( R, M[2], M[3]) / Box(M[1], M[2], M[3])) -- MinorMatrices MiMa(A)= do( e = quote(e), i = quote(i), MM = zero(3,3,2,2), for(k,1,3, for(j,1,3, MM[k,j] = minormatrix(A,k,j))), MM) -- CofactorsMatrix CoMa(A) = do( e = quote(e), i = quote(i), MM = zero(3,3), for(k,1,3, for(j,1,3, MM[k,j] = cofactor(A,k,j))), MM) detLaplace(A,i) = sum(j,1,dim(A,1), (-1)^(i+j)*A[i,j]*minor(A,i,j) ) detCofactor(A,i) = sum(j,1,dim(A,1), A[i,j]*cofactor(A,i,j) ) invAdj(M) = adj(M)/det(M) DET3(M) = dot(M[1],cross(M[2],M[3])) ################# craBox END ####################