Encapsulated replacement of equations