MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Can it be done - easily?

  • To: mathgroup at
  • Subject: [mg13243] Re: [mg13211] Can it be done - easily?
  • From: Carl Woll <carlw at>
  • Date: Fri, 17 Jul 1998 03:17:40 -0400
  • Sender: owner-wri-mathgroup at

It sounds like you are interested in the sum of 1/k from 1 to n. There
is a mathematica function called Euler's Psi function which will give
you the answer. That is, in a mathematica style,

psi[n + 1] = - C + Sum[1/k,{k,1,n}]

where C is Euler's constant, C=0.577215664 etc. You can look up this
function in a table of special functions, for example, Gradshteyn &
Ryzhik, 8.36. In this reference, you will find an asymptotic result for
psi, namely

Sum[1/k, {k,1,n-1}] = C + Log[n] - 1/(2n) - 1/(12n^2) + 1/(120n^4) - 
                      1/(250n^6) + 1/(240n^8) + ...

The above formula is pretty accurate for relatively low values of n, for
example, the error is ~10^-16 for n=25.

Carl Woll
Dept of Physics
U of Washington

On Mon, 13 Jul 1998, 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

  • Prev by Date: Re: Can it be done - easily?
  • Next by Date: Re: help with trig(?) calculation
  • Previous by thread: Re: Can it be done - easily?
  • Next by thread: Re: Can it be done - easily?