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$


$=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.

  • $\begingroup$ As far as I know MA does not have incomplete Bessel functions. $\endgroup$
    – yarchik
    Commented Jun 23 at 8:13
  • $\begingroup$ 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. $\endgroup$ Commented Jun 23 at 10:10
  • $\begingroup$ 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 $\endgroup$
    – Michael E2
    Commented Jun 23 at 14:37

2 Answers 2


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]

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

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)

enter image description here

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



Not the same. Not verified.

  • 1
    $\begingroup$ 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? $\endgroup$ Commented Jun 23 at 10:17
  • $\begingroup$ @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? $\endgroup$
    – Nasser
    Commented Jun 23 at 10:28
  • $\begingroup$ 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] $\endgroup$ Commented Jun 23 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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