Matlab determinant equation solver

9 views (last 30 days)
Hi, i would like to solve det (I+lambda*M)=0 (not eigenvalue problem) where lambda is complex number and M has 792 3x3 matrix, please can you advise me code to do it?
Thanks beforehand
  3 Comments
Nasimi Bayramli
Nasimi Bayramli on 15 May 2020
sorry, i have edited it, it was 792 3x3 matrix and I is identity matrix
John D'Errico
John D'Errico on 15 May 2020
Edited: John D'Errico on 15 May 2020
What is a 792 3x3 matrix? Are you saying that M is 792x3x3, so a 3-dimensional matrix? In that case, the determinant of a multi-dimensional matrix is undefined.
Perhaps you want to solve 792 such 3x3 problems. But then, even though you CLAIM this to be not an eigenvalue problem, you are wrong. It is exactly that, just with a twist. (THINK ABOUT IT!) And then all you need to do is use a loop.

Sign in to comment.

Accepted Answer

John D'Errico
John D'Errico on 15 May 2020
Edited: John D'Errico on 15 May 2020
Just for kicks, I assume that you really have 792 such 3x3 problems. JUST USE A LOOP. Could you convert this into a cell array of 3x3 matrices? Well, yes. Then you could just use cellfun. Not a problem either way, nor would the code written using cellfun be essentially any better or faster to run. cellfun is just an implicit, internally implemented loop. And the time required for loop over 792 3x3 arrays is quite minimal. So either way you do it is the same.
Next, to your claim this is not an eigenvalue problem. False. It is. With a twist.
Suppose you want to solve the problem
det(I + lambda*M) = 0
where M is a 3x3 matrix? Any nxn matrix applies too, of course.
First, what is the determinant det(k*A), where A is a square 3x3 matrix?
det(k*A) = k^3 *det(A)
For an nxn matrix, we would just have k^n*det(A).
go back and look at your problem.
det(I + lambda*M) = 0
You wish to solve for lambda, suc that this expression is zero. As long as lambda is not zero, then you can divide by lambda^3. And we just showed that we can distribute that into the matrix inside the determinant. So we can write the problem as:
det(I*1/lambda + M) = 0
AND THAT IS AN EIGENVALUE PROBLEM. Solve for the eigenvalues of the 3x3 matrix M. Then invert them, and multiply by -1, since the eigenvalues of a system solve the problem:
det(A - lambda*I) = 0
The only case where you have a problem is then M is singular, in which case one or more of the eigenvalues of M is zero.

More Answers (0)

Categories

Find more on Linear Algebra in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!