2

My teacher has a problem that asks me to iterate on Gauss-Seidel equations considering a maximum variation of 0.01. This means making the first iteration and get check if the max of each error is less that 1%?

err(x1) = (actual-guess)/actual = 100%
err(x2) = 100%
err = max(err(x1), err(x2))

Need another iteration because the err > than requested. Is this what it really means?

thanks

Totty.js
  • 263

1 Answers1

3

Don't think so. In real life, you never know what the true answer to your problem is (call it $x^*$ for convenience). In practice, you use deviation from the previous iterate as a stopping criterion. So instead of computing error as $|x_n - x^*|$, use $|x_n - x_{n-1}|$.

gt6989b
  • 54,422
  • isn't the guess=x_n-1; and actual=x_n in my example? The difference is that in yours you don't divide by the actual=x_n – Totty.js Feb 21 '13 at 09:02
  • @Totty depending on the problem, you may want to use absolute error calculation (as in my answer) or relative error calculation (as you are suggesting, $|1 - x_n/x_{n-1}|$). Both are measures of how far the last step moved away from the previous one. The idea is, when convergence happens, iteration step size decreases... – gt6989b Feb 21 '13 at 15:27
  • but how do you find the real value? with another method? – Totty.js Feb 21 '13 at 20:11
  • @Totty You don't :). You never know what the real value is, otherwise why would you be engaged in a numerical procedure in the first place? – gt6989b Feb 21 '13 at 20:51
  • then how do you have the absolute error? From what I know absolute error is referred to the real value.. – Totty.js Feb 22 '13 at 17:32
  • @Totty No, you never have the real value, after all, your numerical procedure is only there so you can approximate it. Your notions of error (both absolute and relative) come from consecutive sequence terms, with the notion that once you start approaching the true value (supposedly the limit of your value sequence), the size of the steps will start coming down (until, theoretically, it is 0 at the limit point). The whole idea is that the current step size gives an approximation for the real error. But again, since the real value isn't known, true error isn't known either - only approximation. – gt6989b Feb 26 '13 at 19:47
  • In other words, error is approximately $|x_{n+1}-x_n|$ (absolute) or $|1-x_{n+1}/x_n|$ or, equivalently, $|1-x_n/x_{n+1}|$ (relative). – gt6989b Feb 26 '13 at 19:49
  • ah.. that kind of relative/absolute.. I thought relative was relative to the last iteration and absolute was "relative" to the real value. Now I get it... – Totty.js Feb 26 '13 at 20:20
  • @Totty Great. I am glad to be of help... – gt6989b Feb 26 '13 at 20:31