Скачать книгу

href="#fb3_img_img_c3ca72c0-9fa0-5f15-b772-9b5b483e0dfd.png" alt="images"/>, with images. Overall, after images bisections, the tolerance is images, becoming halved in the next iteration.

      Convergence (Exact): The sequence images is said to be convergent to images if images or, equivalently, if images, where images.

      The difference images appearing in the previous definition is called the error associated with images. However, since images may be positive or negative and we are just interested in the absolute discrepancy between images and the root images, it is common practice to define the absolute error images of the imagesth iterate. Checking convergence numerically using the previous definition has two main drawbacks. The first one is that we do not know the value of images, which is precisely the goal of root‐finding. The second is that in practice we cannot perform an infinite number of iterations in order to compute the limit as images, and therefore we must substitute the convergence condition by a numerically feasible one. For example, looking at the sequence resulting from the bisection method, it is clear that the absolute difference of two consecutive elements decreases when increasing images (for example, images and images). Since, by construction, the bisection sequence satisfies images, it is common practice to consider a sequence as converged when this difference becomes smaller than a prescribed threshold or tolerance images:

      Convergence (Practical): A sequence images is said to be converged to the desired tolerance images after images iterations if images, images.

      The criterion above only refers to the convergence of a sequence, and not necessarily to the convergence to a root. After an iterative method has apparently converged to some stagnated value images, it is always advisable to check the magnitude of images in order to confirm if the method has succeeded. The code below is a simple implementation of the bisection method using the tolerance criterion previously described:

      % Code 1: Bisection method for solving f(x) = 0 in [a,b] % Input: 1. [a,b]: interval (it assumes that f(a)f(b) < 0) % 2. tol: tolerance so that abs(x_k+1 - x_k) < tol % 3. itmax: maximum number of iterations allowed % 4. fun: function's name % Output: 1. xk: resulting sequence % 2. res: resulting residuals % 3. it: number of required iterations function [xk,res,it] = bisection(a,b,tol,itmax,fun) ak = a; bk = b; xk = []; res = []; it = 0; tolk = abs(bk-ak)/2 ; while it < itmax & tolk > tol ck = (ak + bk)/2; xk = [xk ck]; if it > 0; tolk = abs(xk(end)-xk(end-1)); end fa = feval(fun,ak); fc = feval(fun,ck); res = [res abs(fc)]; if fc*fa < 0; bk = ck; else ak = ck; end it = it + 1 ; end