Re: Can it be done - easily?
- To: mathgroup at smc.vnet.net
- Subject: [mg13279] Re: [mg13211] Can it be done - easily?
- From: Wouter Meeussen <eu000949 at pophost.eunet.be>
- Date: Fri, 17 Jul 1998 03:18:25 -0400
- Sender: owner-wri-mathgroup at wolfram.com
hi, you need the PolyGamma function : In[1]:=Sum[1/z,{z,1,n}] Out[1]=EulerGamma+PolyGamma[0,1+n] if you don't have them on your home, kitchen & garden calculator (;-)), then try In[ ]:=N[EulerGamma,24] Out[ ]=0.57721566490153286060651 and do a taylor series 'round infinity: In[27]:=ser=Series[PolyGamma[0,x],{x,\[Infinity],12}]//Normal Out[27]= 691/(32760*x^12) - 1/(132*x^10) + 1/(240*x^8) - 1/(252*x^6) + 1/(120*x^4) - 1/(12*x^2) - 1/(2*x) - Log[1/x] Check the quality of the approximation by comparing values between 2^1 and 2^12 : Table[{EulerGamma+ser,EulerGamma+PolyGamma[0,x]}/.x->2^n,{n,1,12}]//N Out[28]= {{1.,1.},{1.83333,1.83333},{2.59286,2.59286},{3.31823,3.31823},{4.02725, 4.02725},{4.72827,4.72827},{5.42533,5.42533},{6.12044,6.12044},{6.81456, 6.81456},{7.5082,7.5082},{8.20159,8.20159},{8.89486,8.89486}} looks good enough to me. wouter. At 07:42 13-07-98 -0400, Barry Culhane wrote: >Myself and two workmates are software developers. One guy wanted a >formula to calculate a result for the following equation... > Z = sum of X/Y where X is a fixed number, and Y ranges from A-B in >fixed steps... > i.e... X=10000 ; Y=100,200,300...1000 > i.e... Z= 10000/100 + 10000/200 + ... 10000/1000 = 292.896 > >He and I tried to figure out a simple formula to calculate it, but >couldn't. The third guy said it was *not* *possible* to derive a >formula - we think he's wrong, but can't prove it. MathCad can solve >it in the blink of an eye, even if the value of Y ranges from 1 to 1e6 >in steps of 1 !!! > >Can anyone come up with a simple formula to give a reasonably accurate >result? It is too slow to actually divide X by Y for each value of Y >as there may be 1000 or even 100,000 values of Y. > >Thanks in advance... >> Barry Culhane >> Schaffner Ltd, Limerick, IRELAND > > > Dr. Wouter L. J. MEEUSSEN w.meeussen.vdmcc at vandemoortele.be eu000949 at pophost.eunet.be