Invariants of several matrices