The diagonalization of a matrix is only unique upto andup to an ordering of the eigenvalues. What is happininghappening here is that the Eigenvalues in dp
and d.d
are ordered differently. One easily verifies that
Simplify[SortBy[Diagonal[d.d], N] == SortBy[Diagonal[dp], N]]
Returns True
.