0
$\begingroup$

i have two nested list named t1 as follows

t1={{{-5.95333, -6.28989, 1.78237,  0.0765267, -0.301329}, {-6.28989, -159.769, 1.92113, 1.96052,  2.37397}, {1.78237, 1.92113, -0.788266, -0.0239211,  0.17575}, {0.0765267,  1.96052, -0.0239211, -0.0272567, -0.0197437}, {-0.301329, 2.37397,  0.17575, -0.0197437, -1.09727}}, {{-5.55721, -2.09198, 0.841045,  0.124068, -0.452792}, {-2.09198, -51.929, 0.336034, 2.81105, 0.948832}, {0.841045, 0.336034, -0.14926, -0.0195627,  0.0503916}, {0.124068,  2.81105, -0.0195627, -0.195508, -0.0143722}, {-0.452792, 0.948832, 0.0503916, -0.0143722, -0.976465}}}

i used this code to get inverse of two matrix

-Inverse[#] & /@ t1

and get result as follows

 {{{0.527757, -0.00787528, 1.18541, -0.147178,  0.0305467}, {-0.00787528, 0.0565341, 0.0108403, 3.99541,0.0543206}, {1.18541, 0.0108403, 4.04155, 0.314973, 0.339589}, {-0.147178, 3.99541, 0.314973, 321.241,  2.95482}, {0.0305467, 0.0543206, 0.339589, 2.95482, 1.02171}}, {{1.27371, -0.0158652, 7.07499, -0.110165, -0.239306}, {-0.0158652, 0.0920673, -0.0282588, 1.31093, 0.0760653}, {7.07499, -0.0282588, 46.2561, -0.477807, -0.914032}, {-0.110165, 1.31093, -0.477807, 23.8719, 0.948899}, {-0.239306, 0.0760653, -0.914032, 0.948899, 1.14785}}}

i used this code with another two nested list named t2 as follows

t2={{{-5.3632, -6.748, 1.69453, 0.0854, -0.29345}, {-6.748, -171.6,  2.159, 2.23, 3.710}, {1.69453, 2.159, -0.83467, -0.02813, 0.18637}, {0.0854, 2.23, -0.02813, -0.0321, -0.03390}, {-0.29345, 3.710, 0.186366, -0.03390, -1.19279}}, {{-5.239, -2.180, 0.7379, 0.13145, -0.4176}, {-2.180, -53.481, 0.3282, 2.9460,  1.2974}, {0.7379, 0.3282, -0.1231, -0.01940, 0.04261}, {0.13145, 2.9460, -0.01940, -0.20926, -0.02945}, {-0.4176, 1.2974,  0.04261, -0.02945, -1.00586}}}

-Inverse[#] & /@ t2

but i get this error what's wrong? error

$\endgroup$
4
  • $\begingroup$ Inverse gives the inverse of a square matrix. When I look at your matrix using MatrixForm[t1] it is not square. Are you trying to compute the inverse of a matrix? Or an inverse in some other sense? Can you post an example on a shorter list of what your expected outcome should be? $\endgroup$
    – Michel
    Sep 6 at 17:24
  • $\begingroup$ Sorry, I see you use it applied to the square submatrices $\endgroup$
    – Michel
    Sep 6 at 17:35
  • $\begingroup$ In MMA version 13.1 your code runs o.k. And the inverses are far from being ill conditioned. $\endgroup$ Sep 6 at 18:19
  • $\begingroup$ I use Mathematica 11 version. thanks Daniel Huber $\endgroup$
    – Ahmed
    Sep 6 at 18:27

1 Answer 1

3
$\begingroup$

If -Inverse[#] & /@ t2 does not work in 11 version,we maybe test

-LinearSolve[#, IdentityMatrix[5]] & /@ t2

In 13.1 version, all of them work.

(-Inverse[#] & /@ t2) - (-LinearSolve[#, IdentityMatrix[5]] & /@ 
    t2) // Chop

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.