Watch these four (4) videos in order. The total video time is 23 min. Be sure to test your knowledge with the knowledge checks after each video.

Description: This video discusses how Romberg Integration uses two estimates of the Trapezoid Rule to find a more accurate answer to the problem.

Video Transcript Hide Video transcript

Hello, this is a video NI|VL|04 and it is the theory of Romberg integration for solving numerical integration problems.

Let's first discuss the principle behind Romberg integration. Romberg integration tries to improve the Trapezoid method as follows. Suppose at the exact value of the integral, Iexact is equal to the Trapezoid rule with a distance h plus the error, which is e(h). This equation, we can assume that you're taking one full step of h over the entire bounds from a to b. Now the exact integral can also be equal to taking two steps, which would be equal to the a trapezoid with an h/2 plus its associated e(h/2). We can now set these two equations equal to each other and what we need to figure out is the relationship between the errors. As it turns out, there is an equation for an estimate of the error which is - (b-a)/12 times h2 times the average of the second derivative over the bounds of a to b, which in this case is f’’. If we take the ratio between the error e(h) and e(h/2), you'll notice that most of the terms cancel out and we'll get a final relationship between e(h), which is 4 times the size of E(h/2). We can now plug this back into our previous equation. In this case, the equation where we equated the trapezoid rule with a step size of h, with the trapezoid rule of half of h. We can then plug in the associated errors and solve for the e(h/2), which will be related to both Trapezoid methods. Finally, we can plug this back into our relationship of the exact integral, Iexact, with a trapezoid rule with a half of h. And this gives us an estimate of the Iexact = (4ITRAP(h/2)-ITRAP(h))/3.

Let's look at this graphically. Let's plot a function. We can find the area of that function between some bounds. In this figure, the area is represented by the orange square. Now let's use the trapezoid rule over the same bounds, but only take one value of h, which will be one straight line. Its area is represented by the green square. Next, we will do the Trapezoid rule again, but this time we'll take two half-steps to get an estimate of the error. Its area is represented by the turquoise square. What you'll notice is that the turquoise square is closer to the actual area, which makes sense because we are using more data points and it will give us a better estimate of that area. Recall that the exact area would be represented by 4ITRAP(h/2)-ITRAP(h))/3. To represent this visually, what we can do is we can multiply the area of the exact amount by 3. And then we can take the turquoise square and multiply that by 4. What you'll notice is that 4 times ITRAP(h/2) is a little bit bigger than the true integral. This is where the smaller green square comes into play. The excess area is equal to the Trapezoid rule with a step size of h, which is why you subtract it from the overall value. In this case, the areas line up very well because the function was quadratic. In other times with other functions, it might not be as exact. However, what you can do is decrease the step size again to get a better estimate of the root and continue through an iterative process. And you can use these Romberg estimates of the integral together to get an even better estimate of the integral. This can be accomplished using an extension of the Romberg integration equation shown here.

This is best shown through an example. The first thing you can do is actually construct a table. The table has columns j, h, and then a certain number of k's that you'd want to do that we will discuss in a moment. The first step is to start with the first iteration at j = 1, which will be taking a step size of the full bounds that we have. When k = 1, this is equivalent to doing the Trapezoid rule. In this case, the area would not be quite accurate. The value of the trapezoid rule shown here would just be 0.2. We need another estimate of our area and we'll do this with our j = 2, which means that our h is now in half. We can find our k = 1, which is again with the Trapezoid rule, by taking two half-steps over the same interval. In this case, the estimate of the integral is 3.325. Now that we have the two estimates, we can apply the Romberg equation. The general equation here can be simplified to when k =, that becomes Ij,2 = (4Ij+1,1 - Ij,1)/3. This gives an estimate of integral and approximately 4.367. We can now get another estimate of the error by dividing by 4, which will happen when j = 3. We can apply the Trapezoid rule to now four sections and fill in the table at k = 1. Now we have two estimates again using h/2 and h/4. And this means that we can use the Romberg equation again to get another estimate of the integral. We now have two estimates of the integral at k =2. So we can use the generalized Romberg integration formula to find the next best estimate. When k= 3, the equation becomes Ij,2 = (16Ij+1,2 - Ij,2)/15. This gives an answer of approximately 4.7833 when k = 3. So we can do one more iteration with j = 4 and h is equal to h/8. We can keep using the respective formulas for k = two and k = three. And the formula for k = 4 is (64Ij+1,3 - Ij,3)/63. You'll notice that our answers are converging as we go further to the right. And our final answer is 4.7833.

This concludes the video. This project could not have been completed without the support eCampusOntario and the University of Ottawa.

Description: This video implements the theory of Romberg Integration in a practice problem in a step-by-step approach.

Video Transcript Hide Video transcript

Hello, this is video NI|VL|05, and it'll be a step-by-step example of Romberg integration for solving numerical integration problems.

