CHAPTER 01.01: INTRODUCTION TO NUMERICAL METHODS
Math Procedures: Part 1 of 2
In this segment what we are going to do is, we are going to talk about the different mathematical procedures for which for which numerical methods are used. So I want to introduce you to some of them.
So these are some of the major mathematical procedures for which you use numerical methods; nonlinear equations, differentiation, simultaneous linear equations, curve fitting which includes interpolation and regression, and then we have integration, ordinary differential equations. Some undergraduate courses also do include some talk about partial differential equations, optimization, and fast Fourier transforms. So let's go ahead and, in this segment I'm going to just talk about the first four of them. So I am going to talk about nonlinear equations, differentiation, simultaneous linear equations and interpolation.
So if you look at the first case, we are going to talk about nonlinear equations. A simple example here is that of a floating ball here. So we have a floating ball and we want to be able to figure out how much is the distance or how much of the ball is submerged under water. So if we want to be able to find that out, for example, let's suppose that somebody tells us that the diameter of the ball is 0.11 meters and the specific gravity is 0.6 Then, what you are able to figure out is that you are able to get this equation which is a nonlinear equation. This particular equation which you are seeing here is a cubic equation which you have to solve. And once you find out the value of x you will be able to figure out how much of the ball is submerged under water. Somebody might say hey, why is this important? This can be important that, let's suppose you are filling in this tank with water and you are using this ball as a control so that when the ball goes all the way to the top right here, that the flow of the water stops. So we do need to be able to figure out how much of the ball is submerged under water when we are starting this process here. This particular cubic equation which you are getting here is basically obtained by using Newton's Third Law of Motion and Newton's Second Law of Motion which is basically that the upward force is the buoyancy force and the downward is just the weight of the ball. So if you take, if you use the Archimedes Principle, that the weight of the ball is equal to the weight of the water displaced, eventually you are going to end up with the cubic equation which is right here. Now, if we are just going to plot this particular left hand side of this equation, this is what you are able to obtain. This is what you get as the cubic equation. Now, what you are finding out is that you have three roots. You have this as a root of the equation, this as another root of this equation, and this as another root of this equation because you have a cubic equation, so cubic equation you are going to get three roots. They may be three real roots as the case for this particular equation, or you might have two complex roots and one real root. That's another possibility but for this particular nonlinear equation which you see here you are getting three roots so somebody might say hey, since we are getting three roots it means that the ball can float up to three levels. That's not the case because we know that the diameter of the ball which we had is 0.11 meters so that means that the value of x can going from 0 to 0.11 meters. It cannot be anything less than zero, it cannot be anything more than 0.11. So if you look at it this way then 0 is right here and 0.11 is almost right here. And you can very well see that there is only one root which is between 0 and 0.11. And the reason why I bring this up is because we do need to understand that even if we have some of the best computer algorithms available to us or best of the computer programs available to us or even availability of computational packages such as Matlab, Mathematica, Maple, etc. etc., we still have to use the physics of the problem to be able to solve an engineering or a science problem. And you can see this is a typical case where you are getting three real roots of the cubic equation and you are using the physics of the problem that x can be only between 0 and 0.11 and you are able to hone on into the root of interest to you.
The second mathematical procedure we are talking about is differentiation here. So let's suppose somebody gives you the velocity of this rocket which is going up as a function of time and wants you to find acceleration. So if you are trying to find acceleration it means that you are trying to figure out what is the derivative of the velocity expression which is given to you. Now, surely for this particular problem you can use your differential calculus knowledge to be able to differentiate this velocity expression to get the acceleration and put in the value of time, t, equal to 7 seconds which you are asked to do but how would if you are writing, doing this is in a computer program, where let's suppose this function is generated within the program itself or you are just looking for the numerical values as opposed to trying to do this symbolically. You will have to use some kind of a numerical technique to find out the acceleration of the rocket by using some kind of a numerical differentiation to do so. Many times when we continue with the discussion on differentiation, is that many times what you will have is that you may have to find the acceleration of a particular body when you don't know what the velocity is as a function of time, as a continuous function, but it is only given to you at discrete data points. How are you then going to find out what the acceleration is at time, t, equals 7 seconds? So those are the kinds of things which you talk about in numerical methods. You're only given the value of the velocity at only at three data points let's suppose and you are asked to find out what the acceleration is at t equal to 7 seconds. How do we go about doing that? Do we just simply draw a straight line from this point to this point and try to look at the slope of that straight line? How do we know that even if we take the slope of this line, how do we know that how accurate that is? Because one of the things which you got to understand about numerical methods is that you have to be concerned about two things from an engineer's point of view. One is be able to get the answer and also to be able to figure out how good that answer is. So thatís something which we will talk about when we talk about numerical differentiation.
The next mathematical procedure which you will see where numerical methods are used are simultaneous linear equations. So this is a typical example of being able to set up simultaneous linear equations. Here you are given velocity vs time data at three different times and what you want to do is, you want to be able to develop a velocity profile from 5 to 12 so that you can able to figure out what the velocity at a particular time is. So what you will do is, over here what we are doing is we are assuming a second order polynomial which is going through those three data points which are given right here at 5, 8 and 12. And what we want to be able to do is set up the equations so that we can find out what the constants of this polynomial model are, this second order polynomial profile are. So we have to find a, b and c. So what we do is we simply substitute the values of time, t, equal to 5, 8 and 12 and since we know the velocities of those three times we will be able to set up three equations and three unknowns. So the question rises how so I go about solving three equations, three unknowns. That might seem to be simple and straight forward that you already know that from your high school algebra or from some other courses such as physics and statics but when you have a million equations, million unknowns, what do you do then? So thatís why we do need to know about numerical methods of solving simultaneous linear equations.
The next mathematical procedure which we are talking about is interpolation. What we need to know about interpolation is that if somebody gives us data as a function of, well let's suppose data as a function of one variable, so here we know velocity as a function of time. So let's suppose somebody says hey, can you tell me what the velocity is at 7 seconds? So mainly what that means, the data is given to you as specific points and you want to find the data at some other point which is given to you. So what you are requested is that you are given the value of the velocity at 5, the value of the velocity at 7, and the value of the velocity at 12 is given to you and you want to find out what the velocity at 7 is. Now somebody might say hey, I have already taken my thermodynamics class and we used steam tables to be able to find, let's suppose, specific heat at a particular temperature which was not given to us in the table and all I did was I did simply drew a straight line between the two data points and I had this formula, this single formula and I was able to calculate what the value of the specific heat is at a particular temperature. Well, as you can see here is that, what I have done is that this is a straight line which you are getting here and this is the second order polynomial. The blue line which you are seeing is a second order polynomial which has been drawn through those three data points. If you try to calculate what the value of the velocity at time, t, equal to 7 second is you will get two different values. So again, what you are able to figure out is not just a question of getting an answer. I can get the answer about finding the velocity at 7 seconds by simply by drawing a straight line between two consecutive data points and being able to use my straight line formula to calculate the interpolation value. But right here you are finding out that the blue line which you are seeing here, the red line is a straight line that I just drew by visual aid and then the blue line is a second order polynomial which I drew by using Matlab. What you are finding out, we are getting two different values for the velocity. Which one is correct? Or, are either of them correct? So as we said in numerical methods, not only are you supposed to find the answer, but also how good that answer is or how accurate that answer is. And that's why we have to study numerical methods about interpolation also. And that's the end of this segment.