The Levin rule fails because the argument Exp[x^4]
cause an overflow at one of the sample points:
Exp[(x^4)] /. x -> 5.734404367911653`*^7
General::ovfl: Overflow occurred in computation. >>
Overflow[]
First solution
So try a substitution:
Sin@Exp[(x^4)] Dt[x] /. x -> (Log[u])^(1/4)
(*
(Dt[u] Sin[u])/(4 u Log[u]^(3/4))
*)
Then:
NIntegrate[Sin[u]/(4 u Log[u]^(3/4)), {u, E^16, Infinity},
Method -> "LevinRule", MaxRecursion -> 30, PrecisionGoal -> 12,
AccuracyGoal -> 12, WorkingPrecision -> 20]
(*
-3.0179581945309077605*10^-9
*)
Increasing the AccuracyGoal
, PrecisionGoal
, and WorkingPrecision
shows the first six digits are stable.
Another approach
Looking that the integrand, Sin[u]/(4 u Log[u]^(3/4))
, one can see the "amplitude" 1/(4 u Log[u]^(3/4))
is monotonic decreasing. We can treat the integral as an alternating series of areas above and below the axis and bound the terms by a sine function of amplitude 1/(4 u0 Log[u0]^(3/4))
, where u0
is the left endpoint when the graph is above the axis and the right endpoint when it is below. The integral of one cycle is less than the difference in the areas. Further, areas adjacent at the point where the graph crosses from below to above are congruent and cancel (see the green shaded regions below). Thus we have a telescoping series and the integral from the yellow region (at any u0
) to infinity is bounded by the area of the yellow region, which is 2/(4 u0 Log[u0]^(3/4))
.

So if we integrate from x = 2
to x = (Log[10^50 Pi])^(1/4)
, that is u = 10^50 π
, the difference with integral out to infinity is less than 10^-52
:
2./(4 u Log[u]^(3/4)) /. u -> 10^50 π
(*
{4.49478*10^-53}
*)
So we have
NIntegrate[Sin[Exp[(x^4)]], {x, 2, (Log[10^50 Pi])^(1/4)},
PrecisionGoal -> 20, MaxRecursion -> 30, WorkingPrecision -> 30]
(*
-3.01795244987123683885173256511*10^-9
*)
In this case increasing the precision settings shows that all 30 digits are stable.