diff --git a/sumpy/tools.py b/sumpy/tools.py index d37ef2aa8f98337febebf20320cd91aaec78f6fa..616bd824c1614064a000f945b69c1400c42804c4 100644 --- a/sumpy/tools.py +++ b/sumpy/tools.py @@ -437,19 +437,19 @@ def diff_transformation(derivative_transformation, variable_idx, variables): variable given by **variable_idx** and return a new derivative transformation dictionary """ - new_transformation = defaultdict(lambda: 0) + new_derivative_coeff_dict = defaultdict(lambda: 0) for mi, coeff in derivative_transformation.items(): # In the case where we have x * u.diff(x), the result should # be x.diff(x) + x * u.diff(x, x) # Calculate the first term by differentiating the coefficients new_coeff = sym.sympify(coeff).diff(variables[variable_idx]) if new_coeff != 0: - new_transformation[mi] += new_coeff + new_derivative_coeff_dict[mi] += new_coeff # Next calculate the second term by differentitating the derivatives new_mi = list(mi) new_mi[variable_idx] += 1 - new_transformation[tuple(new_mi)] += coeff - return dict(new_transformation) + new_derivative_coeff_dict[tuple(new_mi)] += coeff + return dict(new_derivative_coeff_dict) # }}}