Professional Documents
Culture Documents
b g
h 2 3R h
V
3
V
Goal: Calibrate a tape scale for the sight gauge in convenient increments of volume.
Given R and various values of V, determine corresponding values of h.
h 3 3Rh 2
Methods:
3V
0
Bisection
False Position
Newton
Fixed-Point Iteration (Direct Substitution)
Wegstein Accelerator
See workbook file TANK.XLS.
f xL
and
f xH
are of opposite
f(x)
f(xH)
xL
xH
f(xL)
The bisection method then determines the next approximation to the solution to be
xN
xL xH
2
and x N replaces either x L or x H for the next round of the method according to
if f x N and
f x N and
f xL
f xH
The method is terminated when one or more of the following criteria are satisfied
1)
when x N from one round doesn't change much from x N in the last round, i.e.,
x Nnew x Nold
tolerance
x Nnew
typ., tolerance 1 10 6
2)
3)
when the number of iterations reaches some limit value, typ. 100
B1: 10
B2: 1000
C1: ft
C2: ft3
C3: ft
G1: ft3
G2: gal
Right-justify the labels in A1, A2 and E1. Format the 3 in ft3 as a superscript, ft 3. Use Insert Name
Create to transfer the labels in cells A1:A3 to names on the cells B1:B3. Also, create the name TotVol
for cell F1.
Enter the following formulas in cells F1 and F2 to compute the total volume of the tank in ft 3 and
gallons:
F1: =4/3*PI()*Radius^3
F2: =TotVol*7.48
Enter the following labels in row 5:
A5: Iteration
B5: h1
C5: f(h1)
D5: h2
E5: f(h2)
F5: hm
G5: f(hm)
To implement the bisection method, we will first enter an initialization row followed by an operational
row. In row 6, enter
A6: 1
B6: 0
an initial guess for depth that will always be below the solution
C6: =B6^3-3*Radius*B6^2+3*Volume/PI()This is
h 3 3 Rh 2
3V
with B6 for h .
The formula evaluates the equation based on the cell to the left as the guess for h .
It's convenient to use pointing in creating this formula.
D6: =2*Radius
an initial guess for depth that will always be above the solution
E6: Copy the formula in C6 to here. [Suggestion: select C6, Ctrl-C, select E6, Enter]
F6: =(B6+D6)/2
Initialization Row
Now, we will construct an operational row; that is, a row that can be copied downward to iterate the
numerical method.
A7: =A6+1
In cell B7, we have to enter a formula that will select between B6 and F6 as the lower limit of the
interval. This follows the logic of the bisection method and should be
B7
F6
R
S
TB6 if
The easiest way to check for same or different sign is to multiply C6 and G6. So, enter the following
formula:
B7: =IF(C6*G6>0,F6,B6)
Then,
C7: Copy C6 down.
And, enter a similar formula to determine the new upper limit of the interval:
D7: =IF(E6*G6>0,F6,D6)
Then, copy down cells E6:G6 to cells E7:G7. [Suggestion: select E6:G6, double-click on the fill
handle.]
Your spreadsheet should now look like
Initialization Row
Operational Row
and you can extend the bisection method by copying the operational row down a number of rows to
create enough iterations for a solution that will meet any practical convergence requirement. Here, we
suggest that you copy it down to row 25. To complete the "live" solution, put a pointer formula in B3:
A3: =F25
This will then display the solution with the details of the numerical method below.
Mapped
to B3 with
pointer
formula
Final
Solution
Estimate
Display precision has been adjusted here. You can do the same, if you want. Note that the solution
has converged to 1/10,000th of a foot close enough for most engineering work!
Before we go on, try out your live solution.
Enter 2000 in B2. What is the depth? _______ ft.
Try 31000 in B2. Again, the depth is
_______ ft.
E3:
=D3^3-3*Radius*D3^2+3*Volume/PI()
Click OK again and note that D3 now contains the solution to the equation,
.
Wasn't that easy?! Now change the Volume entry to 2000, and your live solution displays 9.699, but
the Goal Seek "dead" solution hasn't changed. Go ahead and re-run Goal Seek to update the "dead"
solution in cells D3:E3. Notice that you have to enter the Set cell:, To value:, and By changing cell:
fields once again; that is, Goal Seek doesn't remember.
Now, enter 3000 in the Volume field and note that the "live" solution is 12.97 ft. Try the Solver now by
selecting it from the Tools menu. Set up the Solver dialog box as shown below
Click on the Solve button, and, in a few seconds, you should see
Initial guesses in cells B6 and D6 would have to be changed to values suitable for the new
equation.
The new equation would have to be entered in cell C6, then copied down the C column and over
into the E and G columns.
Any supporting cells, such as those at the top of the spreadsheet germane to the spherical tank
problem, would have to be modified.
Volume
gallons
K1: Depth ft
J2:
ft3
Center the Volume label across cells I1:J1. Center the other labels.
Enter 100 in cell I3. With cell I3 selected, use the Edit Fill Series selection and set up the dialog box
as shown below:
Notice that the Columns radio button is selected. Click on OK. A column of Volume (gallons) values
should have been generated down to row 315.
In cell J3, you will enter a formula to convert to ft3:
J3: =I3/7.48
and copy that formula down by double-clicking on the fill handle. The top part of your table should
now look like
Click on the OK button and the table should complete, showing the correct solution for each volume
value. You have solved the equation several hundred times.
M2:
inches
M3:
=MOD(12*K3,12)
Select cells L3:M3 and double-click on the fill handle. Now you have a table in integral feet plus
inches, ready for marking a tape! By adding a label and adjusting representation, the top end of your
table can look like
This example has illustrated several important techniques. The combination of a "live" solution
technique with the Data Table is most useful.
Using Other Numerical Methods
There are several numerical methods that could be used as alternates to the bisection method. We
will mention a couple here:
False Position (Regula Falsi)
For the false position method, instead of using the midpoint formula, such as
F6: =(B6+D6)/2
the following formula would be used
F6: =(B6*E6-D6*C6)/(E6-C6)
xN
b g bg
b g bg
xL f xH xH f x L
f xH f xL
Notice that the solution has effectively converged in 5 iterations; whereas, bisection took over 20. The
false position method is evidently more efficient.
Newton's Method (also called the Newton-Raphson Method)
This method has a different look from the previous two because it requires only one initial guess (it is
not a "bracketing" method) and the derivative formula of the equation. In this case,
af
f af
h 3h
f h h 3 3 Rh 2
2
3V
6 Rh
x N xO
bg
bg
f xO
f xO
If our example spreadsheet is converted over to Newton's Method, it would look like
Notice that Newton's Method has converged by the 4 th iteration, dramatically faster than bisection or
false position. Of course, the disadvantage of Newton's Method is that its stability is quite sensitive to
initial guess.
Implementing "Live" Solution with a VBA Function -- Dealing with Convergence Issues
The "live", "on the sheet" methods illustrated have the limitation that you have to decide how many
rows is sufficient to give a converged solution. In most practical examples, that is an easy issue to
manage; however, it is possible to create a VBA user-defined function that provides a "live" solution
and control over convergence, as described on the bottom of page 4-2. This is illustrated in the Excel
workbook Tank.xls. The top end of the spreadsheet looks like
=tank(Rad,C7)
As shown, the solution for each volume value is found by using the tank user-defined function. This
function is written in VBA and is