Do you have equipment with the computational accuracy to test my infinite series representation for Gamma(m), or (m-1)! ….?

Solution 1:

To simplify the notation, I define $$g = \exp((e+\pi) / 2)$$ $$g\approx$$ 18.72645520664827426714604454007043332367490879335810853397969311801774145367
to 256 bits of precision.

Your series can be written as $$\Gamma(x)\approx \frac{g^x}x -\frac{g^{x+1}}{1!(x+1)} + \frac{g^{x+2}}{2!(x+2)} - \frac{g^{x+3}}{3!(x+3)} + \ldots $$

Here's some Sage code that calculates that series, to any desired precision. (SageMath is a free open-source mathematics software system based on Python and built on top of many existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R).

@interact
def cegamma(m=4, N=100, bits=128, auto_update=False):
    RF = RealField(prec=bits)
    g = RF(exp((e + pi) / 2))
    p = g^m
    q = 1
    tot = p / m
    print("n: total term")
    for i in range(1, N + 1):
        p *= -g
        q *= i
        t = p / (q * (m + i))
        tot += t
        print(i, ":", tot, t)

Here's the output for the default inputs of $m=4$, $N=100$ terms, with 128 bits of precision used for the calculations. (Standard floating point arithmetic on most modern systems has 53 bits of precision).


