Computer Science, asked by Roshni7456, 4 months ago

1. Find the value of 5 correct to three decimal places by Bisection Method​

Answers

Answered by janithsailesh
0

Answer:

Given a closed interval [a,b] on which f changes sign, we divide the interval in half and note that f must change sign on either the right or the left half (or be zero at the midpoint of [a,b].) We then replace [a,b] by the half-interval on which f changes sign. This process is repeated until the interval has total length less than . In the end we have a closed interval of length less than on which f changes sign. The IVT guarantees that there is a zero of f in this interval. The endpoints of this interval, which are known, must be within of this zero.

Initialization: The bisection method is initialized by specifying the function f(x), the interval [a,b], and the tolerance > 0.

We also check whether f(a) = 0 or f(b) = 0, and if so return the value of a or b and exit.

Loop: Let m = (a + b)/2 be the midpoint of the interval [a,b]. Compute the signs of f(a), f(m), and f(b).

If any are zero, return the corresponding point and exit.

Assuming none are zero, if f(a) and f(m) have opposite sides, replace b by m, else replace a by m.

If the length of the [a,b] is less than , return the value of a and exit.

Analysis: When we enter the loop f(a) and f(b) have opposite sign. It follows that either f(m) and f(a) have opposite sign or f(m) and f(b) have oppposite sign. Thus the initial conditions are still satisfied each time we enter the loop.

The length of the initial interval is (b - a). After one time through the loop the length is (b - a)/2, after two times it is (b - a)/4, and after n passes through the loop, the length of the remaining interval is (b - a)/2n. No matter how small , eventually (b - a)/2n < . In fact we can solve this inequality for n:

(b - a)/2n <

2n > (b - a)/

n ln 2 > ln(b - a) - ln()

n > [ln(b - a) - ln()]/ln 2.

Thus the algorithm terminates after at most M passes through the loop where M is the first integer larger than [ln(b - a) - ln()]/ln 2.

Examples

Example 1. Starting with the interval [1,2], find srqt(2) to within two decimal places (to within an error of .01).

The function involved is f(x) = x2 -2. The following table steps through the iteration until the size of the interval, given in the last column, is less than .01. The final result is the approximation 1.41406 for the sqrt(2). This is guaranteed by the algorithm to be within .01 (actually, to within 1/128) of sqrt(2). In reality it agrees with sqrt(2) to three decimal places, not just two.

a b m = (a + b)/2 f(a) f(b) f(m) b-a

1 2 1.5 -1 2 .25 1

1 1.5 1.25 -1 .25 -.4375 .5

1.25 1.5 1.375 -.4375 .25 -0.109375 .25

1.375 1.5 1.4375 -0.109375 .25 .0664062 .125

1.375 1.4375 1.40625 -0.109375 .0664062 -.0224609 .0625

1.40625 1.4375 1.42187 -.0224609 .0664062 .0217285 .03125

1.40625 1.42187 1.41406 -.0224609 .0217285 -.0004343 .015625

1.41406 1.42187 -.0004343 .0217285 .0078125

Equipment Check: The following form allows you to compute values of a function g(x). Your task is to find a zero of g(x) on the interval [0,3] to within an accuracy of .5. Take a out a piece of paper and a pencil and step through the algorithm. The "check answer" button will display the answer you should get and the number of times you should have done the loop. The "explain" button will show you a table similar to the one above. Don't look at the table unless you are really stuck or have worked through the entire problem.

Explanation:

mark me as brainlist and follow me it will give you 3 points

Similar questions