Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
1  
Hi @Doudou, and welcome to Scicomp! Could you clarify what you mean by improving the robustness? – Paul Feb 11 '13 at 14:32
    
@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
1  
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.