Why in the bisection method it is better to compute the midpoint c between a and b with
c = a + (b - a) / 2.
instead of the simpler:
c = (a + b) / 2.
all variables are floating points.
Let us look at this example and find the midpoint of two points in one-dimensional axis. Suppose, we have two points, 5 and 9, on a number line. The midpoint will be calculated as: (5 + 9)/2 = 14/2 = 7. So, 7 is the midpoint of 5 and 9.
To answer what the midpoint of AB is, simply replace the values in the formula to find the coordinates of the midpoint. In this case these are (2 + 4) / 2 = 3 and (6 + 18) / 2 = 12. So (xM, yM) = (3, 12) is the midpoint of the segment defined by A and B.
it is to avoid any potential overflows / loss of precision in intermediate calculations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With