First, let's look at the problem. Solve the following integral. The integral between 0 to 3 of x*sine(x)exdx. First, let's look at the layout of the solution. In the bottom, a Romberg integration table at the bottom right will be a table of data points. At the top right will be the equations that will be needed to solve this problem. And the top-left will be the graph of the problem between the bounds that we have. The equation that we have is f(x)=x*sin(x)*ex with the bounds of a = 0 and b = 3. What we will use when k = 1 is the trapezoid rule that can be used for multiple points that have equally spaced data. We have the other one for when k ≠ 1, this general formula here, that is the corrections that will be used to get a better estimate of the integration. Here is the graph of the function. You can see it is quite non-linear and we're looking for the area under this curve. Let's start when j = 1, we're going to take a full step size of h, that is b - a or 3 in this case. And so we can take some data points from that when x = 0 and x = 3. What that will give us is the Trapezoid rule, as shown in this graph here. So with these values, we can actually calculate the area which is when j =  and k =1, that ends up being 12.755. We need another estimate of the area, so what we'll do is j = 2, which means that we're going to cut our h in half and take two steps here. We need an extra data point at x = 0.5. And now we can use the truck. Now we can use the Trapezoid Rule to determine the value at j = 2 and k = 1. In this case, it will be 16.43. Now that we have two estimates at k = 1, we can use the Romberg integration equation, which will give us 17.663. And the Romberg Integration equation would be 4 times 16.43 minus 12.755, all divided by 3, because k = 2 in this case.

We will continue with this process, which means that j =3. And now we'll have our h divided by four. So we need additional data points at x = 0.75 and x = 2.25. And with that, if we use our Trapezoid rule here to get our answer, we will have 21.487. And now that we have those two values, we can use when j =2 and j = 3 to find another estimate at k= 2 using the Romberg formula. In this case here we will get 4 times 21.487 minus 16.43, all divided by 3. Now what you'll notice is we've got two k = 2 values, which means we can apply the formula again. However, in this case, k = 3. When we do so we'll start converging towards 23.538. In this case, this would have been 16 times 23.170 minus 17.663, all divided by 15, because k= 3 and not 2. We will now do one more iteration with j = 4 and h is divided by 8. That is, the bounds between 0 and 3 has been divided by 8, which will give us all the data points we need for this problem. And that will give us a good estimate of the area already with trapezoid rule. And we can use the Trapezoid rule to find out what the value is at k = 1 and j = 4. Now that we've got evaluate j =3 and 4, we can use that to find a value of k = 2 using the Romberg equation. Now we've got two values again that we can use to find when k = 3. Since we've got two values at k =3, we can use the Romberg equation one last time for when k = 4, which is the equation of 64 times 23.636 minus 23.538, all divided by 63. And what you'll notice is the values of started to converge to a value of 23.64. This gives us a final value of 23.638 as our solution. We found the area as best we could of underneath this curve.

This concludes the video. This project can be completed without the support of eCampusOntario and the University of Ottawa.

Description: This video discusses Gauss Quadrature, which uses predetermined intermediate points in the integral to predict a better estimate of the solution.

Video Transcript Hide Video transcript

Hello, This is a video NI|VL|06 and it will be the discussion of the theory of Gauss Quadrature for solving numerical integration problems.

Let's first discuss the principle behind Gauss Quadrature. Let's start by looking at a graph of a function. As before, we can take the area under the curve to represent the integral of f(x)dx. Let's now estimate the area under this curve using the Trapezoid rule. We will assume one step between the bounds from a to b. We should notice here is that the trapezoid rule denoted as I, has the value of 0.1 where the true answer is approximately 2.67. So of course, you can take more steps with the trapezoid rule to make it more accurate. However, Gauss Quadrature methods are actually more efficient here. Gauss Quadrature uses interior points of the function to get a better estimate of the area. Here you'll notice that if we use certain points in this function, we can actually get a very accurate answer compared to the true answer. Let's determine these points. Recall that the integral that we're looking for is I is equal to the integral from a to b of f(x)dx two point Gauss Quadrature works by summing up two values of interior points, x0 and x1, and weighting them by factors c0 and c1. We need to figure out what the value is of x0, x1, c0, and c1, are to be able to use it. Since there are four unknowns, we will need four equations. And what we can assume is that the function f(x) has four different equations to start with. We'll assume that f(x) = 1, f(x) = x, f(x) = x2 and f(x) = x3. We can now take these equations and plug them into the weighted function shown before. We know that these values should equal to the integral of f(x)dx. In this case, we'll assume that the bounds are between negative -1 and 1. With these bounds, the integral can be found to be a constant value. And these four equations can be now solved simultaneously for c0, c1, x0, and x1. It turns out that c0 and c1 is equal to 1 and x1 = -1/√3, and x1 = 1/√3,. So Gauss Quadrature, because it's based off of equations up to a cubic equation it is good for estimating integrals for cubic equations.