n: total term
1 : -429838.83278896014300861543965159631773 -460582.97023748601574373014926172270191
2 : 3.1639471510015803333943129379871407637e6 3.5937859837905404764029283776387370815e6
3 : -1.6064302062636693178837366376603219359e7 -1.9228249213638273512231679314590360123e7
4 : 6.2702530225184220154606066851246874073e7 7.8766832287820913333443433227850093432e7
5 : -1.9952387983836339644371199456901536544e8 -2.6222641006354761659831806142026223952e8
6 : 5.3706178846991760697930046975336777013e8 7.3658566830828100342301246432238313558e8
7 : -1.2543198379500963597446743218553873574e9 -1.7913816264200139667239747916087551275e9
8 : 2.5895187624336366330550062651247962383e9 3.8438386003837329927996805869801835957e9
9 : -4.7931962500454989518084789767542955116e9 -7.3827150124791355848634852418790917499e9
10 : 8.0444970770996706206881342310685345778e9 1.2837693327145169572496613207822830089e10
11 : -1.2353459569352453944704943162072305455e10 -2.0397956646452124565393077393140840033e10
12 : 1.7488838981189667921984214727394399419e10 2.9842298550542121866689157889466704873e10
13 : -2.2970199358730821951359045364201677816e10 -4.0459038339920489873343260091596077235e10
14 : 2.8141404911118247679385964197751670798e10 5.1111604269849069630745009561953348614e10
15 : -3.2309489903571938212505599708984098665e10 -6.0450894814690185891891563906735769464e10
16 : 3.4904849174656004699138438579359120775e10 6.7214339078227942911644038288343219441e10
17 : -3.5609790040632747637000007438029677474e10 -7.0514639215288752336138446017388798249e10
18 : 3.4416154116537558872627148582265409829e10 7.0025944157170306509627156020295087302e10
19 : -3.1600847129171983681838518307084261619e10 -6.6017001245709542554465666889349671448e10
20 : 2.7636822837943705157740568687226448857e10 5.9237669967115688839579086994310710477e10
21 : -2.3074563364817698140983228709125845620e10 -5.0711386202761403298723797396352294477e10
22 : 1.8430878164598942554200644196586507067e10 4.1505441529416640695183872905712352687e10
23 : -1.4110981066403108713858518183988657488e10 -3.2541859231002051268059162380575164555e10
24 : 1.0373586000890293632524325654542699095e10 2.4484567067293402346382843838531356583e10
25 : -7.3343535250623563553139088326158198152e9 -1.7707939525952649987838234487158518910e10
26 : 4.9946223130259442905834945012879017058e9 1.2328975838088300645897403333903721521e10
27 : -3.2805753133471535049059884590121326661e9 -8.2751976263730977954894829603000343719e9
28 : 2.0809410348331769319354430387277408418e9 5.3615163481803304368414314977398735079e9
29 : -1.2762901704804745829551774755211036605e9 -3.3572312053136515148906205142488445024e9
30 : 7.5770817549407482764698619817323349593e8 2.0339983459745494106021636736943371564e9
31 : -4.3588231589194238635005828848637122812e8 -1.1935904913860172139970444866596047240e9
32 : 2.4320636511565691701866693310800409250e8 6.7908868100759930336872522159437532061e8
33 : -1.3173979015404333901490397256517594779e8 -3.7494615526970025603357090567318004029e8
34 : 6.9337809008365433116973182237718570800e7 2.0107759916240877213187715480289451859e8
35 : -3.5488480254241547174434218342268647076e7 -1.0482628926260698029140740057998721788e8
36 : 1.7676775026216243345922401053015185351e7 5.3165255280457790520356619395283832427e7
37 : -8.5749526352079741427463085865512976093e6 -2.6251727661424217488668709639566482960e7
38 : 4.0539157157321214471807171590012216690e6 1.2628868350940095589927025745552519278e7
39 : -1.8690093733260692827102063205194826398e6 -5.9229250890581907298909234795207043088e6
40 : 840855.30225404567305320762756799592626 2.7098646755801149557634139480874785660e6
41 : -369351.21069256523972873242999209032980 -1.2102065129466109127819400575600862561e6
42 : 158510.85581726505688611867839767971877 527862.06650983029661485110838977004857
43 : -66481.388524207453414161252488088903761 -224992.24434147251030027993088576862253
44 : 27280.655850167965564546677350068619713 93762.044374375418978707929838157523474
45 : -10941.509571557402562477419495410709441 -38222.165421725368127024096845479329154
46 : 4307.4111957821591485495185442480168283 15248.920767339561711026938039658726269
47 : -1649.1643507199879751140989982501147648 -5956.5755465021471236636175424981315930
48 : 630.01145175839145589634871433145870693 2279.1758024783794310104477125815734717
49 : -224.59230095850356740344122079371073032 -854.60375271689502329978993512516943725
50 : 89.554381048304585544778889360915961100 314.14668200680815294822011015462669142
51 : -23.698418781126538432703232651073849551 -113.25279982943112397748212201198981065
52 : 16.358343432758760080037753193029554883 40.056762213885298512740985844103404434
53 : 2.4534162079940082391251375941237511826 -13.904927224764751840912615598905803701
54 : 7.1923146176673447229520362012211900768 4.7388984096733364838268986070974388942
55 : 5.6061572708996837794289209759232660508 -1.5861573467676609435231152252979240260
56 : 6.1277296416709635162891264946305925489 0.52157237077127973686020551870732649809
57 : 5.9591843157300883547699982440163650360 -0.16854532594087516151912825061422751294
58 : 6.0127248180348229651624209668492871192 0.053540502304734610392422722832922083275
59 : 5.9960009340624350703187837468793873896 -0.016723883972387894843637219969899729648
60 : 6.0011390280826633541177782518391173891 0.0051380940202282837989945049597299994886
61 : 5.9995859460142874278252527808576453053 -0.0015530820683759262925254709814720837853
62 : 6.0000479308422614938911503729529959594 0.00046198482797406606589759209535065411236
63 : 5.9999126576083463808496812369208468701 -0.00013527323391511304146913603214908932698
64 : 5.9999516565987928831111204125743468988 0.000038998990446502261439175653500028720287
65 : 5.9999405838510462469587343411194082222 -0.000011072747746636152386071454938676577467
66 : 5.9999436806862656714022487437920059774 3.0968352194244435144026725977551671362e-6
67 : 5.9999428273139256830517166984206840620 -8.5337233998835053204537132191540880087e-7
68 : 5.9999430590593018791908582675101932790 2.3174537619613914156908950921697851866e-7
69 : 5.9999429970256712892942121402218014410 -6.2033630589896646127288391838003541873e-8
70 : 5.9999430133966964499052153368511912929 1.6371025160611003196629389851968101246e-8
71 : 5.9999430091363633170554608250162157294 -4.2603331328497545118349755635128309536e-9
72 : 5.9999430102298520448201324167578584566 1.0934887277646715917416427271717553341e-9
73 : 5.9999430099529858744520564859001326373 -2.7686617036807593085772581933860562069e-10
74 : 5.9999430100221514304461347641795206497 6.9165555994078278279388012470218470110e-11
75 : 5.9999430100051003581219237372584625857 -1.7051072324211026921058064044656936620e-11
76 : 5.9999430100092492372709809695333203813 4.1488791490572322748577955894660585825e-12
77 : 5.9999430100082526838056275333439306802 -9.9655346535343618938970109048843438495e-13
78 : 5.9999430100084890213635117844530337075 2.3633755788425110910302736249415810407e-13
79 : 5.9999430100084336739935724552001836186 -5.5347369939329252850088924801725660612e-14
80 : 5.9999430100084464755089965467416642863 1.2801515424091541480667704605460067997e-14
81 : 5.9999430100084435507350773044398522116 -2.9247739192423018120747449311391490584e-15
82 : 5.9999430100084442109031235328072616165 6.6016804622836740940488878701243594042e-16
83 : 5.9999430100084440636680824299380556093 -1.4723504110286920600719908286659206992e-16
84 : 5.9999430100084440961187811555042218712 3.2450698725566166261953579766801133379e-17
85 : 5.9999430100084440890498562463739814729 -7.0689249091302403983730043904293207039e-18
86 : 5.9999430100084440905720081332769404616 1.5221518869029589887087497984043508652e-18
87 : 5.9999430100084440902479705153026690163 -3.2403761797427144528089936518594449819e-19
88 : 5.9999430100084440903161764083834548604 6.8205893080785844073251891880389663866e-20
89 : 5.9999430100084440903019795467973942664 -1.4196861586060594028937402987234883982e-20
90 : 5.9999430100084440903049020871057477514 2.9225403083534850822265471086800892166e-21
91 : 5.9999430100084440903043070021900327111 -5.9508491571504036161865649790148701791e-22
92 : 5.9999430100084440903044268690318281739 1.1986684179546284735575989282355608047e-22
93 : 5.9999430100084440903044029815049253990 -2.3887526902774914150341658456951760038e-23
94 : 5.9999430100084440903044076917615631123 4.7102566377132806714685796123251943412e-24
95 : 5.9999430100084440903044067726517094260 -9.1910985368629824302750048538538060978e-25
96 : 5.9999430100084440903044069501470511968 1.7749534177078185581174813598104523538e-25
97 : 5.9999430100084440903044069162197411318 -3.3927310064910409360666964909154428771e-26
98 : 5.9999430100084440903044069226392252728 6.4194841410037820600026173212230100362e-27
99 : 5.9999430100084440903044069214367297755 -1.2024954973092304107109356238914809193e-27
100 : 5.9999430100084440903044069216597493179 2.2301954238994490398931879464084125560e-28

