Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Can it be done - easily?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13272] Re: Can it be done - easily?
  • From: "Allan Hayes" <hay at haystack.demon.cc.uk>
  • Date: Fri, 17 Jul 1998 03:18:08 -0400
  • References: <6od25q$hn9@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Barry Culhane wrote in message <6od25q$hn9 at smc.vnet.net>...
>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
>
>

Barry:

Formula:

f[X_,A_,B_,h_]= Sum[X/Y, {Y, A,B,h}]
                 A                     A         -A + B X (-PolyGamma[0,
-] + PolyGamma[0, 1 + - + Floor[------]])
                 h                     h           h
----------------------------------------------------------
                            h

Numerical calculation with formula
f[10000,100,1000,100]
36905
-----
 126
N[%]
292.897

Numerical calculation directly with Sum

Sum[10000/Y, {Y, 100,1000,100}]
36905
-----
 126

------------------------------------------------------------- Allan
Hayes
Training and Consulting
Leicester UK
http://www.haystack.demon.co.uk
hay at haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44(0)116 271 8642



  • Prev by Date: Re: 3DGraphics color problem
  • Next by Date: Re: Default format for new cells
  • Previous by thread: Re: Can it be done - easily?
  • Next by thread: Re: Can it be done - easily?