# Get rid of unnecessary conditions

I define a piecewise function as

g[x_] :=
Piecewise[
{{lambda * Exp[lambda *(x - nBar)]/(1 - Exp[lambda*(nUnder - nBar)]),
nUnder <= x <= nBar}}, 0]

I would like to define and compute another function g2, assuming that 0 < nUnder < nBar:

$$g_2(x) = \int g(s-t)g(t)dt$$

g2[s_] := Assuming[{nBar - nUnder > 0}, Integrate[g[s - x]*g[x], {x, nUnder, nBar}]]
g2[s]

The output is

or

Piecewise[
{{-((E^(lambda*s)*lambda^2*(-2*nBar + s))/(E^(lambda*nBar) - E^(lambda*nUnder))^2),
nBar - nUnder > 0 && nBar + nUnder - s < 0 && 2*nBar - s > 0},
{(E^(lambda*s)*lambda^2*(-2*nUnder + s))/(E^(lambda*nBar) - E^(lambda*nUnder))^2,
(nBar + nUnder - s == 0 && nBar - nUnder > 0) ||
(nBar + nUnder - s >= 0 && nBar - nUnder > 0 &&
2*nUnder - s < 0)}},
0]

in input form.

As you can see, it keeps iterating the assumption nBar - nUnder > 0 — but I thought I enforced that by using Assuming?

1. How can I simplify g2 to permanently work under the assumption nBar > nUnder > 0? Simplify was of no help.
2. Similarly, it would help to redefine g2 for the domain 2 nUnder <= s <= 2 nBar, to get rid of some other of the conditions. Can I achieve that somehow?
• I can't post the question with latex - the system keeps telling me that there is unformatted code in the question... – FooBar Jul 1 '17 at 16:40
• I've replaced the TeX with an image. Roll back if you prefer. – Michael E2 Jul 2 '17 at 0:10
• @MichaelE2. think it's my image of the outpu that replaced it :-) – m_goldberg Jul 2 '17 at 0:11
• @m_goldberg The edit history says you replaced my image with yours -- simultaneous editing. :) – Michael E2 Jul 2 '17 at 0:13

Include Simplify in definition of g2

g[x_] := Piecewise[{{lambda*
Exp[lambda*(x - nBar)]/(1 - Exp[lambda*(nUnder - nBar)]),
nUnder <= x <= nBar}}, 0]

g2[s_] = Assuming[{nBar > nUnder > 0},
Integrate[g[s - x]*g[x], {x, nUnder, nBar}] //
Simplify]

Try removing the Piecewise definition and only integrate over the required region.

g2[x_] := lambda*Exp[lambda*(x - nBar)]/(1 - Exp[lambda*(nUnder - nBar)])

Integrate[g2[x], {x, nUnder, nBar}]

Integrate[g2[s - x]*g2[x], {x, Max[nUnder, s - nUnder], Min[s - nBar, nbar]}]
• Integrate[g2[s - x]*g2[x], {x, nUnder, nBar}] ensures that g2[x] is only integrated over the required domain, but g2[s-x] in general is not necessarily inside the required domain. – FooBar Jul 1 '17 at 18:59
• So you need to integrate only when both x and s-x are between nUnder and nBar? – John McGee Jul 1 '17 at 19:30
• Yes, that is the case. – FooBar Jul 1 '17 at 20:10