def replace(self, F, G, map=False):
        M = self[:, :]

        return M.applyfunc(lambda x: x.replace(F, G, map))
Replaces Function F in Matrix entries with Function G.
dataset/ETHPy150Open sympy/sympy/sympy/matrices/matrices.py/MatrixBase.replace