SimpleTensor[] vars1 = vars.clone();
for (int i = 0; i < vars.length; ++i)
if (!forbidden.isEmpty() && vars1[i].getIndices().size() != 0) {
if (vars1[i].getIndices().size() != vars1[i].getIndices().getFree().size())
vars1[i] = (SimpleTensor) renameDummy(vars1[i], forbidden.toArray());
forbidden.addAll(getIndicesNames(vars1[i].getIndices()));
}
tensor = renameDummy(tensor, TensorUtils.getAllIndicesNamesT(vars1).toArray());
for (SimpleTensor var : vars1)
tensor = differentiate1(tensor, createRule(var), expandAndContract);