working mathmatica and sympy D-matrix