# Evaluating integral seems incorrect

I have used Mathematica to evaluate this integral

$$\int_0^\infty \exp\left(-\frac{t}{\gamma}-\frac{|t-\tau|}{\mu}\right) \left(t-\frac{t^2}{2\gamma}\right)dt = \frac{\gamma^3/\mu}{(1-\gamma/\mu)^3}e^{-\tau/\mu}$$

for any $\tau>0$. The solution reflects that the integral blows up when $\gamma = \mu$.

However, the integral seems to converge.

Am I using the correct syntax?

Integrate[E^(-Abs[t - s]/m - t/g) (t - t^2/(2 g)), t, Assumptions -> {m>0 && g>0 && s>0}]


The limits $t\to 0$, $t\to\infty$ clearly evaluate to the answer I have above.

Thank you!

• Not t use {t,0,Infinity} inside Integrate. Jun 7, 2018 at 10:18
• Sure, but is the same as evaluating the indefinite integral and then plugging in the limits.
– user55387
Jun 7, 2018 at 10:18
• It depends if function is continuous.In your case it is not.Try:Integrate[ 1/γ^2* Exp[-t/γ - RealAbs[t - τ]/μ]*(t - t^2/(2*γ)), t] and ? Jun 7, 2018 at 10:23
• So it would be Integrate[ 1/γ^2* Exp[-t/γ - RealAbs[t - τ]/μ]*(t - t^2/(2*γ)), {t,0,Infinity}] ?
– user55387
Jun 7, 2018 at 10:29

Adding Assumptions its better option to Integrate.

INT = Integrate[1/γ^2*Exp[-t/γ - Abs[t - τ]/μ]*(t - t^2/(2*γ)), {t, 0, Infinity},
Assumptions -> {μ > 0, γ > 0, τ > 0}] // FullSimplify


$\frac{\mu e^{\tau \left(-\left(\frac{1}{\gamma }+\frac{1}{\mu }\right)\right)} \left(\gamma ^2 \mu (\gamma +\mu )^3 e^{\frac{\tau }{\gamma }}-e^{\frac{\tau }{\mu }} \left(2 \gamma \tau \left(\mu ^4-\gamma ^4\right)+\tau ^2 \left(\gamma ^2-\mu ^2\right)^2+2 \gamma ^2 \mu ^2 \left(3 \gamma ^2+\mu ^2\right)\right)\right)}{\gamma \left(\gamma ^2-\mu ^2\right)^3}$

Without Assumptions option MMA fail to give the answer.We can use RealAbs than Abs

 Integrate[1/γ^2*Exp[-t/γ - RealAbs[t - τ]/μ]*(t - t^2/(2*γ)), {t,0, Infinity}]// FullSimplify


$\begin{cases} \text{Integrate}\left[\frac{\left(t-\frac{t^2}{2 \gamma }\right) e^{-\frac{\left| t-\tau \right| }{\mu }-\frac{t}{\gamma }}}{\gamma ^2},\{t,0,\infty \},\text{Assumptions}\to \Re\left(\frac{1}{\gamma }+\frac{1}{\mu }\right)\leq 0\right] & \left(\tau >0\land \Re\left(\frac{1}{\gamma }+\frac{1}{\mu }\right)\leq 0\right)\lor \left(\tau \leq 0\land \Re\left(\frac{1}{\gamma }+\frac{1}{\mu }\right)\leq 0\right) \\ \frac{\gamma \mu ^2 \sinh \left(\frac{\tau }{\mu }\right)+\gamma \mu ^2 \cosh \left(\frac{\tau }{\mu }\right)}{(\gamma +\mu )^3} & \tau \leq 0\land \Re\left(\frac{1}{\gamma }+\frac{1}{\mu }\right)>0 \\ \frac{\mu \left(\gamma ^5 \mu \sinh \left(\frac{\tau }{\gamma }\right)+2 \gamma ^5 \tau \sinh \left(\frac{\tau }{\mu }\right)+\gamma ^5 \mu \cosh \left(\frac{\tau }{\gamma }\right)+2 \gamma ^5 \tau \cosh \left(\frac{\tau }{\mu }\right)+3 \gamma ^4 \mu ^2 \sinh \left(\frac{\tau }{\gamma }\right)-6 \gamma ^4 \mu ^2 \sinh \left(\frac{\tau }{\mu }\right)+3 \gamma ^4 \mu ^2 \cosh \left(\frac{\tau }{\gamma }\right)-6 \gamma ^4 \mu ^2 \cosh \left(\frac{\tau }{\mu }\right)-\gamma ^4 \tau ^2 \sinh \left(\frac{\tau }{\mu }\right)-\gamma ^4 \tau ^2 \cosh \left(\frac{\tau }{\mu }\right)+3 \gamma ^3 \mu ^3 \sinh \left(\frac{\tau }{\gamma }\right)+3 \gamma ^3 \mu ^3 \cosh \left(\frac{\tau }{\gamma }\right)+\gamma ^2 \mu ^4 \sinh \left(\frac{\tau }{\gamma }\right)-2 \gamma ^2 \mu ^4 \sinh \left(\frac{\tau }{\mu }\right)+\gamma ^2 \mu ^4 \cosh \left(\frac{\tau }{\gamma }\right)-2 \gamma ^2 \mu ^4 \cosh \left(\frac{\tau }{\mu }\right)+2 \gamma ^2 \mu ^2 \tau ^2 \sinh \left(\frac{\tau }{\mu }\right)+2 \gamma ^2 \mu ^2 \tau ^2 \cosh \left(\frac{\tau }{\mu }\right)-2 \gamma \mu ^4 \tau \sinh \left(\frac{\tau }{\mu }\right)-2 \gamma \mu ^4 \tau \cosh \left(\frac{\tau }{\mu }\right)-\mu ^4 \tau ^2 \sinh \left(\frac{\tau }{\mu }\right)-\mu ^4 \tau ^2 \cosh \left(\frac{\tau }{\mu }\right)\right) \left(\cosh \left(\frac{\tau }{\gamma }+\frac{\tau }{\mu }\right)-\sinh \left(\frac{\tau }{\gamma }+\frac{\tau }{\mu }\right)\right)}{\gamma (\gamma -\mu )^3 (\gamma +\mu )^3} & \text{True} \end{cases}$

Check:

INT /. γ -> 2 /. μ -> 1 /. τ -> 1 // N(* Assumed parameters *)
(* 0.14046 *)

INTN[γ_, μ_, τ_] := NIntegrate[1/γ^2*Exp[-t/γ - Abs[t - τ]/μ]*(t - t^2/(
2*γ)), {t, 0, Infinity}]
INTN[2, 1, 1]

(* 0.14046 *)


About blows up when $γ=μ$ use Limit:

Limit[INT /. γ -> 2 /. τ -> 1, μ -> 2] // N

(* 0.176905 *)

INTN[γ_, μ_, τ_] := NIntegrate[1/γ^2*
Exp[-t/γ - Abs[t - τ]/μ]*(t - t^2/(2*γ)), {t, 0, Infinity}]
INTN[2, 2, 1]

(* 0.176905 *)