Using the SageMath RealField class for the arithmetic, the series appears to be quite stable, once $N$ is large enough, even at relatively low precision.


Here's a live link to the script, running on the SageMathCell server, so you can run it in your browser, even on an iPad or phone.


FWIW, Sage gives this expression for the sum of your series:

$$\frac{{\left({\left(x + 1\right)} e^{\left(\frac{1}{2} \, \pi x + \frac{1}{2} \, x e\right)} \gamma\left(x + 2, -e^{\left(\frac{1}{2} \, \pi + \frac{1}{2} \, e\right)}\right) - {\left(x^{2} + x\right)} e^{\left(\frac{1}{2} \, \pi x + \frac{1}{2} \, x e\right)} \gamma\left(x + 1, -e^{\left(\frac{1}{2} \, \pi + \frac{1}{2} \, e\right)}\right)\right)} e^{\left(-\frac{1}{2} \, \pi - \frac{1}{2} \, e\right)}}{x^{2} \left(-e^{\left(\frac{1}{2} \, \pi + \frac{1}{2} \, e\right)}\right)^{x}}$$

where $$\gamma(a,z)=\int_0^z t^{a-1}e^{-t}\,\mathrm{d}t$$ is the lower incomplete gamma function


It turns out that the expression for the sum of your series can be simplified to $$\gamma(x, g)$$

I found that by telling Sage to use a variable for $g$ rather than its symbolic expression in terms of $\pi$ and $e$.

var('x,g,n')
f = (-1)^n * g^(x + n) / (factorial(n) * (x + n))
ceg = sum(f, n, 0, oo)
print(ceg)
show(latex(ceg))

live link

And here's an updated version of the main script which prints the value calculated using the lower incomplete gamma function ("gil") before it starts summing the series. This value doesn't suffer from the loss of precision caused by the large terms in your series, so its value differs from the sum of the series in the last 10 digits when calculating the series for $m=4$.


Here's a plot of $\Gamma(x)-\gamma (x,g)$ over $[0,4]$

Plot of Gamma(x)-gamma(x,g)

created using this plotting script, which can plot the difference over any specified domain.

The Wikipedia article on the incomplete gamma functions gives generalised continued fractions for both the upper and lower incomplete gamma functions. This script calculates both functions using those continued fractions, and sums them to give an estimate of gamma.