fix typing exceptions: must not pass null to auxiliary
When creating matrix types, copy the MathematicalType instance for the entry type

It seems assigning an instance of MathematicalType (or any other)
to e.g. the "entryType" property of a new MatrixType disconnects
any earlier association the MathematicalType instance had. This
sets the corrsponding property to null on the object the instance
is from, leading to typing errors.

This change should fix #1.