# calculus and analysis – Wildcard replacement from sums and integrals using NCAlgebra’s NCReplaceRepeated

I want to use the NCAlgebra package to do some simplification on non commutative expressions involving integrals. For example, one such expression would be

$$I=left(int f(x)g(x) dxright) * h$$

where $$*$$ denotes non-commutative multiplication. Let’s say that I know that $$g(x)*h=1$$ for all $$x$$. Then, simplifying the above expression yields

$$I=int f(x)dx$$

So far, I have tried the following to implement this in Mathematica:

``````<< NC`
<< NCAlgebra`

NCReplaceRepeated((A b(X) F(X)) ** (G h J), b(X_) ** h -> 1)
``````

which results in

``````A G J F(X)
``````

as expected. However, this does not work for

``````NCReplaceRepeated((Integrate(A b(X) F(X), X)) ** (G h J), b(X_) ** h -> 1)
``````

which results in

``````A G J (Integrate(b(X) F(X), X)) ** h
``````

which does not respect this simplification.

Of course, there need to be several assumptions about the integral regarding e.g. convergence. But I want to assume that “everything works out nicely” and that this type of simplification is OK. Additionally, instead of `Integrate`, `Sum` might be used. This simplification does not work either.

How can I properly perform this simplification?

Posted on Categories Articles