00:01
You are designing a spherical tank shown below to hold water for a small village in a developing country.
00:08
The volume of liquid it can hold can be computed as volume equal pi h square times 3 r minus h divided over 3, where v is the volume in cubic meters, h is the depth of water in tank in meters, and r is the tank radius meters.
00:27
If the tank radius r is 3 meters, what depth must the tank be filled to so that it holds 30 cubic meters? we're going to use newton's rap's method to determine the answer and calculate the approximate relative error after each iteration.
00:47
So here we have the figure showing this tank, this spherical tank holding a volume of water with a depth here from the bottom of the tank to the level of water to the surface of the water and the tank has a radius r so the formula we use this volume equal pi h square time 3r minus h divided by 3 and the radius is meter as well as the depth of water in tank h and the volume in cubic meter so we're going to put the values to get and read of the units because we know all is given in meters.
01:38
And so we put the values, that is the volume is 30 and the radius is 3.
01:46
So we see that 30, the volume, must be equal to pi h square times three times the radius is 3 minus h divided by 3.
01:58
So this is the equation we get, putting the values we know, the radius and the volume that we want.
02:05
And then multiplying by three both sides, we get 9 equal pi h square times 9 minus h.
02:15
And distributing the priority inside parentheses, we get 9 in equal 9 pi h square minus pi h cube.
02:27
And now putting all terms to the left of the equation, we get pi h cube minus 9 pi pi h cubed minus 9 pi pi square plus 90 equals 0 this is the equation you want to solve to find h so we define the function f of h equal pi h cube minus 9 pi h square plus 90 so we want to solve the nonlinear equation f of h equals 0 using newton's serapsin method.
03:19
And we know this method uses the derivative of f, so we calculate that derivative.
03:26
Derivative of f is 3 pi h square minus 18 pi h.
03:39
So now we can write down the newton's iteration, or newton serapson iteration, which reads as the following.
03:54
Hn plus 1, that is a new iterate, is calculated by using the previous iterate as the previous iterate hn minus f evaluated at that previous iterate hn, divided by the derivative of f at the previous iterate hn for n greater than or equal to zero, whenever the derivative at hn is not zero.
04:18
So that means that we set initial guess h0 and then using this formula for n -equal 0, we get h1, and using that h1 calculated, we use the same formula for n -equal 1 to calculate h2 and so on.
04:34
We generate a sequence of values hn that we expect to converge to the 0 or root of the equation we want to solve.
04:47
So in this case we can write out this newton situation by using the formulas for f of h and its derivative.
04:58
So we get hn minus.
05:03
So in the numerator we have f at hn.
05:06
That is this formula of f here evaluated at hn.
05:11
So we get pi hn cube minus 9 pi hn.
05:22
Square plus 90 that divided by the derivative here evaluated at hn that is 3 pi hn square minus 18 pi hn for n greater than or equal to zero now we do some algebra here you can leave it at this but i'm going to do a little bit calculations to have simplified expressions we want so the numerator would be 3 pi hn cube because we're multiplying this denominator by h n here minus 18 times pi h n square and now this negative here is going to modify all signs of the terms in the numerator right here that is minus pi hn cube plus 9 pi hn square minus 90 all that divided by 3 pi hn square minus 18 pi h n for n greater than or equal to zero and now we simplify similar terms in the numerator of the fraction on the right side of the equation to get finally two by h h n cube minus 9 pi h n square minus 90 over 3 pi h n square square minus 18 pi h n for n greater than or equal to zero so that's new to iteration and and we're going to use an initial guess h zero equal 1 because we know the radius of the tank is 3 meters so we are going to choose a value that is less than this radius in particular h equal 1 should be good so taking this value is using this formula we calculate h1 using the formula in a calculator and we get h1 is approximately equal to 2.
08:22
0376 5259 8376 -9 -8376 -9411 941 and now with this value of h1 we use the same formula for n equal 1 and we calculate h2 and we get this is about 2 .0374 -9987 -970 -180 and you see using this value h2, the same formula for n equal 2, we calculate h3, which is about 2 .02 691 -8896118 -18681818.
09:21
And using this value h3, the formula gives us a way to calculate h4, which is about 2 .0269 -57 to 8331079.
09:38
And using this value now for n -equal 4, we calculate this in newton's iteration formula, h5, which is approximately equal to 2 .026 -9 -057 -28 -3101013.
09:57
And if you calculate h6, you get exactly the same h5 we have here with these 15 decimals.
10:05
So there is convergence here after five iterations.
10:09
So within five iterations, newton's rapsin converges to h about this value here.
10:38
And now we can calculate for each iteration.
10:42
We calculate the relative error, approximate relative error, which is calculated as h m plus 1 minus h n over h m plus one that is the absolute value of this of course we calculate this way because we expect each value of each iteration value be a little bit better than the previous one that is we are getting closer to the true solution and so we consider that iterate we have just calculated using newton's iteration formula as the real let's say value and so that's why we calculate that value, which is supposed to be a real, let's say, value, minus the previous iterate to that, that is hn, all that divided by the real value hn plus 1.
11:44
So that's the way to calculate the relative error as if hn plus 1 were the real value.
11:53
Of course, it is not so that's why this is an approximate relative error.
11:58
If you calculate that for each iteration here, for example, for the first calculation h1, then use a formula to calculate the absolute value of h1 minus 0 divided by h1 and so on.
12:15
So if you do that, we get the following values.
12:21
So the relative error in iteration 1, let's say it like this, is about 0 .57921...