# How can I find the determinant and transpose of a 13*13 matrix without writing all the numbers one by one?

2 views (last 30 days)
Efe on 26 Nov 2023
Answered: John D'Errico on 26 Nov 2023

madhan ravi on 26 Nov 2023
doc det
doc transpose
Efe on 26 Nov 2023
I'm sorry, I asked the question incompletely. How can I write the matrix in a short way?
Walter Roberson on 26 Nov 2023
You could construct the matrix using sparse by listing the row numbers and column numbers and corresponding values. I count about 42 non-zero elements, so it would look like
sparse(list_of_42_rows, list_of_42_columns, list_of_42_values)
That would be 42*3 = 126 elements to enter instead of 13*13 = 169 -- but it would also be much easier to get wrong. TANSTAAFL

Torsten on 26 Nov 2023
Moved: Torsten on 26 Nov 2023
If a matrix is structured as irregularily as the one you posted, there is no other way as to reference its nonzero elements one by one:
A = zeros(13);
A(1,1) = 29/20;
A(1,2) = -1;
A(1,5) = -1/5;
...

John D'Errico on 26 Nov 2023
You have many almost random looking numbers. So without knowing how they were generate, it is impossible to do better than stuffing the elements of your matrix using either the scheme @Torsten or @Walter Roberson has proposed.
HOWEVER, IF there is some formula that generates those numbers, then you need to write it in MATLAB code. And only you can write that code, since only you know how those coefficients were generated, and what the placement means. But surely there is SOME formula. We cannot guess it however.

### Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

R2023b

### Community Treasure Hunt

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

Start Hunting!