diff --git a/equationcollection/equationcollection.py b/equationcollection/equationcollection.py index 2ea0c2b6f4f59ce66d6c0cbf029a1ccaeb003336..f6cd8be31bec8fa7cdc4717187f910ee59080589 100644 --- a/equationcollection/equationcollection.py +++ b/equationcollection/equationcollection.py @@ -171,13 +171,15 @@ class EquationCollection: continue # exact the same subexpression equation exists already else: # different definition - a new name has to be introduced - newLhs = self.subexpressionSymbolNameGenerator() + newLhs = next(self.subexpressionSymbolNameGenerator) newEq = sp.Eq(newLhs, fastSubs(otherSubexpressionEq.rhs, substitutionDict)) processedOtherSubexpressionEquations.append(newEq) substitutionDict[otherSubexpressionEq.lhs] = newLhs else: processedOtherSubexpressionEquations.append(fastSubs(otherSubexpressionEq, substitutionDict)) - return self.copy(self.mainEquations + other.mainEquations, + + processedOtherMainEquations = [fastSubs(eq, substitutionDict) for eq in other.mainEquations] + return self.copy(self.mainEquations + processedOtherMainEquations, self.subexpressions + processedOtherSubexpressionEquations) def getDependentSymbols(self, symbolSequence): diff --git a/field.py b/field.py index eb0dc0c3fc9b140882287dd79ba39822456aab27..ee906e9d94853a31ead5021bddd26352e7d6b889 100644 --- a/field.py +++ b/field.py @@ -236,6 +236,9 @@ class Field: "Got %d, expected %d" % (len(idx), self.field.indexDimensions)) return Field.Access(self.field, self._offsets, idx) + def __getitem__(self, *idx): + return self.__call__(*idx) + @property def field(self): return self._field