Is there a way to get the symbolic result of the following integral?

$$f(x) = \int_{-\infty}^{\infty} \text{Tanh}\left(\frac{u}{2}\right)e^{-\frac{(u-x)^2}{4x}}du$$


Where $-4 \leq x \leq 4$ is a real value. It suffice to have $|x|\leq4$, but $x$ can be larger for other applications.

Thanks for helping.

  • $\begingroup$ for: x<=0 integral is divergent. ? $\endgroup$ – Mariusz Iwaniuk Aug 3 '18 at 15:04
  • $\begingroup$ @Mariusz: Thanks... If I change the range of $x$ to $0 < x \leq 4$? $\endgroup$ – Arvid Aug 3 '18 at 15:06
  • $\begingroup$ Hard integral they are difficult to solve,or impossible to find closed-form. Only hope is numeric. math.stackexchange.com/questions/1754192/… $\endgroup$ – Mariusz Iwaniuk Aug 3 '18 at 15:25
  • 1
    $\begingroup$ It looks like if you were interested in $x>20$ that $3.545 \sqrt{x}$ (and maybe that is exactly $2 \sqrt{\pi x}$) would be a good approximation. $\endgroup$ – JimB Aug 3 '18 at 17:51
  • 1
    $\begingroup$ Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code you have tried yourself in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned. $\endgroup$ – rhermans Aug 3 '18 at 20:27

It's not a full answer.

Using the identities $\color{red}{\tanh (x)=\frac{\exp (2 x)-1}{\exp (2 x)+1}}$ and $\color{red}{\sum _{k=0}^{\infty } (-1)^k \exp ^k(x)=\frac{1}{1+e^x}}$,

we obtain:

$$\int_{-\infty }^{\infty } \tanh \left(\frac{x}{2}\right) \exp \left(-\frac{(x-a)^2}{4 a}\right) \, dx=\\\int_{-\infty }^{\infty } \frac{(\exp (x)-1) \exp \left(-\frac{(x-a)^2}{4 a}\right)}{\exp (x)+1} \, dx=\\\sum _{k=0}^{\infty } \int_{-\infty }^{\infty } (-1)^k e^{k x-\frac{(-a+x)^2}{4 a}} \left(-1+e^x\right) \, dx=\\\sum _{k=0}^{\infty } -2 (-1)^k \sqrt{a} \left(e^{a k (1+k)}-e^{a (1+k) (2+k)}\right) \sqrt{\pi } $$

Integrate[(-1)^k E^(k x - (-a + x)^2/(4 a)) (-1 + E^x), {x, -Infinity,
Infinity}, Assumptions -> {a \[Element] Reals, k >= 0}, PrincipalValue -> True]
(* -2 (-1)^k Sqrt[a] (E^(a k (1 + k)) - E^(a (2 + 3 k + k^2))) Sqrt[\[Pi]] *)

Closed form of sum probably doesn't exist. The sum is very fast convergent, but for a>0, it is divergent. We can compute only the imaginary part of a for a<0. If a<0, the real part of the sum is 0.

With a->Im[-Infinity], $-2 \sqrt{-\pi a}$ is a good approximation, then is exact formula.

 f[a_] := Sum[-2 (-1)^k Sqrt[a] (E^(a k (1 + k)) - E^(a (2 + 3 k + k^2))) Sqrt[\[Pi]], {k, 0, 10}] // Im
 Plot[{f[a], -2 Sqrt[-Pi* a]}, {a, -4, 0}, PlotLegends -> {Sum, -2 Sqrt[-Pi a]}, PlotStyle -> {Red, {Dashed, Black}}]

enter image description here

We can find the first term of the asymptotic for $a\to \infty$:

INT = Integrate[InverseZTransform[(E^(-((a - x)^2/(4 a))) (-1 + E^x))/(b + E^x), b, s], {x, -Infinity, Infinity}, 
Assumptions -> {s > 0, a > 0}];
ZTransform[INT, s, 1]

$2 \sqrt{a} \sqrt{\pi } \left(-\left(\mathcal{Z}_s\left[e^{a s (1+s)}\right](-1)\right)+\mathcal{Z}_s\left[e^{2 a (1+s)+a s (1+s)}\right](-1)\right)$


$\int_{-\infty }^{\infty } \tanh \left(\frac{x}{2}\right) \exp \left(-\frac{(x-a)^2}{4 a}\right) \, dx\approx2 \sqrt{\pi a}$ if $a\to \infty$

MMA can't find ZTransform, but we have good approximation (see comment by user JimB).


The numerical workaround could be:

i[x_?NumericQ]:= NIntegrate[Tanh[u/2] Exp[-((u - x)^2/(4 x))], {u, -∞, ∞}]
Plot[i[x], {x, 0, 4 }]

enter image description here

which gives you an idea of the unknown shape of the integral .


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.