The following is not particularly fast and could be more accurate but does make progress toward the goals set in the Question. To begin, consider the analytical properties of f
, as defined in the Question. By observation, it has branch points at
{I Sqrt[6/5] ξ, I Sqrt[2/5] ξ}
and their conjugates. Poles are obtained by
p /. Simplify[Solve[Denominator[f[p, ξ]] == 0, p], ξ > 0] // Flatten
(* {0, -2 I Sqrt[1/15 (3 - Sqrt[3])] ξ, 2 I Sqrt[1/15 (3 - Sqrt[3])] ξ} *)
with corresponding residues,
Simplify[Residue[f[p, ξ], {p, #}] & /@ %, ξ > 0]
(* {-(3/(8 ξ)), Sqrt[1 + Sqrt[3]]/(8 (Sqrt[33 - 19 Sqrt[3]] - 2 Sqrt[3 - Sqrt[3]] +
Sqrt[9 + 5 Sqrt[3]]) ξ), ...} *)
Remark
If you're in v9.0.1, the Residue
s of $\pm 2 i \sqrt{\frac{1}{15} \left(3-\sqrt{3}\right)} \xi$ won't be calculated correctly due
to a bug, please use
Simplify[(SeriesCoefficient[Exp[p t] f[p, ξ], {p, #, -1}] &) /@ %, ξ > 0]
instead to calculate the residues.
(The third Residue
is the same as the second.) The poles and branch cuts can be seen in the plots, here for ξ == 1
,
Row[Plot3D[#, {pr, -1, 1}, {pi, -1, 1}, ImageSize -> Medium,
PlotRange -> {-2, 2}, AxesLabel -> {pr, pi, f}] & /@ ReIm[f[pr + I pi, 1]]]
all lying along the imaginary axis, and the branch cuts running from the corresponding branch points to I Infinity
and its conjugate.
From these results it is evident that the Bromwich contour of the first expression in the Question must lie to the right of the imaginary axis and should be somewhat to the right to minimize integration issues. The integral over p
as a function of ξ
for t == 2
is
Plot[(ξ NIntegrate[f[1 + I pi, ξ] Exp[2 (1 + I pi)], {pi, -Infinity, Infinity}] // Chop)
/(2 Pi), {ξ, 0, 50}, PlotRange -> All]
This computation, which takes a few minutes on my PC, seems quite accurate, as can be seen by varying the real part of p
for the contour integration. The integration over ξ
is neither fast nor accurate, unfortunately.
pinv[ξ_?NumericQ] := NIntegrate[f[1 + I pi, ξ] Exp[2 (1 + I pi)]/(2 Pi),
{pi, -Infinity, Infinity}] // Chop
NIntegrate[ξ BesselJ[0, ξ] pinv[ξ], {ξ, 0, Infinity},
MaxRecursion -> 40, Method -> "ExtrapolatingOscillatory"]
(* SequenceLimit::seqlim: The general form of the sequence could not be determined,
and the result may be incorrect. *)
(* -0.423105 *)
rather than the desired -3/8
.
However, further progress can be made be rewriting f
as
f1[p_,ξ_] = -5 p Sqrt[Sqrt[5/6] p + I ξ] Sqrt[Sqrt[5/6] p - I ξ]/
(4 (-4 ξ^2 Sqrt[Sqrt[5/6] p + I ξ] Sqrt[Sqrt[5/6] p - I ξ] Sqrt[Sqrt[5/2] p + I ξ]
Sqrt[Sqrt[5/2] p - I ξ] + ((5 p^2)/2 + 2 ξ^2)^2))
which causes the branch cuts to extend along lines of constant Im[p]
from - Infinity
to the branch points. The Bromwich contour then can be distorted to yield a solution consisting of the three Residue
s plus integrals of the discontinuities along the four branch cuts. The Residue
s alone give a qualitatively reasonable rendition of the plot in the Question.
Plot[Integrate[BesselJ[0, ξ] Cos[ξ t 2 Sqrt[1/15 (3 - Sqrt[3])]], {ξ, 0, Infinity}]
2 Sqrt[1 + Sqrt[3]]/(8 (Sqrt[33 - 19 Sqrt[3]] - 2 Sqrt[3 - Sqrt[3]] +
Sqrt[9 + 5 Sqrt[3]]) ) - 3/8, {t, 0, 2}, PlotRange -> {-.5, 1.5}, AxesLabel -> {t, F}]
Although the value of the integral is -3/8
, as desired, for large t
, the curve is not accurate at small t
and, of course, does not include the integrals along the branch cuts. These are given for t == 2
by
inv65[ξ_?NumericQ] := ξ Im[NIntegrate[(f1[ξ Sqrt[6/5] I + pr - .00001 I, ξ] -
f1[ξ Sqrt[6/5] I + pr + .00001 I, ξ]) Exp[2 pr], {pr, -Infinity, 0}]
Exp[2 ξ Sqrt[6/5] I]]/Pi
inv25[ξ_?NumericQ] := ξ Im[NIntegrate[(f1[ξ Sqrt[2/5] I + pr - .00001 I, ξ] -
f1[ξ Sqrt[2/5] I + pr + .00001 I, ξ]) Exp[2 pr], {pr, -Infinity, 0}]
Exp[2 ξ Sqrt[2/5] I]]/Pi
Plot[{inv65[ξ], inv25[ξ]}, {ξ, 0, 50}, PlotRange -> {-.04, .04}]
These branch cut integrals offer two advantages over the Bromwich integration discussed above. First, the integrals themselves converge more rapidly due to the factors Exp[2 pr]
. Second, the results decrease rapidly with ξ
. Hence, the contribution to the t == 2
total result,
NIntegrate[BesselJ[0, ξ] (inv65[ξ] + inv25[ξ]), {ξ, 0, Infinity},
MaxRecursion -> 40, Method -> "ExtrapolatingOscillatory"]
(* 0.000191503 *)
is acceptably close to the desired value of 0
despite error messages. Presumably, a smaller value could be obtained using larger values of WorkingPrecision
, although the already slow computation would be far slower still. The curve in the Question can be reproduced reasonably well by
inv[ξ_?NumericQ, t_?NumericQ] :=
ξ Im[NIntegrate[(f1[ξ Sqrt[6/5] I + pr - .00001 I, ξ] -
f1[ξ Sqrt[6/5] I + pr + .00001 I, ξ]) Exp[t pr],
{pr, -Infinity, 0}] Exp[t ξ Sqrt[6/5] I]]/Pi +
ξ Im[NIntegrate[(f1[ξ Sqrt[2/5] I + pr - .00001 I, ξ] -
f1[ξ Sqrt[2/5] I + pr + .00001 I, ξ]) Exp[t pr],
{pr, -Infinity, 0}] Exp[t ξ Sqrt[2/5] I]]/Pi
tinv = Table[NIntegrate[BesselJ[0, ξ] inv[ξ, t], {ξ, 0, Infinity},
MaxRecursion -> 40, Method -> "ExtrapolatingOscillatory"] +
Integrate[BesselJ[0, ξ] Cos[ξ t 2 Sqrt[1/15 (3 - Sqrt[3])]], {ξ, 0, Infinity}]
2 Sqrt[1 + Sqrt[3]]/(8 (Sqrt[33 - 19 Sqrt[3]] - 2 Sqrt[3 - Sqrt[3]] +
Sqrt[9 + 5 Sqrt[3]]) ) - 3/8, {t, .01, 2, .01}];
ListLinePlot[tinv, DataRange -> {0.01 Sqrt[2/5], 2 Sqrt[2/5]},
PlotRange -> {{0, 1.2}, {-0.8, 1.6}}, AxesLabel -> {Style["τ", 20], None},
AxesOrigin -> {0, -.1}]
This curve required a few hours to produce, although significant savings could have been obtained with ParallelTable
and some simplification of the integrands. That the computations in the reference given in the Question are so much faster reinforces the observation that superior algorithms typically trump superior coding.
Addendum
In response to a comment below, this additional material elaborates on the inverse Laplace transform of f1
and compares it with the inverse Laplace transform of f
. As already discussed, f1
exhibits four branch cuts and three poles, shown in red in the plot immediately below for ξ == 1
.
The Bromwich integration contour described in the Question is a vertical line in the p
plane, lying to the right of all branch cuts and poles, shown in the plot as a dashed line. Although the integration indicated by the first expression in the Question can be performed along this contour, the discussion in the latter part of this Answer indicated that it can be useful to transform the contour by shifting it far to the left, where it becomes a set of contours around the branch cuts and poles, as illustrated in the plot. (To minimize clutter, the contours are shown for only one each of the cuts and poles.) The portions of the shifted contour that are at p == - Infinity
are ignored, because the integral vanishes there due to the integrand factor Exp[p t]
. Integrals along the branch cuts in effect integrate the discontinuity of f1
across those cuts, and the integrals around the poles are, of course, their Residue
s.
Just as the contour segments shown in the plot can be separated into components arising from the poles and from the branch cuts, the same can be done for the result of the original Bromwich contour integration in the early part of this Answer. The next plot compares (1) the sum of the branch cut integrals from the fourth plot above, and (2) the result in the second plot above after subtracting the pole contributions.
Plot[{ξ Im[NIntegrate[(f1[ξ Sqrt[6/5] I + pr - .00001 I,ξ] -
f1[ξ Sqrt[6/5] I + pr + .00001 I, ξ]) Exp[2 pr], {pr, -Infinity, 0}]
Exp[2 ξ Sqrt[6/5] I]]/Pi
+ ξ Im[NIntegrate[(f1[ξ Sqrt[2/5] I + pr - .00001 I, ξ] -
f1[ξ Sqrt[2/5] I + pr + .00001 I, ξ]) Exp[2 pr], {pr, -Infinity, 0}]
Exp[2 ξ Sqrt[2/5] I]]/Pi,
(ξ NIntegrate[f[1 + I pi, ξ] Exp[2 (1 + I pi)], {pi, -Infinity, Infinity}] // Chop)
/(2 Pi) -
Cos[ξ 4 Sqrt[1/15 (3 - Sqrt[3])]] 2 Sqrt[1 + Sqrt[3]]/(8 (Sqrt[33 - 19 Sqrt[3]]
- 2 Sqrt[3 - Sqrt[3]] + Sqrt[9 + 5 Sqrt[3]]) ) + 3/8}, {ξ, 0, 50},
PlotRange -> {-.08, .08}]
Not surprisingly, the two curves are virtually identical. As explained earlier, this decomposition is desirable, because the ξ
integration can be performed symbolically for the pole contributions, resulting in the third plot. Indeed, the seemingly simple appearance of the branch cut contributions in the fourth plot suggest that they too could be represented by symbolic expressions, which might lead to further symbolic ξ
integrations.
NIntegrate
optionMethod->{Automatic,"SymbolicProcessing"->0}
(replaceAutomatic
by whatever you find works best) affect e.g. timings of GWR approach? This might at least improve speed by a lot because I suspect it takes much time to play around with the Bessel stuff... $\endgroup$"SymbolicProcessing" -> 0
seems not to help here... for this integral the only 2 available methods seem to be"ExtrapolatingOscillatory"
and"LevinRule"
."SymbolicProcessing"
isn't an option for"LevinRule"
, and doesn't improve the speed of"ExtrapolatingOscillatory"
, what's more, because of a bug mentioned here, one will be unable to adjust theMaxRecursion
option ifMethod -> {"ExtrapolatingOscillatory", "SymbolicProcessing" -> 0}
is used. $\endgroup$