September 27th, 2011, 10:59 pm
QuoteOriginally posted by: CuchulainnQuoteOriginally posted by: supernova(1+5/n)^n, take n enough to achieve the desired decimal accuracyIs there a fast way to compute (1+1/n)^nto a given accuracy? (using a Cauchy sequence?). Then we can use the Pingala's Chandah-sutra technique already alluded to.The interview allows 5 minutes.Rough idea:Denote our ErrorOfApproximation function by f(x; n) := Power series expansion of the above, accurate to order x^3 (that's not very high, but it's probably a good idea to sacrifice some accuracy and settle for lower order in an interview setting ;]), gives:So, for our x=1 the error-of-approximation behaves roughly like:From this one can see that to reduce the order of approximation error by magnitude "m" we have to increase "n" roughly by the same "m" (a nice inverse relationship).Some numerical illustration of the above:f(1; 10) = 0.124539f(1; 100) = 0.013468f(1; 1000) = 0.0013579(and we have to stop right here).
Last edited by
Polter on September 27th, 2011, 10:00 pm, edited 1 time in total.