 So we will look at a few demos that I have been planning to do for some time, fine. So I think quite a few of you have sent me the error in evaluation of the derivative of sin x, okay. So I will repeat part of that process. Most of the codes that you write will be either in C, C++ or Fortran or whatever but because this is a demo like last time I am going to use a scripting language Python, right. And again to do the plots I will use Grace plot and we will also look at a second demo which is solution to Laplace's equation, right. So I am not going to do anything fancy. I will just do the initial simple, right, just to show you how the thing goes and again as I said most of you may have already tried to write these programs. So the objective is two-fold. So I am not going to show you a canned pre-canned package. So I will actually write it so that you can see that I make the same kind of mistakes that you make, right. This is nothing unusual about it. All of us are error prone. The second thing of course is maybe you will get an idea as to how this process actually works, fine. And along the way we will look at the results and possibly discuss some of the results. If you have any questions, right, you feel free to stop me, right. So we will just explore what it is that we have. So the first demo is going to be basically how well we are able to evaluate the derivative. I will write for the first order, right, one sided difference, say a forward difference. We will do a forward difference and look at what happens and maybe we can also do a central difference just for fun. After that I do have a canned package, right, because I do not want to do the third derivative and fourth derivative. You do not get anything out of doing that, fine. Is that okay, right. So I am going to use my particular favorite version of Python called Ipython. Since I am also going to do Laplace's equation and I am going to do the visualization using a package called Maya V which was originally developed in this institute, so obviously I am going to use that package. It is part of an n-thought suite of programs right now. So let me just get started, right. And along the way, yes, I mean I know that some of you may not be familiar with Python and so on, where it is important I will try to show you what is happening, right, what this language is all about. But if you want to find out, I would suggest there are tutorials out there you can go learn language by yourself. It is not that difficult, okay. So once you know one programming language, you should be able to handle it, fine, okay. So the first thing is to just set up the race plot so that we are ready to plot, okay. Since I know I want to plot, so I get my plotting package ready and of course it is going to be an intense white color that may not come out that well on the screen. So I will quickly change it to a color that is more amenable to the videotaping and so on. So I have my plot screen ready. All I need to do now is to get something to plot, right. So I am going to use again the package numP which is part of the n-thought scientific suite. So from maybe I will just import, I will do it, this is compared to what I did last time, this is really the proper way to do it. So I import numP as np, so it will be called np instead of numP, fine, okay. The point at which I am going to take the derivative I think in the assignment I had suggested pi by 4. So I will say x equals, so in np, of course having called it np I may make a mistake, so keep your, keep stay, stay alert so that I do not make a mistake, okay. I think pi by 4 is what I started, one quarter of pi by 4. I say pi by 4 but I always multiply by 0.25, right even if I am using a scripting language. And the initial dx we can choose the same as, we can choose the same as x, so it is very large, the initial dx is quite large, okay, right, pi by 4 is almost 3 quarters, the initial dx is quite large. Now I want to be plotting this stuff, so what we will do is we will have an error and we will have the dxs that we are going to generate. So I am going to have a list that I will create, an empty list that I will create which is called error and I will create dx, capital DX which will be the list of dxs that we are going to use, fine. We are set now. So because I am a bit lazy and it is a good programming practice I will pre-define sin x because I know that I am going to constantly be using sin of x. I pre-define sin x as, right, so Sx is sin x and its derivative which I will just call Cx is NP dot cos of x, fine. So we have now defined sin x and cosine of x, same value because it is pi by 4, fine. So we are now set. So what we will do is how many dxs value shall we take? About 60, 60 you have taken about 60, okay, I will do 60 or I in range 60. So first we will define the derivative df. So that is going to be, I know I am going to divide by dx so I open bracket, close bracket. Every time you open bracket you should get into the practice of closing the bracket, sin of NP dot sin of x plus dx. Having said that I opened and did not close the bracket Sx divided by dx. That is the derivative. That is our forward difference and there is an error in this derivative. What is this error? So I am going to take the absolute value of the error. So that is going to be df minus cosine x which is the error and I want the relative value, okay. So the relative error. So that is the error. So now I have got for that dx I have the error. So all I need to do is I need to save this somewhere. I have created err just for this reason. So to the list of errors I append this current error and to the list of dxs I append my dx, okay. Now all I have to do is create the next dx. So dx is 0.5. I will not use any weird, you can say star equals but anyway I will just say dx equals 0.5 times dx. So I will have the dx value, fine. I think I have got everything there. So it should be done. So what we do is we plot this. So on the graph that I created I plot dx versus error, error versus dx, error versus dx and what do I get? That does not make sense, right. So the deal is what is happening? here. That does not make sense. So we will have to fiddle around a little with the scale. So it seems that the error started off at some value goes linear. This is what you would predict that it linearly goes to 0 but there seems to be something happening on the spot. There seems to be something happening here. So I will change the scale. The key thing to do is I want to change the scale to logarithmic scale. So I go to 1e-16 which is about as small as I can get here. I go to a logarithmic scale. I apply that and change the major spacing values. So this is what I would, as I said, this is what I would normally go through and let me just accept this. Let us see. So we get something that looks like that but clearly it goes down to 10 power – 8, 10 power – 9. Let me change the x-axis also because I know that 2 goes through. So 1e-20, right, okay and go to a log scale. It is true. I will need and apply that and that is what I have got, right. I think a lot of you have seen this. I see a lot of people nodding. This is what I have got. So in calculus what you do is remember it is called finite differences because we just took a difference and left it like that. We did not go through the infinite process. The infinite process is you take the limit delta x going to 0. So in calculus what you would expect is as delta x goes to 0, the error should go to 0 and you should get the derivative, right. But we have a machine that has finite precision and therefore we have round off error and the slope of this line is what do you expect the slope of this line to be? The slope of that line should be 1, right because the truncation error, the convergence, remember this is the order at which, the speed at which it is going down. It is converging to the actual answer was a delta x, right. So the exponent is 1. So the slope of this line would be 1. I am plotting log delta x, log error versus log delta x now, okay. So the slope of this line is 1 but surprisingly there seems to be, it seems to stop at something that is not such a smooth line but if you squint at it, it looks like it has slope – 1, right. If you sort of squint at it, it looks like it has slope – 1, fine, okay. So we will leave this graph and this value here is of the order of 10 power – 8, 2 into 10 power – 8. You may not be able to actually read it out but it is of the order of 10 power – 8 and that error occurs close to 10 power – 8. So looking at this, the immediate conclusion that we can come to is if you are doing forward differences, at least with this particular function, we will try out different functions a little later, at least with this particular function, it is not worth taking a delta x smaller than 10 power – 8, okay. It is just not worth taking delta x below 10 power – 8 because you are going to just be getting, your round off error is going to dominate and it is not getting any more accurate, fine. So I will just hold this graph just so that I can plot another graph on top of it and what we will do is, we will go through the same process, we will now do central differences, okay. We will go through the same process and we will do central differences. So let me redefine my dx because I sort of set, maybe this is not what I want. I made a mistake. Here we go. Let me define my dx as equal to x again. I redefine, I clear up my capital DX. I clear up my error. I reset them to 0, okay. And in order to get, in order to get the first difference, so I am just reusing, I am just reusing the same code. The only difference is for central differences, this is sin of x – delta x. Now you understand why I am sort of using this and I have to divide by 0.2 half, 2 dx. In this case, anyway, I will make it 2 dx. I will divide by 2 dx. I think everything else is fine. Everything else is the same. Everything else remains the same, okay. That is fine. So if I plot this now, this is second order accurate. If I plot this now, you have already seen, so for this kind of exploratory work, an interactive interface like this is quite useful, right. So if you are doing production runs and for the kind of thing that you are learning, I would suggest that you stay with C or C++ or Fortran or whatever. And this is what we have, okay. So it is delta x squared. The truncation error is of the order of delta x squared. That means it is converging at delta x squared. So the slope of this line here is 2 because I have taken log and I am plotting versus delta x. This slope has not changed. Round off error is not changing. So what has happened is I have gone to a more accurate scheme and there is a line here because this is a log log scale. I would suggest that if you have not tried it out already, figure it out, just write out the relative error, take log on both sides and see what you get, right. And you will see that you can actually explain why this is a 45 degree line. The round off error line is a 45 degree line. It is a 45 degree line. And essentially what it says is that in the numerator, right, every time the delta x becomes closer to 0, okay, in a binary system by 1 bit, you lose 1 bit in the numerator in round off error. And effectively you have, you are not getting as you hit this limit. So this value is of the order of 10 power minus 11, so the best that you can get is of the order of 10 power minus 11. But the delta x that you can take in order to get that 10 power minus 11 is 10 power minus 6. So if you decide yes, I want something that has better truncation error. I go toward delta x. So I go to something that is converging as delta x squared. I cannot take as small as delta x. Yes, I have gained something. Instead of 10 power minus 8, it has become 10 power minus 11. But I just cannot make it, you know, I cannot go back to 10 power minus 8. Delta x is 10 power minus 8. That is not possible. That does not work. Because if you do that, you are going to end up back here. So you have gained nothing. The second order scheme is giving you the same as the first order scheme. That is the key, okay. That is the key, very important. Because sometime we have tendency to say, oh, I am going for very high accurate. I will not get this really accurate scheme. Go for as high an order as possible. Make the delta x as small as possible. So there are, you have to be careful. You have to be careful. We have the resources, but you have to be careful. Okay. So now instead of, so I can do backward difference, forward difference. You know, there are a variety of ways by which I can go through this. As I said, I have got a pre-written code for, so I will just import the pre-written code that I have. So all of this stuff, as I said, you can just go through a Python tutorial quickly and figure out what I am doing here. So in this, I have something called error. And what this will do for me is, this will open up this nice window again. I will make sure that I have set it up so that the demo colors are on, right, so that I do not blind you guys. Let me go back here. And I have a simple function plot error, which will actually plot the error. It will compute this for first order, forward difference, backward difference, second order, right, second order, central differences, one-sided differences. So there are a whole host of these kinds of things, third order and fourth order. That is what it is going to do. So let me show you, oops, I have an error there, but it does not matter. Let me show you what I have got. So that is what we have. So this needs a little explanation. It is really messy. So what I have got here, I hope this is clear. What I have got here is first order, forward difference, the symbol is backward, is the dot is backward difference, second order centered, second order forward, the rhombus is second order backward difference, third order and fourth order. We will zoom in on that so that it is clear as to what we are up to. In this scale, what I want to show you is, yes, that line, round off line, you cannot get, you cannot avoid it. It is going to be there. You have to live with it. So whether you do first order, second order, third order, fourth order, now you know the slopes are 1, 2, 3, 4. And in this region, it does not really look like, so I would not trust anything beyond this, it is lower here, but it looks like the same noisy thing going on. So fourth order, that is of the order of 10 power – 13. So going from second order to fourth order, fourth order, I went from 10 power – 11 to 10 power – 14, 10 power – 13. And the delta x is of the order of 0.001. And in a similar fashion here, that is still of the order of 10 power – 12 and the delta x is of the order of 0.002. So it does not, okay. So I want you to bear this in mind. So if you are going to use combination, you are going to do these derivatives, you are going to use combinations of delta x, you know, second derivatives, third derivatives, which we will see as we go along. At that time, when you are doing it, I am going to add a second derivative term, I am going to add a fourth derivative term. Please remember that that contain, that curtail that limits the size of the delta x that you can choose. Is that fine, everyone? Okay. Let us just zoom in to see what is happening here. So what I can do is I can pick one segment somewhere there. And yeah, lots of graphs, but this is the one that I am interested in. This was my first 45 degree line, right, forward difference. And the dots on it are the backward difference. And this part, they are reasonably good, one on top of the other. Remember, I am taking absolute value. The sign was different, but they are reasonably good. They are essentially one on top of the other. The derivative is the same. You would expect it to be the same. In the other case, yeah, they do vary. They are close to each other. They do vary. Fine. So if I hunt for the, if I just hunt for the other trough, here is the second derivative term, second order term for the first derivative, second order term for the first derivative. There are three of them. So you can see the box, black box, the black rhombus, right, the square, the rhombus, and the dashed line. The minimum is not quite at the same point. So I would most probably, you know, but they are reasonably fine, but they stick to each other. They are quite close. So in that sense, if you are forced, so central differences have certain advantages. One-sided differences have certain advantages. We will see why we would use each one at different points. We will see that as we go along. But the truncation error behavior seems to be the same. Okay. Is that fine? And finally, just to keep, just for completeness. So you can see around here, as I said, I do not quite trust this. So I would most probably take a value around there, right, which is about 0.02 and possibly a value around there. That would be the smallest delta x that I would choose, right, and that is about 0.015. Is that fine? Please bear in mind that this is for sin of x at pi by 4. Okay. So we are not doing mathematical analysis or something of that sort. This is purely empirical. Is that fine? What do we have? What is the next thing that we can do? Maybe we can change the function. Should we try changing the function? So what I will do is I will create another plotting. I will create something else to evaluate it. So OERR. I will just set this up first. Okay. So you are going to get a flash of white again. Let me quickly load my demo parameters so that I get that out of your eyes. Okay. So we have that ready. We need to define two functions. Okay. So maybe I will not do it and you can, there are, you can create lambda functions in Python but I will just create, I will say define f of x. I will define f of x. What do you want? Which function do you want? Give me a function. x squared. Okay. Fine. x squared. So I return x squared. Define f prime. f prime is the derivative. So I have to be careful. I mean I could have it do it analytically but let us do it ourselves. Return. I do not want to do any fancy programming here. 2 points star x, 2 x is the derivative. Okay. Is that fine? So what I will do is I will now plot and everything works well. That should just work. Oops. I seem to have some error as I said but it is fine. What is this? What is this strange thing that has happened here? What is this strange thing that has happened here? Right. You just get what is this line? This line is going all the way down. The line goes all the way down. That is a 45 degree line. Right. Can we explain this line? And then you have this which is the first order. First order. So what, can we explain this line? So normally if you want to do this what you have to do is in your mind it is like playing a detective game. In your mind you have to predict. From what you know you have to predict. This is what I expect. I try this function. This is what I expect. You have to try it out. That is how you exercise your understanding. You predict what is going and then plot it. That is what you are doing. Then you have to explain the difference. If you manage to get what you have predicted here that is fine but otherwise you have to explain the difference. What is happened here? Can you tell me what is the deal? Remember we are plotting x squared and we have x squared. So this truncation error if you go back and look at it. This truncation error was like delta x into dou squared phi dou x squared. It was second. In this case it is dou squared f dou x squared. So dou squared f dou x squared is 2. You see what I am saying? dou squared f dou x squared is 2. But any higher order will be it is supposed to be 0. It is supposed to be 0. But actually what you got is only round off error. The truncation error can go. The round off error is always with you unless something peculiar happens. We will see if something peculiar can happen. We try out one more and see if something. So the truncation error is 0 because you have picked something so that the third derivative, the truncation error has a third derivative. So legally you should have got 0. But you are stuck with round off error. Is that fine? You are stuck with round off error and that round off error is with you. So even if I were to shift the graph down and yeah there is something funny happening here. So there may be because of the representation we may have chosen delta x values where indeed the truncation error by chance and the round off error because of the values are exact in binary system happen to be 0. Sometimes you are lucky and that is what these lines indicate. There are values at which it is actually gone to log 0 which is minus infinity. There are few values where it is happening. Is that fine? But otherwise you know, otherwise what we have I am sorry maybe I should not have done that. I will close it. Otherwise what we have is you just have round off error and that is it. You have to live with it even though you do not have, even though you have managed to choose a scheme so that your truncation error is 0. Is that fine? Are there any questions? You want to try a third function? Solution for a function? Yes. Sink well that is going to behave very close to sign. I mean unless we pick a dirty value or something of that sort. You want to try log x? Let us try log x. Sink unless you could try you could try the sink function or something. Yeah we have to pick a value maybe you could try a value which is close to 0 but then I have to be careful when I do it. I cannot take relative errors. You have to take absolute error. Fine. We will try log x or whatever it is. Okay. That is fine. So I will create one more. This time I will go through this quickly and yeah I really should have this so that you reuse the plotting program but anyway it does not matter. So each one of those sort of imports its own grace plot. It does not matter. So I now define g of x a different form oops I do not want to call it h of x. See this is how you make programming errors. I already have a g which is the plotting. So I want to return you want log of x. Is that what you said? Log of x. And I define h prime I call it hp of x and return the derivative is 1 by x. Okay. So let us see what we get. O2 h, hp is going to pop up maybe. What happened? I made a mistake and sometimes you can pay a price for this. See whether how bad the price is. Oh my God. Look at all this. So log is a little interesting. So we get something that is very similar to well it is a transcendental function. So maybe even sync would have been the same. I mean so but there are places where it does seem there. The round off error seems to go away. There are places where when you are doing computations you cannot hunt for these. I mean you do not know what values of x you are going to get. So these are not, it is interesting to know that this can happen. And by chance, by chance, if it happens for you it is nice. In this case because I am getting minus infinities and so on the program is not doing anything bad. It pops up a window. I killed that window. Program is not doing anything bad. But you have to remember that when you are taking log you have to check the argument. That is one of the things. By chance it may turn out that it is 0. By chance it may turn out that it is 0. But otherwise I think the behavior is essentially the same. So that is about 10 power minus 19, 10 power minus 13. This value though is 0.004 into 10 power minus 4, 10 power minus 5, the x value. So I think right, so the slopes and where they intersect, what values that you take are essentially the same. Okay, fine. So we are done with this. If there are no questions, are there any questions? If there are no questions, I will leave this demo be. Let me just show you. We will try to see how much we can do by way of Laplace's equation today. Fine. So I will choose a small grid to start with. What I am going to do is I am going to use as I said the package called Maya V. So from, I will just set it up. So from this Maya V, I will import a particular module called mLab. Now initially what I will do is I will use a 5 by 5. I will choose, I am sorry, this is what is called, so if you have a live demo, these are the things that can go wrong. Let me see if I can get out of that. Let me restart. Okay. So what I will do is I will create a 5 by 5 system first or a 6 by 6 system or whatever. We will create a small system and then just so that you understand how the numpy Python part works. I just want to make sure that you get that part first. And then we will see. So let me make sure since I said numpy, let me make sure that I import numpy as np. And just in case I need it, I will import graysplot also. So all that is done. My basic homework is done. Now in this case, I am going to use a package called mgrid. I am going to use a function called mgrid. And what it does is, so between 0 and 1, we have been solving problems between 0 and 1. I am going to have 5 grid points. You have seen this notation before and in the x direction and in the y direction also we will have the same thing. So this 5j, it is actually a complex number. It is a way by which you tell numpy that you want 5 grid points and that creates essentially a mesh. So let me show you the mesh. That is x. So you can see the x values are 0 and then they are increasing by 0.25, 0.5, 0.751. So those are my x values and my y values are in a similar fashion 0.25, 0.751. So x, y combinations will give me coordinates, a combination of an entry from x and an entry from y will give me coordinates. And my solution that I used, what I used for, what I suggested for you guys to try out was x square – y square. So I can see what that looks like. That is x square – y square. So that is phi, x square – y square. And yeah, I mean you can check it out but you can see that the diagonals are 0, x equals y is 0. So that is reasonable. That looks okay. Is that fine? Now I want to show you and this is something that is done in most, a lot of these programming languages, scripting languages. Let me just show you to see how I am going to index. I am going to choose ranges of indices so that I do not have to do a lot of loops. So I just created a list, an array which has 11 elements, 0 through 10. So if I say a of 0, that gives me 0, a of 1, gives me 1, fine, no big deal. You can also do this. You can say a of 1 colon – 1 and that will basically drop the first element, drop the last element. Is that fine? Everybody is with me. So instead of 0 through 10, I have got 1 through 9. I just want you to understand this. So if I make this 2 instead of 1, it drops the first 2 elements, retains all the others. If I make this – 2, it drops the last 2 elements. Am I making sense? So what this allows me to do is when I am saying i plus 1, i minus 1, all I will do is I will shift that. So for instance a of 1 colon – 1 gives me all the interior points essentially. So in a similar fashion phi of i, this has 2 quadrants, 1 colon – 1, 1 colon – 1 will give me the interior points. So that gives me the interior points. Is that fine? So because we are going to solve for, you see we are not supposed to know the solution. We are going to solve for this. I will set it equal to 0. I will set the interior points to be 0. So that is my phi 0. This is my solution vector. This is my candidate solution. My initial condition is 0 and the boundary conditions are set. Is that fine? Everybody. So how would I do Laplace's equation? So normally in C, you would use a for loop, in FORTRAN you would use a do loop. Here we are just basically going to write it out. So what you would have done so far was 1 colon – 1. So the interior points, I am going to update the interior points equals 0.25 times 1 fourth of what? Phi of we want to shift to the left 0 colon – 2 that shifted to the left, 1 colon – 1 nothing done in the y direction plus phi of I want to shift to the right 2 colon, 1 colon – 1. I do not want to do anything in the y direction. Now we repeat the same process but only in the y direction. So phi of what is it? 1 colon – 1. So I do not do anything in the x direction now, 0 colon – 2. So I have shifted it down. Let us go through this again. I hit enter 2 quickly. Set the center value to 0 and I have one more. Phi of 1 – 1, tell me 2 colon. That should be right. So we just have this and it is always important that we are able to see what we have. Fine. What I will do is I will create a visualization now. I am going to use Maya V to do that. So I say there are various ways to do it. As we go along, maybe I will show you different ways by which we can do it. Today I will just use mLab and I will use something called a contour surface. To contour surface I need to pass it the x, y values and the phi value. So I have x, y, phi and I would like to tell it how many contours. So let us say we add about 10 contours. Now because this is actually a 3D plotting utility, it will plot the contours on the actual solution surface. Today right now I do not want to do that. We will do that at a later date. Right now I want to keep it simple because so what I will do is I will say warp scale. So how is right. So all of these things as I said you can, the documentation is available online. So I will just set that to 0 and that should think for a short while and just basically give me that. That does not make sense. So you can ask the question what is that. So we will try to see whether we are able to make any sense out of it, give it a coordinate system. I will scale it up. So that still does not make sense. So let us see if we can use mLab to add an outline or something of that sort so that we get the box. That is our unit square. That is our unit square with the contours and let me maximize it for you. Make it large. I think I will also add a scale so that you have an idea to what is happening. We have added number of contours, range, texturing. That is not what I want to do. What do I want to do? Show a legend. That is what I want to do. Show a legend and I close this. There we go. You have got a legend there. Now I will maximize this so that you can look at what we have. There we go. I have a legend. Fine. I have the legend. It goes from plus 1 to minus 1 as you would expect and that is my initial guess. Fine. Everyone. So this in case you cannot make that scale out. So that the x, y coordinates. So this is the x direction and that is y direction. Fine. I hope you can make out the scale. Are there any questions? Okay. Let me just reduce this to something that is smaller and do this one more time. Okay. So as we may want to keep track of the error, is it possible for us to look at the error? We can actually look at the error. Okay. It is possible for us to look at the error. So what I will do is I want to keep track of the error. So like last time I will create a list called drr. But I will calculate the error. Error is what is the error? What is the solution? x square minus y square and from this I want to subtract out phi. Everyone, that is fine. Okay. So and what we will do is we can visualize the error also. We can see what the error is. So v dot m scalars equals err and that is what the error looks like. Okay. So the error is symmetric. The error is symmetric. If it is too small for you to see, I will maximize it again. The error is symmetric. The error goes from plus 0.125 to minus 0.125. The error is symmetric. Okay. So this demo is two-fold. One is how do you explore when you are doing numerical solutions and so on? How do you explore your schemes? How do you go about that process? This is interactive. You can try things out. Okay. So and the other is that we try to figure out, you know, how fast. So I have got this error but this error is a matrix. If you ask the question what is this error, this error in fact is a matrix. It is a 5 by 5 matrix. It does not help. So let me take the square of that matrix so that those negative numbers go away. Okay. Let me take the and what I will do is I will take the square root. I will take the square root and put it in error. Err, my list. Okay. Square root of the sum of all those terms. That is why you should open and close brackets every time you do it. Right. You make mistakes otherwise. Okay. So what is Err? Err has one way. So the error now, the square root of the sum of the squares is 0.3 after one iteration. Is that fine? I can do one more iteration. Let me go back. Find my iteration. I will do one more iteration. Okay. One more iteration. What does that do to the solution? What does that do to the solution? So that is what you get. It looks about the same. Right. What we will do is at a later date without doing all this error and all that we will run it once and you can see the solution evolving. Right. I will make one fancy demo where I have got everything going so that you can see the solution evolving as it goes along. Okay. Which is also fine. But as I indicated, you are, let me just maximize it. As I indicated, it looks symmetric. Everything is nice. And I can also plot. I can also plot the error just like we did last time. So I will pull that. Err is x squared minus y squared minus 5. I can plot that. See what that looks like. So from 0.125, is it become? 0.0625. In fact, it seems to have halved. The range of the scale seems to have halved. Okay. So that is basically what we have. The range of the scale seems to have halved. So we can do this business now. So you say where did we have that? I had error is I will square the error and I will append that. I will append that. Fine. Okay. Everyone. Okay. So we can keep doing this manually instead of doing it. It is nice when you are doing it once or twice. But what we will now do is we will iterate. How many times you want to do this? 100 times? You want to do it 100 times? Let us do it 100 times. See what we get. Okay. 100 times. I am a lazy guy. I am scared. I may make a mistake. So, right. So we have to be careful. So that is phi, right. And maybe we will stop looking at plotting the error. You understand what I am saying? We will plot only the, we will plot only the phi as it evolves. We can always plot the error part later. Okay. So we reset that. We have to recompute the error each time. So where do I have that? I have to recompute the error each time. Okay. What else? We need to square that and I need to append it. Just make sure. I think I have got everything. I have done all the steps that I need to do. Okay. So programming, this is one thing I have to repeat. We are all error-prone, right. So you have to be constantly paranoid. You have to check to make sure that everything is fine. And what is happening here? Well, the solution apparently is evolving. I cannot make out anything. That is the tragedy of, gone through. It is finished, right. Because the errors are small. So this is the other thing that I want you to understand. So you look at two graphs on the screen. If you look at two graphs on the screen and the graphs look very close, that does not say much, right. Because the screen, typical screen resolution is like 70 dots per inch, right, or 100 dots per inch. Just because two lines are close, does not mean that they are close. Am I making sense? So it does not mean. So you have to, that is the reason why I stored that error, the other error. Okay. So now I will create my grace plot where we are going to look at it. Right. Remember right in the beginning, I had this. I will quickly, I am sorry, quickly get rid of that, right. I create my grace plot and I will plot E R R. Okay. And as usual, it gives me, see this is the other thing. So lot of us do this plotting. You have to always remember, always plot. When you are plotting residues and so on, the range is very large. So you need to go to a log scale. A log scale. So we will change this to a log scale. So I will make this very ambitiously. 1 E minus 16, put it on a log scale, apply that, make, oh I should have made that 1000 or 10000 or something of that sort so that it does not look fluttered up. So it seems to have done, it seems to have done, this is only 50. It seems to have done better than that. Maybe 1 E minus 20. Oh, that is not bad. Okay. So it is possible that, it is possible that you get two identical numbers. This is actually possible. So what has happened is, after about 30, 40 iterations, your answers became the exact answer. On a log scale that looks linear. It looks like a straight line. So you can try to find out what is the convergence rate. Is that fine? Okay. So next time, in the next class what we will do is, we will do a demo but we will do a larger one and see what the scale works out. Okay. Is that fine? Thank you.