Solution. We write the equation in the form
Using for bisection algorithm for function f(x)=x+3-e^x.
Choose a and b such that f (a)> 0 and f (b) <0 (or vice versa). Find value c that equal to
Choose a and b such that f(a)> 0 and f (b) <0 (or vice versa). Find c
Find f(c). If f(c) =0 therefore c is root of equation f(x)=0. If f(c) ≠ 0 we check the sign of f(c).
If f(c) has the same sign as f(a) we replace a with c and we keep the same value for b.
If f(c) has the same sign as f(b), we replace b with c and we keep the same value for a.
The algorithm ends when the values of f(c) is less than a defined tolerance.
The number of iterations n needed to converge towards a root within the imposed tolerance Ɛ is calculated as:
The equation x+3-e^x=0 has two roots.
Let's make two tables with 6 iterations for each case.
Comments
Leave a comment