# Is Mathematica unaware of an integral representation of the modified Bessel function of the second kind BesselK[0, x]?

Mathematica is unable to produce a result for the following definite integral:

$$\int\limits_{0}^{\infty}\cos{(x \sinh{t})} \ dt$$

Integrate[Cos[x Sinh[t]], {t, 0, Infinity}]


However, this is a standard integral of the form BesselK[0, x], the modified Bessel function of the second kind. Is Mathematica unaware of this definition?

• Could you put the command as code that can be copied. – Himalaya Senapati May 11 '18 at 15:18
• It seems to be aware of the equivalent integral representation Integrate[Cos[x t]/Sqrt[t^2 + 1], {t, 0, Infinity}, Assumptions -> x \[Element] Reals], which returns BesselK[0, Abs[x]]. Mathematica only "knows" the special integrals that it was taught... – MarcoB May 11 '18 at 15:34
• If you add the assumption that x in Reals, then you get the message: Integrate::idiv: Integral of Cos[x Sinh[t]] does not converge on {0,[Infinity]}. – bill s May 11 '18 at 15:51
• Related: mathematica.stackexchange.com/q/4728/1871 (Notice the posts linked to this one. ) – xzczd May 12 '18 at 3:24

Workaround:

func=Cos[x*Sinh[t]];

InverseMellinTransform[Integrate[MellinTransform[func, x, s], {t, 0, Infinity},
Assumptions -> 0 < s < 1], s, x]

(* BesselK[0, x] *)

FourierCosTransform[Integrate[FourierCosTransform[func, x, s], {t, 0, Infinity},
Assumptions -> s > 0], s, x]

(* BesselK[0, x] *)


Summary: Obviously nothing's foolproof.

You can try dumb substitutions:

Integrate[
Cos[x Sinh[t]] Dt[t] /. First@Solve[x Sinh[t] == u, t, Reals] /. {Dt[u] -> 1, Dt[x] -> 0},
{u, 0, ∞}, Assumptions -> x > 0]
(*  BesselK[0, x]  *)


The above converts the integral to almost the same as in @MarcoB's comment.

Here's a general function to do the above more or less automatically:

ClearAll[trydumbsubs];
SetAttributes[trydumbsubs, HoldAll];
trydumbsubs[Integrate[f_, {t_, a_, b_}, Assumptions -> hyp_]] :=
Module[{subs, sub, res = $Failed}, subs = SortBy[ DeleteCases[DeleteDuplicates@Cases[f, (g_)[arg_] :> arg, {0, Infinity}], t], -LeafCount[#] &]; Do[ sub = Solve[arg == u, t, Reals]; If[ListQ[sub], res = Integrate[ f*Dt[t] /. First@sub /. {Dt[u] -> 1, _Dt -> 0}, {u, Limit[arg, t -> a, Assumptions -> hyp], Limit[arg, t -> b, Assumptions -> hyp]}, Assumptions -> hyp ], res =$Failed];
If[FreeQ[res, Integrate | $Failed], Return[res] ], {arg, subs}]; res /; FreeQ[res, Integrate |$Failed]
];


OP's example:

trydumbsubs@ Integrate[Cos[x Sinh[t]], {t, 0, Infinity}, Assumptions -> x > 0 && t > 0]
(*  BesselK[0, x]  *)

• I tried yours code for general function(automata) and dosen't work ? – Mariusz Iwaniuk May 12 '18 at 8:39
• @MariuszIwaniuk Dumb editing mistake. Fixed now, I think. Thanks. – Michael E2 May 12 '18 at 11:29