00:01
We have two parts, part one, used bisection method to find out the root of x minus sine of x minus 0 .5 equals 0 between 1 and 2.
00:13
And then write a program that finds the root of the above function by using bisection method.
00:20
In fact, we got to write the program and find the root.
00:25
That is, part 2 is in fact needed to solve part 1, to have a number.
00:32
But first, before talking about the program, we are going to talk about the method itself, by section method, which is based on two fundamental hypotheses.
00:47
They are, the function f is continuous.
00:53
Now we are talking about the function for which we are looking for the roots.
01:00
That is the equation we are solving with this method.
01:04
Is a non -linear, a general non -linear equation in one variable, that is a function equal to zero.
01:10
That's equivalent to find in the zeros of the function.
01:15
So we talk about the zeros of the function or in an equivalent way the roots of the equation.
01:23
So this bisection method is designed to find the roots of a non -linear equation of this form.
01:32
That is some function equal to zero.
01:36
And the hypothesis are that f is continuous on a close interval.
01:43
So let's say this is what we are solving.
01:47
Then f is continuous on a close interval containing the root or a root of the equation.
01:57
And the images of the endpoints of the close interval has different signs.
02:06
Mathematically we can write this as f of a times.
02:10
As of f of b less than zero.
02:12
That means the signs of these numbers f of a and f of b are different.
02:19
One is positive, the other is negative or vice versa.
02:23
So we have this, for example, the situation where a function has at the left end point is positive and at the right point is negative.
02:39
And you can see that the continuity of the function ensures that there is at least one number between a and b for which the is called better r for root.
02:54
And we can say then that there is at least one number between a and b for which the function is zero.
03:04
And so the continuity and the fact that the interval is closed and the function change sign at the end points are fundamental.
03:15
We can have, of course, more than one root.
03:18
For example, we can have something like this.
03:24
There is a change of sign at the end point, and there are more than one zero on the interval a .b.
03:38
So we have at least one.
03:41
And what is recommended in general is when we apply this method, which shows the interval in such a way that we have only one root.
03:50
Because if we have more than one, we don't know exactly at which route we are going to converge.
03:56
But if we know that there is exactly one, the method is going to converge to that route.
04:02
So this is the hypothesis we get to fulfill and in the program we can check the change of signs.
04:14
So we have to suppose the functions continues and the close interval.
04:18
And we can see in this case, the function we are considering is f of x equal x minus sine of x minus 0 .5 because then the equation f of x equals 0 would be exactly the equation we have here.
04:39
And we are talking about interval 1 2 because we must know that there is only one solution.
04:47
And in fact that's true because this is the graph of this function f here.
04:54
Let's put it on the graph.
04:59
This blue line, blue curve is f of x.
05:04
And as we can see on the left end point, number one, the image is negative here.
05:15
And at 2, the image is positive.
05:22
In fact, we can say that f at 1 is about negative 0 .34.
05:31
And f at 2 is about 0 .59 which is positive and as we can see here that those values are correct and so there is a change of sign and the function is obviously continuous because we have the identity x is a polynomial so it's continuous through a mathematical sign function which is continuous everywhere and a constant so f is continuous and an exchanging sign on the endpoints or at the endpoints of the interval 1 -2.
06:12
So we know there is at least one root, but graphically here we can say that there is only one.
06:20
In fact, there is a curious situation here is that when we are going to talk about the bisection method, we can see that the root we are looking for is very close to 1 .5 over here, because here is the level zero there is y equal zero and you can see that when we talk about bisection method we're going to take some iterations to get to the number and that's because the way of the method is working okay there is if you are not exactly the root is not exactly at the midpoint then the method get to iterate a bit to arrive to a good approximation to the solution so the idea of the method is, because we have a change of sign, we calculate the midpoint.
07:15
Let's say we do it here.
07:18
We calculate the midpoint, let's say here.
07:22
Let's call it c.
07:24
And then, because the function changes sign on the original endpoints of the interval of ab, that is at a and at b.
07:34
Then there must be a change of sign when we compare the sign of the image at a and the image at c and the image at b.
07:43
That is, the function got a change sign at the endpoints of ac or at the end points of cv.
07:52
Because if it were not the case, then the signs of f of a and f of b will be the same.
07:59
So we calculate the midpoint.
08:01
If the image there is zero at a machine level, then we have the solution because we are solving just this equation.
08:11
So if the image of the midpoint is practically equal to zero, then we have solved the equation.
08:17
So we take the midpoint as a solution.
08:19
If it's not zero, then it means that it is positive or negative.
08:24
So we stick with this sub interval for which there is a change of sign.
08:29
For example, in this draw here, the function is changing the sign between a and the midpoint here.
08:36
So the new interval ab will be ac in this case.
08:42
So we redefine the interval ab using the midpoint that gives us a new sub -interval ab, which is half the size of the original, and there is a change of sign for the function f at the end point.
09:01
So we apply again the same method.
09:03
That is now we find the midpoint of this new sub interval.
09:09
Let we see if the image at that midpoint is zero.
09:13
If not zero, then we stick with the sub interval where the function changes, sign at the endpoints and so on.
09:20
So what we are doing here is that we are bracketing.
09:25
We are using sub intervals contained in one in the previous one that is necessary.
09:32
Nested subinterables that has or the half lengths each at each iteration one half of the previous one.
09:42
So the subinterables we are choosing are reducing in size, one half at each iteration, and the root is always inside that root.
09:54
So if we take the midpoint of each new root or each new sub interval, it said, we have a better approximation to the root.
10:06
At the end, when we have an interval, a sub interval, ab with a small length, then we can say we have an approximation to the root.
10:17
So we have two options to verify we are at the accuracy we want.
10:23
One is that the image at the midpoint is very small, and the other is that the lens of the news of interval ab is small.
10:31
So we are going to use both in our code.
10:36
And so we have to do this here.
10:38
We have to find a midpoint.
10:40
The midpoint is 1 .5, and then we see at which interval the function change sides.
10:47
As you can see here, maybe if we make a zoom here, there is at 1 .5, maybe the function is positive.
10:56
Is that's the case, then we define a b as a, c, as the interval from a to the midpoint.
11:04
And then we find the midpoint of that, and as you can see, the new midpoint is over here.
11:11
And we can see that the change of sign occurs now between this new midpoint here and the previous one...