Due to the fact that almost everything I do in my research is analytic, I am quite unfamiliar with numeric calculus, so I was wondering if anyone could give me some advice on the most efficient way to face the following problem.
I have a power series of the form $S\equiv\sum_{n=1}^\infty c_n a^n$, where $a\in(0,1)$ and the coefficients are:
$$c_n\equiv \frac{1}{2^{n+1}\pi} \int_{-\pi}^\pi d\varphi\,{}\frac{\Gamma(n)-\Gamma(n,2i\varphi)}{(1+ia\varphi)^n},$$ where of course $i$ is the imaginary unit. The problem here is that the integral defining $c_n$ , despite convergent, does not seem to have a solution in terms of the known functions. This means that any analysis on the series $S$ must be performed numerically.
My main concern is to get an idea of the convergence radius of the series, which people claim (with no proof) that is somewhere between $1/\pi$ and $1$. To do this I need to extract the numerical values of $c_n$ for large $n$, as big as it is possible, and perform things such as the root and ratio tests. The only trick I could think of to improve the numeric computations is to write $$c_n= \frac{\Gamma(n)}{2^{n+1}\pi} \int_{-\pi}^\pi d\varphi\,{}\frac{1-\tilde{\Gamma}(n,2i\varphi)}{(1+ia\varphi)^n},$$ where $\tilde{\Gamma}$ is the regularized version of the (incomplete) gamma function: $\tilde{\Gamma}(a,z)=\Gamma(a,z)/\Gamma(a)$. This, I believe, avoids cancelations between large numbers.
The main issues I find are (I am using the NIntegrate
mathematica function):
- I can only get to $n\approx 200$. For higher values I get the folllowing error:
NIntegrate::errprec: Catastrophic loss of precision in the global error estimate due to insufficient WorkingPrecision or divergent integral.
- Increasing
WorkingPrecision
to 20 returns two more errors:
NIntegrate::precw: The precision of the argument function ((1-GammaRegularized[241,2 I \[Phi]])/(1+(0. +0.2 I) \[Phi])^241) is less than WorkingPrecision (20.`).
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.
- Finally, I have observed that several values of $n$ (such as $n=32$ to $35$ for $a=0.2$) return the
WorkingPrecision
error despite the higher values don't.
In sum, ony being able to extract the first 200 $c_n$ coefficients is not enough to get a good approximation for the convergence radius, so I need to find a way of efficiently computing more of them.
Edit1: Setting WorkingPrecision->10
and AccuracyGoal->10
and in NIntegrate
seems to get rid of all the errors and lets me go to higher $n$. This is because the $c_n$ get very small very quickly, and, if I understand correctly, AccuracyGoal->10
sets them to 0 as soon as the first 10 digits are 0.
Edit2: Following the suggestion by @bmf of using Rubi
, the integrals can be now solved anallytically under acceptable computation time. I have yet to test how far in $n$ is it possible to go, but this path seems promising. The questions that I now have about Rubi
are
- Is it possible to add assumptions to the
Int
function?. I am only interested on $a>0$. - Why the code provided in the comments, i.e.,
Get["Rubi`"]
d[n_] := 1/(2^(
n + 1) \[Pi]) Int[(Gamma[n] - Gamma[n, 2 I f])/(1 + I a f)^
n, {f, -Pi, Pi}]
rubitable = Table[d[n], {n, 1, 5}]; // AbsoluteTiming
rubitable // TableForm
works fine for generic $a$ but gets many, many errors for numeric $a$?
Get["Rubi`"]
a=0.2;
d[n_] := 1/(2^(
n + 1) \[Pi]) Int[(Gamma[n] - Gamma[n, 2 I f])/(1 + I a f)^
n, {f, -Pi, Pi}]
rubitable = Table[d[n], {n, 1, 5}]; // AbsoluteTiming
rubitable // TableForm
NIntegrate
will not be able to use higher precision. So first thing is to give either exact input or else input at a precision at least as high as theWorkingPrecision
setting. $\endgroup$