Take for example this function here with 2-point Gauss Quadrature. Unfortunately, it does not give an accurate answer to the solution, and therefore other Gauss quadrature methods can be used. For example, 3-point Gauss quadrature that uses 3 points and instead of 2 gives a more accurate answer to the solution. In this case, the solution is precise to five decimal places. As you can imagine, doing the same procedure with four points would also yield a pretty accurate solution. Here are the ci and xi values for 2-point, 3-point and 4-point Gauss Quadrature. Gauss Quadrature is only an application of the weighting factors times some function at the interior points, depending on the number of points you'd like to use. The points for Gauss Quadrature is used when the integral bounds are between -1 and 1. What happens when we have bounds between a and b? Luckily, we can translate our values with a simple formula. The formula is x =((b + a) +(b-a)xd/2. xdi in this case is the Gauss Quadrature points with bounds between -1 and 1. So, this will yield an extra term after the summation of all the weighted factors, Gauss Quadrature becomes ((b – a)/2) times the summation of cif(xi). Gauss Quadrature can usually yield an accurate solution with a very few number of data points.

This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.

Description: This video implements the theory of Gauss Quadrature in a practice problem in a step-by-step approach.

Video Transcript Hide Video transcript

Hello, this is video NI|VL|07, and it is a step-by-step example of using Gauss quadrature to solve numerical integration problems.

First, let's look at the problem. Solve the following integral with 2-point, 3-point and 4-point Gauss Quadrature. The problem is the integral from 0 to 3 of x*sin(x)*ex dx. Next, we will solve the problem. We will start by creating an integration table on the bottom, the table that's columns i, xdi, ci, xi, f(xi), and cif(xi). We will do 2-point Gauss Quadrature first, so we only need two rows in the table. Let's look at the equations. Firs,t we have our function x*sin(x)*ex and the bounds a = 0 and b = 3. Next, we have the equation that we'll use to scale the Gauss Quadrature values, which will be xi = ((b+a)+(b-a)xdi)/2. Finally, we'll have a final integration equations, which is I = (b-a)/2 times the summation of cif(xi). Here's a graph of the plot between the balance that we have. Since we were doing 2-point Gauss quadrature, we can look up the xdi and ci values. The first value at i=0 is -0.57735, which is the same thing as -1/√3. For ci it is a value of 1. And the second is 0.55735 or one over the root of three. And the value of ci, the weighting factor, is 1. We can now use the values of xdi and the scaling equation to find the values of xi, which in this case it's 0.634 approximately and 2.366 approximately. One thing to note that these values of x, if done properly, should be between your original bounds, which in this case is a = 0 and b = 3, which works well. Next, we'll use an equation f(x) to determine the values at f(x) for both those points, which will be 0.7 and 17.6 approximately. We can now multiply the values with ci, the weighting factors, times the f(x) values to get an estimate of the answers. In this case, we're multiplying by one, so there's not too much to change. Then we can sum up these values of cif(xi), which gives us 18.35. And what we need to do to find the integral now is actually multiply that value by (b-a)/2, which would be a value of 1.5. This would give us 27.54 as our approximate answer of the area. The final answer is 27.53. And if you were to plot this on the original graph, you'd have a trapezoid rule similar to what's shown here.

Next we're going to try 3-point Gauss Quadrature. So we will use the same equations as before, but in this case we'll have three points from i = 0 to 2. So our first value gives us an xdi value of -0.7746 and a weighing factors ci of 0.556. The second is xdi = 0, and that gives us a weighting factor of 0.8889. And finally, the last one is 0.7746 and a weighting factor 0.556. We can use the xdi values to find the xi values with a formula. And what you'll notice here is that the points again lie between a = 0 and b = 3. The middle point, which is xdi = 0, gives us an xi value of 0.5, which is actually in the middle of both ranges. Recall that xdi is between -1 and 1, the middle point of that is 0. And the middle point for xi would be 1.5 as it's between 0 and 3. Now that we have our xi values, we can get our f(xi) values using our function. And then with our function and this weighting factors ci, we can calculate cif(xi). Now that we have those, we can sum them up to give us 15.82. Then we can find our final interval when we scale the value of the summation by (b-a)/2. That gives us a value of 23.74. As our final answer. Here is how the graph would look if we plotted a quadratic equation with the interior points given from Gauss quadrature. And it's lining up a bit better with the area that we have.

Next, we will do four-point Gauss quadrature, which we'll use the same equations. But in this case here we're going to have 4 points that we're going to use for the Gauss quadrature points. We have when I = 0, we have - 0.86114 and a weighting factor of 0.3478, and it turns out that the fourth data point i = 3 is very similar except for it's the positive value of xdi with the same weighting factor. The other two points, when i =1 and 2 are also very similar except for i = 1, we have -0.33998 with a positive value of that for i= 2. They have the same weighting factors of 0.65214. Next, we can find our xi values again by using our formula. You'll notice again that all these values are between 0 and 3, which just means it's done correctly. We can now take our xi values and find f(xi) using our function. Now that we have the f(xi) values, we can multiply them by the ci values to get cif(xi). That we can have all those, we can actually sum them up to get the sum of all those values. With the sum of all those values, we can multiply it by (b-a)/2 to get the estimate of the integral. So our final answer for 4-point Gauss Quadrature is about 23.63, which gives us a graph as shown here, covering the majority of the area under those bounds. This is the end of the example.

This concludes the video. This project could not have been completed without the support of eCampusOntario and the University of Ottawa.