private static Monomial getFromProduct(Tensor t, SimpleTensor[] coefficients) { if (!(t instanceof Product)) return null; for (int j = 0; j < t.size(); j++) { if (!(t.get(j) instanceof SimpleTensor)) continue; for (int i = 0; i < coefficients.length; i++) if (t.get(j).equals(coefficients[i])) return new Monomial(((Product) t).remove(j), i); } return null; }
Tensor result = product.remove(modifiedElements.toArray()); processed.add(result); result = expandAndEliminate.transform(
Tensor remnant = product.remove(epsPoss); for (Expression exp : leviCivitaSimplifications) epsSubProduct = exp.transform(epsSubProduct);
assert summand != Complex.ONE; if (summand instanceof Product) summand = ((Product) summand).remove(t); else summand = Complex.ONE;
Tensor dd = current.get(i); if (dd instanceof TensorField && ((TensorField) dd).isDiracDelta()) { temp = product.remove(i); temp = createSubstitution((TensorField) dd).transform(temp); if (!intersects(getSimpleTensorsNames(temp), getSimpleTensorsNames(dd.get(0)))) {
private SplitStruct splitFraction(Tensor tensor) { tensor = factor.transform(tensor); THashMap<Tensor, Complex> map = new THashMap<>(); if (checkPower(tensor)) { map.put(tensor.get(0), ((Complex) tensor.get(1)).negate()); return new SplitStruct(map, Complex.ONE); } if (tensor instanceof Product) { Tensor product = tensor; Tensor temp = null, m; for (int i = tensor.size() - 1; i >= 0; --i) { m = tensor.get(i); if (checkPower(m)) { map.put(m.get(0), ((Complex) m.get(1)).negate()); if (product instanceof Product) temp = product = ((Product) product).remove(i); else { assert i == 0; temp = Complex.ONE; } } } if (temp == null) temp = tensor; return new SplitStruct(map, temp); } return new SplitStruct(map, tensor); }
denominators.put(Tensors.pow(t.get(0), exponent)); if (temp instanceof Product) temp = ((Product) temp).remove(i); else temp = Complex.ONE;
c = product.remove(positionsOfMatrices.toArray()); c = multiply(c, calculatedTraces.build()); iterator.set(simplifications.transform(c));
continue; simplified.add(product.remove(changed.toArray())); Tensor simple = expandAndEliminate.transform(multiplyAndRenameConflictingDummies(simplified)); simple = diracSimplify.transform(simple);