2

In order to compute the sum of a power series, we can use for loop, while loop or the analytic formula. I am wondering what is difference between those algorithms and how to improve the robustness of this question?

Geoff Oxberry
  • 30,394
  • 9
  • 64
  • 127
Willowbrook
  • 601
  • 3
  • 10
  • 2
    Hi @Doudou, and welcome to Scicomp! Could you clarify what you mean by improving the robustness? – Paul Feb 11 '13 at 14:32
  • 2
    @Doudou: maybe also what you mean by "the analytic formula"? Do you mean a closed form solution of an infinite series? – GertVdE Feb 12 '13 at 12:54
  • 3
    One general comment: If you have a bunch of floating point numbers that you need to add together, add them in order from smallest to largest. Occasionally I've seen numeric analysts use a priority queue to ensure that the two smallest numbers are always added in any step. This minimises roundoff error. (Proof left as an exercise.) – Pseudonym Feb 16 '13 at 21:46

0 Answers0