# Integral Too Hard For Mathematica

I have a monstrous integral that I desperately want to solve with Mathematica. It takes the form of:

Integrate[Exp[-2 t^2] t^(9/5) (x-t)^(4/5) HypergeometricPFQ[{1/2, 1}, {7/5, 19/10}, -t^2], {t, 0, x}]


where the numerical parameters can vary a bit. This is just one example. I'm keeping parameters rational in case Mathematica sees a trick it can use. What can I do? I would love to use NIntegrate but one of the bounds has to be variable. I also substituted it a Series approximation to HypergeometricPFQ, and that made it integrate, except the series introduced large error.

Thanks for any and all help.

• Try to solve the corresponding differential equation with NDSolve. – Marius Ladegård Meyer Aug 11 '16 at 20:36
• E[-2 t^2] is not defined. Did you mean Exp[-2 t^2]? – QuantumDot Aug 11 '16 at 20:38
• I was thinking about the fact that if $f(x) = \int_k^x g(t) dt$ then $f(x) = G(x) - G(k)$ where $G'(x) = g(x)$. Mathematica can't do e.g. Integrate[Sin[t]^Exp[t], {t, 0, x}] but it can do NDSolve[f'[x] == Sin[x]^Exp[x] && f[0] == 0, f, {x, 0 10}] just fine. But maybe this is too simple since you have x in the integrand as well... – Marius Ladegård Meyer Aug 11 '16 at 22:12
• I think @MariusLadegårdMeyer is talking about converting your integration into the solution of a differential equation, which is a nice trick in Mathematica. I.e. NIntegrate[f[x], {x, 0, t}] is equivalent to NDSolveValue[{g'[x] == f[x], f[0] == 0}, g, {x, 0, 50}][t] (as long as you choose 50 to be a large enough number, beyond the maximum t you use). The NDSolve version is usually much faster than the NIntegrate version. – march Aug 11 '16 at 22:12
• @march, can you post it as an answer, like to upvote. – bobbym Aug 12 '16 at 4:12

This problem can be solved numerically by

s = ParametricNDSolveValue[{z'[t] == Exp[-2 t^2] t^(9/5) (x - t)^(4/5)
HypergeometricPFQ[{1/2, 1}, {7/5, 19/10}, -t^2], z[0] == 0}, z, {t, 0, x}, {x}];
Plot[s[x][x], {x, 0, 5}]


As noted by Marius Ladegård Meyer in a comment above, NDSolve itself is not sufficient, because x appears both in the integrand and as the upper limit of integration.

• Beautiful job, thank you! Just out of curiosity, what does the second pair of [x] on s do in the Plot command? – Buddhapus Aug 12 '16 at 17:23
• @Buddhapus The first [x] gives the value of the parameter {x} used to solve the ODE. The second [x] gives the value of t for which the solution is desired, which happens to be x in this case.. – bbgodfrey Aug 12 '16 at 17:28

Problem solved with approximation by sum:

$$\int_0^x \exp \left(-2 t^2\right) t^{9/5} (x-t)^{4/5} \, _2F_2\left(\frac{1}{2},1;\frac{7}{5},\frac{19}{10};-t^2\right) \, dt=\\\int_0^x \exp \left(-2 t^2\right) t^{9/5} (x-t)^{4/5} \sum _{k=0}^{\infty } \frac{\left(\left(\frac{1}{2}\right)_k (1)_k\right) \left(-t^2\right)^k}{\left(\left(\frac{7}{5}\right)_k \left(\frac{19}{10}\right)_k\right) k!} \, dt=\\\sum _{k=0}^{\infty } \int_0^x \frac{(-1)^k e^{-2 t^2} t^{\frac{9}{5}+2 k} (-t+x)^{4/5} \left(\frac{1}{2}\right)_k (1)_k}{k! \left(\frac{7}{5}\right)_k \left(\frac{19}{10}\right)_k} \, dt=\\\frac{\Gamma \left(\frac{9}{5}\right) \Gamma \left(\frac{14}{5}\right) \sum _{k=0}^{\infty } \Gamma \left(\frac{1}{2}+k\right) (-1)^k x^{\frac{18}{5}+2 k} \, _2\tilde{F}_2\left(\frac{7}{5}+k,\frac{19}{10}+k;\frac{23}{10}+k,\frac{14}{5}+k;-2 x^2\right)}{8\ 2^{3/5}}$$

f[x_, M_] := 1/(8 2^(3/5))* Gamma[9/5] Gamma[14/5] Sum[Gamma[1/2 + k] (-1)^k x^(18/5 + 2 k)*
HypergeometricPFQRegularized[{7/5 + k, 19/10 + k}, {23/10 + k, 14/5 + k}, -2 x^2], {k, 0, M}]


Error Plot, series only with 20 terms:

 s = ParametricNDSolveValue[{z'[t] ==
Exp[-2 t^2] t^(9/5) (x - t)^(4/5) HypergeometricPFQ[{1/2,
1}, {7/5, 19/10}, -t^2], z[0] == 0}, z, {t, 0, x}, {x}, WorkingPrecision -> 30];
Plot[s[x][x] - f[x, 20], {x, 0, 5}]