# Principal value from two different axis

I have an integral where its limits of integration is from the imaginary axis to the real axis, specifically,

$$\int_{\pi i/2}^\infty \frac{dp}{\sinh(p/2) \sqrt{\cosh(p)}}$$

I want to evaluate this along the contour from $$[\pi i/2,0]$$ then $$[0,\infty]$$ (L-shaped contour). However, the integrand has a pole at $$p=0$$. Is there any way to use the principal value method to evaluate this integral?

If you evaluate func[p] near the pole from the imaginary axis and from the real axis, you will see that they diverge in the opposite direction (one positive one negative) albeit in different axes. I have tried for example at $$p=10^{-4}$$.

func[p_] := 1/(Sinh[p/2] Sqrt[Cosh[p]])

func[10^-4 I] // N
0. - 20000. I

func[10^-4] // N
20000.

NIntegrate[func[p], {p, Pi I/2, 0, 100}, Method -> PrincipalValue]

NIntegrate::izero: Integral and error estimates are 0 on all integration subregions. Try increasing the value of the MinRecursion option. If value of integral may be 0, specify a finite value for the AccuracyGoal option.

-1.76275 + 3.14159 I


I only know the principal value method if evaluating on the same axes. However I still tried to use NIntegrate.

• Meanwhile I found a direct way to solve your problem in one step: NIntegrate[func[ p], {p, I Pi/2, 0 I, Infinity}, Method -> "PrincipalValue"] (*-1.76275 + 3.14159 I*) Jul 28 at 7:36

final version(corrected)

Perhaps you could try to integrate along a path which excludes the singular point p= 0+I 0  (quarter-circle radius eps) :

int[eps_?NumericQ] :=
NIntegrate[func[ p], {p, I Pi/2, I eps}] +
NIntegrate[func[eps (Sin[\[CurlyPhi]] + I Cos[\[CurlyPhi]])] D[
eps (Sin[\[CurlyPhi]] +I Cos[\[CurlyPhi]]), \[CurlyPhi]], {\[CurlyPhi], 0, Pi/2}] +
NIntegrate[func[p], {p, eps, Infinity}]


The Limit eps->0 gives the integral you're looking for.

Table[{10^-n, int[10^-n]}, {n, 1, 5}] // N
(*{{0.1, -1.76275 - 3.14159 I}, {0.01, -1.76275 -3.14159 I}, {0.001, -1.76275 - 3.14159 I}, {0.0001, -1.76275 -3.14159 I}, {0.00001, -1.76275 - 3.14159 I}}*)


Modification of the integration path confirms the result:

int[eps_?NumericQ] := { NIntegrate[func[ p], {p, I Pi/2, I eps}],
NIntegrate[func[z], {z, I eps, eps }]
, NIntegrate[func[p], {p, eps, Infinity} ]} // Total

Table[{10^-n, int [10^-n ]}, {n, 8, 10}] // N // Simplify // Chop
(*{{1.*10^-8, -1.76275 - 3.14159 I}, {1.*10^-9, -1.76275 - 3.14159 I}, {1.*10^-10, -1.76275 - 3.14159 I}}*)

• I have tried to use your code but replaced Infinity by some large number, say 10^3. It does not give any result. when doing Limit[int[eps], eps -> 0]. However, this integral with the corresponding small quarter-circle radius taken into account should produce a finite value, at least in principle. They don't converge I think is because the imaginary part and real part are still separate. The integral on the imaginary axis should produce a real value so that the appropriate divergence cancels. Jul 25 at 10:44
• If you notice the table that you produced, the real and imaginary part should cancel, at least in their values as eps->0. Jul 25 at 10:46
• An example is NIntegrate[func[p], {p, 10^-2 I, Pi I/2}] which produces a real value 11.9829 + 0. I Jul 25 at 10:48
• @mathemania Because it's a numerically definition of int[eps] Limit[int[eps], eps -> 0] cannot work. Jul 25 at 11:00
• @mathemania No the values mustn't cancel . The integral along the imaginary axis gives an imaginary value, the integral along the real axis evaluates real. Jul 25 at 11:06