0
$\begingroup$

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

func

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?
$\endgroup$
  • $\begingroup$ I can't post the question with latex - the system keeps telling me that there is unformatted code in the question... $\endgroup$ – FooBar Jul 1 '17 at 16:40
  • $\begingroup$ I've replaced the TeX with an image. Roll back if you prefer. $\endgroup$ – Michael E2 Jul 2 '17 at 0:10
  • $\begingroup$ @MichaelE2. think it's my image of the outpu that replaced it :-) $\endgroup$ – m_goldberg Jul 2 '17 at 0:11
  • $\begingroup$ @m_goldberg The edit history says you replaced my image with yours -- simultaneous editing. :) $\endgroup$ – Michael E2 Jul 2 '17 at 0:13
3
$\begingroup$

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]

enter image description here

$\endgroup$
0
$\begingroup$

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]}]
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – FooBar Jul 1 '17 at 18:59
  • $\begingroup$ So you need to integrate only when both x and s-x are between nUnder and nBar? $\endgroup$ – John McGee Jul 1 '17 at 19:30
  • $\begingroup$ Yes, that is the case. $\endgroup$ – FooBar Jul 1 '17 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.