# simplifying integrals for multiple exponentials

This is somewhat related to this question, but applied to products of Exp[]. For example, I have a symbolic expression containing terms like

$Exp[\int_0^1 f[t]dt](c_1 Exp[\int_1^s f[t]dt]+c_2Exp[-\int_s^1 f[t]dt])$

obtained straight from DSolve[] and FullSimplify[]. How to teach mathematica that the expression can be simplified to

$(c_1+c_2)Exp[\int_0^s f[t] dt]$?

Mathematica evidently won't simplify

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


to

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


on its own. However, you can easily write a function that does what you want, by using Mathematica's ability to have functions do pattern matching on their arguments. Here's a function that will do what we want:

simplifier[Integrate[f_[t_], {t_, tmin_, tmax_}] + Integrate[f_[u_], {u_, tmax_, s_}]] :=
Integrate[f[t], {t, tmin, s}];
simplifier[Integrate[f_[t_], {t_, tmin_, tmax_}] - Integrate[f_[u_], {u_, s_, tmax_}]] :=
Integrate[f[t], {t, tmin, s}];


This may not be 100% robust against corner cases, but it will definitely do what we want in this instance. We can then pass this function to Simplify (or FullSimplify) using the TransformationFunction option, like so:

term = Exp[Integrate[f[t], {t, 0, 1}]]*
(c[1] Exp[Integrate[f[t], {t, 1, s}]] + c[2] Exp[-Integrate[f[t], {t, s, 1}]])

Simplify[term, TransformationFunctions -> {Automatic, simplifier}] // InputForm

E^Integrate[f[t], {t, 0, s}]*(c[1] + c[2])


Putting Automatic in the list of TransformationFunctions tells Simplify to use all of its normal transformations in addition to our additional function simplifier.