# How can I check integration $\int_0^c \exp\left(-ax+\frac bx\right)~dx$?

I am trying to integrate $$\int_0^c \exp\left(-ax+\frac bx\right)~dx$$.

I proceed manually in this way (according to https://math.stackexchange.com/questions/2978887/primitive-of-exp-a-times-x-frac-bx?noredirect=1&lq=1):

$$=\int_0^c \exp(-ax-(-\frac bx)~)~dx$$

$$=c\int_1^\infty\dfrac{exp({-\frac{(-b)x}{c}-\frac{ac}{x}})}{x^2}~dx$$

$$=cK_1\left(\dfrac{(-b)}{c},ac\right)$$ (according to https://core.ac.uk/download/pdf/81935301.pdf)

$$K_1(x,y)$$ is a incomplete BesselK function.

I am unable to verify it on Mathematica.

• As far as I know MA does not have incomplete Bessel functions. Commented Jun 23 at 8:13
• How do you want to verify it? Numerically? As far as I can see your manipulation of the integral is correct so you have already proved it by hand. Commented Jun 23 at 10:10
• People here generally like users to post code as copyable Mathematica code as well as images or TeX, so they can copy-paste it. It makes it convenient for them and more likely you will get someone to help you. You may find the meta Q&A, How to copy code from Mathematica so it looks good on this site, helpful Commented Jun 23 at 14:37

## 2 Answers

From defintion leaky aquifer function:

a = 2; b = -3; c = 1;

K[v_, x_, y_] := NIntegrate[Exp[-x*t - y/t]/t^(v + 1), {t, 1, Infinity}](* Leaky Aquifer function *)

c*K[1, -b/c, a*c]
(*0.00205669*)

NIntegrate[Exp[-a*x + b/x], {x, 0, c}]
(*0.00205669*)


The same. Verified :)

$$\int_0^c \exp \left(-a x+\frac{b}{x}\right) \, dx=c K\left[1,-\frac{b}{c},a c\right]$$

You can check random values. It shows they do not agree.

Mathematica's incomplete Bessel function implementation is from help (has to look hard to find it)

Here it is:

LeakyAquiferApprox[u_, ϵ_, n_Integer : 10] :=
ExpIntegralE[1, u] +
Sum[(-ϵ/u)^k/k!  ExpIntegralE[k + 1, u], {k, 1, n}]


So lets look at your integral in the second step and evaluate that. Btw you have typo in sign. I used the version from the answer you linked to

c = 1; a = 2; b = 3;
integrandB = 1/x^2*Exp[-b*x/c - a*c/x]
c*NIntegrate[integrandB, {x, 1, Infinity}]

(* 0.00205669*)


Now we try the answer you gave

 c*LeakyAquiferApprox[-b/c, a*c, 1]//N

(*-16.4111-9.42478 I*)


And in case the order is reversed

 c*LeakyAquiferApprox[a*c,-b/c,1]//N

(*0.105202*)


Not the same. Not verified.

• If I correctly undertand the documentation LeakyAquiferApprox[u,eps] approximates Integrate[Exp[-t-eps/t]/t,{t,u,Infinity}] . There is only linear t in the denominator, but here we need t^2 I think. Perhaps that's the reason for bad verification of your results? Commented Jun 23 at 10:17
• @UlrichNeumann I just copied the function from the help page, where it says also known as incomplete Bessel function) How should it be changed then? Is the help page wrong then? Commented Jun 23 at 10:28
• I think the documentation considers LeakyAquiferApprox[u_, eps_, n_Integer : 10]~NIntegrate[Exp[-y - eps/y]/y, {y, u, Infinity}] which, setting u==1 , equals K[0,1,eps]  (notation from Mariusz Iwaniuk) .But QP needs c K[1, -b/c, a*c] Commented Jun 23 at 15:18