Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Evaluate the following
a) IF f(x
l
).f(x
r
) < 0 root lies in lower sub interval
SET x
l
= x
l
& x
r
= x
u
for the next iteration
b) IF f(x
l
).f(x
r
) > 0 roots lies in upper subinterval
SET x
r
= x
l
& x
u
= x
u
for the next iteration
c) If f(x
r
) = 0 you have found the root! So stop!
8
FIXED POINT ITERATION (FPI )
Simple fixed-point also called one-point iteration or successive substitution. Developing formula for
simple fixed-point iteration:
This is done by rearranging the function f(x) = 0 so that x is on the left side of the equation,
x = g(x) is the formula for new estimate root x
i+1
using initial guess x
i
.
Express x = g(x) in iterative formula to predict a new value of x.
x
i+1
=g(x
i
) Formula for simple fixed-point iteration
5.0 RESULTS
GRAPHICAL METHOD
For 40%
For 80%
9
(for 40% of max volume)FPM
Iteration
Approximate
error
True error Solution
1 0 0.49935117 2.584615385
2 0.520585841 0.021345795 2.598140938
3 0.022250806 0.00090481 2.59756296
(for 80% of max volume)FPM
Iteration
Approximate
error
True error Solution
1 0.00000000000 1.00170198459 4.32000000000
2 1.18260869565 0.17879229780 4.26950842214
3 0.18013805165 0.00134818244 4.27721331086
4 0.00135837078 0.00001018819 4.27715521124
(for 40% of max volume)FPI
Iteration
Approximate
error
True error Solution
1 0.00000000000 1.95039716552 2.38513917600
2 5.03137393605 3.31400778566 2.51150224538
3 1.94369081377 1.39747965558 2.56128572064
4 0.80390293603 0.59838717159 2.58204283883
5 0.341421778 0.257845735 2.590888697
6 0.146605155 0.111403904 2.59469265
7 0.063246267 0.048188115 2.596334735
8 0.027339558 0.020854258 2.597044756
(for 80% of max volume)FPI
Iteration
Approximate
error
True error Solution
1 0 4.424273313 4.087922591
2 1.40395560285 3.06332543975 4.14613244997
3 0.94309616084 2.14041545489 4.18560674650
4 0.64541711396 1.50470999676 4.21279685840
5 0.44723176185 1.06222885976 4.23172246534
... ... ... ...
11 0.055315687 0.13655197 4.271315107
12 0.039333457 0.097256767 4.272995824
10
6.0 DISCUSSION
As we can see from all the solution there are 3 answer either for 40% or 80% of water
storage. By observing the schematic diagram the given radius for the spherical water tank is
3m. Thus the diameter is 6m. While the is no negative in length. Hence we can conclude
that :
0
Therefore the answer are (analytically):
h at 40 % = 2.59758643
h at 80 % = 4.277155647
while the numerical answer at accuracy of 0.05% are :
graphical method (imprecise):
h at 40 % = 2.64
h at 80 % = 4.26
False-Position Method
h at 40 % = 2.59756296
h at 80 % = 4.27715521124
Fixed- Point Iteration
h at 40 % = 2.597044756
h at 80 % = 4.272995824
11
7.0 CONCLUSION AND RECOMMENDATION
a. All the problem have been solved analytically and numerically
b. The value of height at specific percentage were obtained
c. The three methods were compared in the mat lab. It can be observed that
i. The value get from graphical method is imprecise.
ii. FPM obtained the answer at accuracy of 0.05% much faster than FPI
d. The problem were solved successfully for each method
e. For RECOMMENDATION . if there are problems similar as this problem and
numerical analysis is required, FPM is recommended as compared to FPI.
12
8.0 APPENDIX
13
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%GRAPHICAL METHOD
h = -4: 0.02 : 10; %setting up the limit of graph and interval
r = 3;
Vmax = 36*pi;
R = 0.8;
F = -pi*h.^3 + 3*pi*r*h.^2 - R*3*Vmax
plot (h,F)
hold on %plotting 2 graph together
y = zeros (size(h)); %setting up the equation as the same size as x
plot (h,y)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%SOLUTION USING FALSE POSITION METHOD
%BRACKETING THE ROOT FROM THE GRAPH PLOTTED BEFORE
hL = 4; %assigning the lower value
hU = 5; %assigning the upper value
%to find roots at other point just change the upper value
%and lower value (bracket the other root)
tolerance = 0.05; %set up the tolerance at 3 d.p
h = -4: 0.02 : 10; %setting up the limit of graph and interval
r = 3;
Vmax = 36*pi;
R = 0.8;
F = @(h) -pi*h.^3 + 3*pi*r*h.^2 - R*3*Vmax; %assigning the function
for i = 1: 100 %start looping
xr = hU - (F(hU)*(hL-hU))/ (F(hL)-F(hU)); %False-Position Formula
root(i) = xr; %saving the values of xr at respective iteration
%SETTING UP THE FALSE-POSITION METHOD CONDITION
limValue = F(hU)*F(xr); %first condition
if limValue < 0
hU = xr;
else if limValue > 0 %second condition
hL = xr;
else %first stopping criteria
disp (xr) %displaying answer
'is one of the roots of equation'
break
end
end
if i == 1 %calculating true error at first iteration
%true error formula
%the true value change as the root change
et(i) = abs ((4.277155647- root(i))/ 4.277155647*100);
end
%calculating true error and app error at respective iteration
if i > 1
et(i) = abs ((4.277155647 - root(i))/ 4.277155647*100);
%approximate error formula
ea(i) = abs((root(i)- root(i-1))/root(i)*100);
if ea(i) < tolerance;%second stopping criteria
disp (xr)%displaying answer
'is one of the roots of equation'
break
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%SOLUTION USING FIXED POINT ITERATION
h0 = 2; %first initial point - assume nearest to the solution
%obtained from the graph
tolerance = 0.05; %set up the tolerance at 3 d.p
%Rearrange the function f(x) = 0 so that x is on the left side
%of the equation.
r = 3;
Vmax = 36*pi;
R = 0.4;
g = @(h) sqrt((1/(-3*pi*r))*(-pi*h.^3 - R*3*Vmax)); % first equation
arrangement
for i = 1:101 % start looping
root (i) = g(h0); %starting iteration
h0 = root(i); %assigning the next value of Xi
if i == 1; %calculating true error at first iteration
%true error formula
%the true value change as the root change
et(i) = abs ((2.33950945 - root(i))/2.33950945 *100);
end
%calculating true error and app error at respective iteration
if (1 < i) && (i < 100)
et(i) = abs ((2.597586463 - root(i))/2.597586463 *100);
%approximate error formula
ea(i) = abs((root(i)- root(i-1))/root(i)*100);
if ea(i) < tolerance; %Stopping criteria
fprintf('Solution is %f \n', (root(i)))%displaying answer
break
end
end
%assigning statement for diverge iteration
if i > 100
fprintf('Solution did not converge to within precision = %d in %d
iterations \n', tolerance, 100)
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%