I have two matrices in the form of variables A and b , which are inputs to my matlab function (published below). I would like to calculate the Significant numbers used for the inverse matrix operation (division of the matrix) from the results of A , b . However, I do not know where to start (Matlab or mathematically) to discuss this approach. Help?
More context using a square linear system (Ax=b) , and I see singular or nonsingular and trying to find the solution (s).
% x = answer % y = 0 if no solution, 1 if nonsingular, 2 if many solutions % z = p is number of sig figs % function [ x, y, z ] = squareLinSysSolv(A, b) if det(A) == 0 % Matrix is singular and therefor many solutions x = A\b; y = 0; % Used as place holder to compile z = 5; % Used as place holder to compile elseif det(A) ~= 0 % Matrix does not equal to zero (perhaps a number very close to it or % far from it) and therefor has a unique solution. x = A\b; y = 1; % Used as place holder to compile z = 5; % Used as place holder to compile end end
Edit: To make this a bit clear, z must be some integer that approximates (ceiling or floor value) the decimal number of significant digits that A\b were calculated on.
Test cases: Test / specification of what is expected. Both A and b are matrices, and the result should be something like this.
A = 1.5000 2.3000 7.9000 6.1000 3.2000 13.0000 13.0000 21.0000 76.0000 b = 1 3 5 >> [x,y,z] = squareLinSysSolv(A,b) % the result of x = A\b x = 0.8580 3.0118 -0.9132 % determinant is not equal to zero y = 1 % Amount of sig figs/precision in calculation z = 15
source share