2
$\begingroup$

I have a symbolic matrix given as

$$ A = \begin{bmatrix} 0 & 12.5 & 12.5 k_1-5. \\ 12.5 & 12.5 k_1-5. & 2.\, -5. k_1 \\ k_1 & 0. & 0. \\ \end{bmatrix} $$ when I calculate the inverse of this matrix with Inverse, I obtain the following matrix picture.

The problem with this matrix is that all $10^{-15}$ should be rounded to $0$. I do this by using Chop. Basically I just use

Chop[expr, 10^-1]

which then gives me picture2.

However, for example, (1,3) should just simplify to $\frac{1}{k_1}$, but I cannot achieve this with FullSimplify. Is there any other way?

$\endgroup$

2 Answers 2

3
$\begingroup$

Try define the matrix with exact numbers

a = {{0, 25/2, 25/2 k1 - 5}, {25/2, 25/2 k1 - 5, 2 - 5 k1}, {k1, 0, 0}}

and then

FullSimplify[Inverse[a]]
$\endgroup$
3
  • $\begingroup$ Thanks. I have a long list of expressions that lead to this result. How should I approach it so I do not have to manually define my matrix? I mean, is there something like format short for Mathematica that I can default to, if that makes sense. $\endgroup$
    – ofey
    May 1, 2021 at 16:54
  • 2
    $\begingroup$ you can do FullSimplify[ Inverse[Rationalize[{{0., 12.5, -5. + 12.5*k1}, {12.5, -5. + 12.5*k1, 2. - 5.*k1}, {k1, 0., 0.}}]]] $\endgroup$
    – Andreas
    May 1, 2021 at 16:58
  • $\begingroup$ Aha. Much appreciated! $\endgroup$
    – ofey
    May 1, 2021 at 16:59
2
$\begingroup$

Mathematica can work with approximate numbers (as you do) or exact numbers. Exact numbers work much better in this case

M = {{0, 25/2, 25/2 k - 5}, {25/2, 25/2 k - 5, 2 - 5 k}, {k, 0, 0}};

Inverse[M] // FullSimplify
(* {{0, 0, 1/k}, {4/(125 k), 2/(25 k), -(1/k^2)}, {2/(25 k), 2/(
  5 (2 - 5 k) k), 5/(k^2 (-2 + 5 k))}} *)
$\endgroup$
1
  • $\begingroup$ Thanks. I assume it is the fact that I have a decimal point makes the numbers approximate in my case? $\endgroup$
    – ofey
    May 1, 2021 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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