It is well known what happens if two real symmetric matrices commute, i.e. if we have two matrices $A$ and $B$ such that $A=A^T$, $B=B^T$ and $AB=BA$. The answer is given in terms of diagonalization: there is a unitary matrix $M$ such that $A$ and $B$ are transformed into $A'=M^TAM$ and $B'=M^TBM$, and both $A'$ and $B'$ are diagonal.


Here I'm asking if any analogous property holds in the following case.


$A$ and $B$ are symmetric, i.e. $A=A^T$ and $B=B^T$. The following property holds:


$$A\Omega B=B\Omega A$$ (1)


where $\Omega$ is the matrix defining the symplectic bilinear form (skew-symmetric, nonsingular, and hollow), e.g.:


$$\Omega = \begin{bmatrix}0 & 0 & 1 & 0\\0 & 0 & 0 & 1\\
-1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \end{bmatrix}$$


The allowed transformations are the symplectic matrices $M$, i.e. matrices for which the following holds:


$$M^T\Omega M=\Omega$$


The transformed matrices are $A'=M^TAM$ and $B'=M^TBM$.


My question is if there is a form into which $A'$ and $B'$ can be put, by means of a suitable $M$, provided that Eq.1 holds.



Symplectic equivalent of commuting matrices
It is not too difficult to prove (if I made no mistakes) that, under the further hypothesis added by Doriano in his answer, i.e. that one of the two matrices, say $A$, is positive definite (the invertibility of $B$ is not necessary), then the two real simmetric matrices $A$ and $B$ satisfying (1) can actually be simultaneously diagonalized by means of a real symplectic matrix $M$. This can be so chosen that the transformed matrices have the form $A'=\text{diag} (a\_1, a\_1, a\_2, a\_2, \dots, a\_n, a\_n)$, $B'=\text{diag} (b\_1, b\_1, b\_2, b\_2, \dots, b\_n, b\_n)$, with $a\_i>0\ \forall\ i=1,\dots, n$. 


