Hacker News new | ask | show | jobs
by graycat 707 days ago
Above gave the calculus solution in algebra and also values from discrete arithmetic with (10)(365) steps per year.

For the arithmetic for the calculus solution, in Rexx,

     y.0 = ( 1 / 100 )
     b = 1
     k = ( 1 / 2000 )

     Do t = 1 To 5
       t1 = t * (10 * 365 )
       e1 = RxCalcExp( b * k * t1, 16 )
       y.t = ( y.0 * e1 ) /  ( y.0 * ( e1 - 1 ) + b )
       Say Format(t,9) Format(100*y.t,6,2) || '%'
     End
Table below has the values from both the calculus and the discrete versions:

         ==== Growth ====

             Customer Fraction
     Year   Calculus   Discrete
        1      5.90%      5.89%
        2     27.99%     27.97%
        3     70.68%     70.66%
        4     93.73%     93.73%
        5     98.93%     98.93%
Lesson: Sometimes in growth problems with a calculus solution, a discrete version can give close results.