# Why doesn't Mathematica ComplexExpand integrals?

Consider this code example:

ComplexExpand[Re[Integrate[f[t], {t, a, b}]]]


Mathematica gives me the result as

Re[Integrate[f[t], {t, a, b}]]


which is obviously not helpful and not what should happen in my understanding. If all variables are real - and that's what ComplexExpand assumes according to the documentation - then Re can be dropped from the expression. The same happens for Im. This seems to confuse FullSimplify which leaves me with a long expression that could be shorted. Why is this the case? How can I get Integrate (and Re) to evaluate properly to simply

Integrate[f[t], {t, a, b}]

• It works on inactive integrals in V12.1.1. – Michael E2 Aug 6 at 21:29
• Let me rephrase: It does what you wanted done. – Michael E2 Aug 6 at 21:37
• Whenever you alter an expression, it reevaluates (unless held). Evaluating Integrate is often very expensive; depending on the version, IIRC, some parts cannot be interrupted. Blithely letting Simplify etc. hack away at it might be the last thing the kernel would ever do: You'd have to kill (force-quit) it and restart the kernel. If it were my system, I think I'd protect the user from that and maybe invent Inactive -- actually, I was using Hold for years to do that before they introduced Inactive. That said, the algebra of inactive integrals (and sums) is not fully realized. – Michael E2 Aug 6 at 21:49
• @MichaelE2 I think I understand what you mean. But how can I resolve this? – HerpDerpington Aug 6 at 22:25
• My comment was my limited user-view response to your question, "Why is this the case?" But perhaps your real question is how to get ComplexExpand to work on Integrate or implement such a function. – Michael E2 Aug 6 at 22:47