0
$\begingroup$

I have two matrices, A := {{1, 2, -4}, {2, -2, -2}, {-4, -2, 1}} and V := {{-2/3, 1/Sqrt[2], -1/(3 Sqrt[2])}, {-1/3, 0, (2 Sqrt[2])/3}, {2/3, 1/Sqrt[2], 1/(3 Sqrt[2])}}. I was interested in whether Transpose[V].A.V was a diagonal matrix with 6, -3, -3.

However the output I got is the following:

When I saw that, I immediately thought I calculated something wrong on paper, but on closer inspection, most of those numbers are a complicated way of writing 0 or -3! In fact, Simplify[%] gives the expected format, and Transpose[V].A.V == DiagonalMatrix[{6, -3, -3}] is True.

Usually such mere numerical expressions are evaluated/simplified, why weren't they now?

$\endgroup$
  • $\begingroup$ See a simpler example in the help to Dot. I think that behavior is intended. It does not make great inconvenience for users. $\endgroup$ – user64494 Jun 11 '19 at 18:52
  • 1
    $\begingroup$ A simpler example: Sqrt[2] - 1/Sqrt[2] is returned unmodified, and a simplification gives 1/Sqrt[2]. Only a restricted set of ultrafast simplifications is done automatically: for example, 2+3 is auto-simplified to 5. The system designer (WR) has to draw the line somewhere and leave more complex simplifications to the explicit invocation of Simplify or even FullSimplify. Apparently the line is drawn in a way that does not simplify/merge square roots by default. Maybe as computers get more powerful, the line will shift. $\endgroup$ – Roman Jun 11 '19 at 20:15
  • $\begingroup$ @Roman post as answer please. I was looking for an explanation/confirmation, I know how to call simplify myself $\endgroup$ – jcora Jun 12 '19 at 17:39
1
$\begingroup$

A simpler example:

Sqrt[2] - 1/Sqrt[2]
(*    -(1/Sqrt[2]) + Sqrt[2]    *)

is returned unmodified, and a simplification gives

Simplify[%]
(*    1/Sqrt[2]    *)

Only a restricted set of ultrafast simplifications is done automatically: for example, 2 + 3 is auto-simplified to 5. The system designer (WR) has to draw the line somewhere and leave more complex simplifications to the explicit invocation of Simplify or even FullSimplify. Apparently the line is drawn in a way that does not simplify/merge square roots by default. Maybe as computers get more powerful, the line will shift.

| improve this answer | |
$\endgroup$
1
$\begingroup$
Transpose[V].A.V // FullSimplify
(*{{6, 0, 0}, {0, -3, 0}, {0, 0, -3}}*)
| improve this answer | |
$\endgroup$

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