SlideShare a Scribd company logo
3
Most read
5
Most read
7
Most read
NUMERICAL
METHODS
FAST-NUCES, | AK-BROHI ROAD, H-11/4, ISLAMABAD
SEMESTER PROJECT REPORT
ZEESHAN ALI, I14-1623, F
PROBLEM STATEMENT:
A devotee of Newton Raphson used the method to solve an equation x ^ 100
= 0, using the initial estimate xo=0. Calculate next fve Newton method and
Bisection estimates.
PLOT FORf (x)=x
100
:
DERIVATIVE OFf (x)=x
100
:
f
'
(x)=100 x
99
NEWTON REPHSON METHOD FORMULA:
xi+1=xi−
f (xi)
f
'
(xi)
, f
'
(xi )≠0
NEWTON RAPHSON METHOD IMPLIMENTATION:
Given that xo=0 is the initial guess, thereforef
'
(x)=0 , the method works only
iff ' (x)≠0.
Let’s change our assumption as xo=0.6 such thatf ' (x)≠0. The next fve iterations of
the Newton Raphson Method can be implemented as under;
% Let y = f(x) = 0 be our function such that;
y = @(x) x .^ 100;
% Let's plot the graph to analyse the behavior of y(x) for 'x'
figure;
X = -10:0.001:+10;
title('f(x)=x^{100}');
plot(X, X .^ 100);
xo = 0.1; % Initial estimate
% differentiate 'y' w.r.t. x such that;
diff_y = @(x) 100 * x .^ 99.0;
% Now, let's analyse the first five iterations
XN = [0, 0, 0, 0, 0];
YN = [0, 0, 0, 0, 0];
for iteration = 1:5
if diff_y(xo) == 0
disp('Error, Derivative is zero!')
break;
else
% let x be the next value and xo be the previous one;
% according to NRM, next value of x can be given as below
x = xo - y(xo)/diff_y(xo);
% replace the prev value with the next value for next iteration
xo = x;
% store the results to observe in near future
XN(iteration) = xo;
YN(iteration) = y(xo); % approx values of y(x)
% display the new estimate for x and respective f(x)
fprintf('x_%d = %f, y(%f) = %fn', iteration, x, x, y(x));
end
end
OUTPUT:
x_1 = 0.099000, y(0.099000) = 0.000000
x_2 = 0.098010, y(0.098010) = 0.000000
x_3 = 0.097030, y(0.097030) = 0.000000
x_4 = 0.096060, y(0.096060) = 0.000000
x_5 = 0.095099, y(0.095099) = 0.000000
PLOT FORf (x)=x
99
:
DERIVATIVE OFf (x)=x
99
:
f
'
(x)=99 x
98
BISECTION METHOD:
For x ∈[a,b],midpoint=
a+b
2
if f (a)f (midpoint )<0:b=midpoint ,else:a=midpoint
BISECTION METHOD IMPLIMENTATION:
Let x∈[−1,6], therefore a=−1 and b=6 are satisfying f (a)f (b)<0. The frst fve
iterations can be observed using the following set of commands in MATLAB;
% Let y = f(x) = 0 be our function such that;
y = @(x) x .^ 99;
% Let's plot the graph to analyse the behavior of y(x) for 'x'
figure;
X = -10:0.001:+10;
title('f(x)=x^{99}');
plot(X, X .^ 99);
% initially we assume that 'x' lies in range [a, b] where;
a = -1; b = 6; % since y(a)y(b) < 0
% Now, let's analyse the first five iterations
XB = [0, 0, 0, 0, 0];
YB = [0, 0, 0, 0, 0];
for iteration = 1:5
% mid point of interval [a,b]
x = (a+b)/2.0;
% display the new estimate for x and respective f(x)
fprintf('x_%d = %f, y(%f) = %fn', iteration, x, x, y(x));
% store the results to observe in near future
XB(iteration) = x;
YB(iteration) = y(x); % approx values of y(x)
if y(a) * y(x) < 0
b = x;
elseif y(x) * y(b) < 0
a = x;
end
end
OUTPUT:
x_1 = 2.500000, y(2.500000) =
2489206111144456600000000000000000000000.000000
x_2 = 0.750000, y(0.750000) = 0.000000
x_3 = -0.125000, y(-0.125000) = -0.000000
x_4 = 0.312500, y(0.312500) = 0.000000
x_5 = 0.093750, y(0.093750) = 0.000000
ANALYSIS OF THE APPROXIMATIONS:
In the above graph, ‘+’ represent the values of ‘f(x)’ at the approximated
values x in Bisection Method, while the ‘*’ represents the values of y=x
99
at the
respective values of x approximated using the Bisection Method.
The behavior of the Newton Raphson Method can be analyzed more clearly
by zooming the portion of graph in some range of x as under;
In the above graph we can see that for all the approximated values of ‘x’ we
are getting ‘f(x)’ approaching zero.
CONCLUSION:
Newton Raphson method, for the given function converges faster than the
Bisection Method as gives more accurate values for f(x). In other words, Newton
method can be seen more accurate than the Bisection Method, and is more
convergent as well.

More Related Content

PPSX
Differentiation using First Principle - By Mohd Noor Abdul Hamid
PPTX
Algebra booleana y fcc, fcd
PPTX
Inflexion point
PPTX
Integracion y variables
PPT
Statistik 1 5 distribusi probabilitas diskrit
PPTX
Tangent plane
PPTX
ppt of Calculus
PDF
Lesson20 Tangent Planes Slides+Notes
Differentiation using First Principle - By Mohd Noor Abdul Hamid
Algebra booleana y fcc, fcd
Inflexion point
Integracion y variables
Statistik 1 5 distribusi probabilitas diskrit
Tangent plane
ppt of Calculus
Lesson20 Tangent Planes Slides+Notes

What's hot (20)

PPTX
Eulermethod2
DOCX
Euler method in c
DOCX
Faisal
DOCX
Newton cotes method
PDF
IB Maths.Turning points. Second derivative test
PDF
Derivatives Lesson Oct 13
PPT
Lesson3.1 The Derivative And The Tangent Line
PPTX
5.3 curve sketching
PPT
Calc 3.4
DOCX
Maple Code for Steepest Descent
PPTX
0.5.derivatives
PDF
Guia de estudio para aa5
PPT
Quadratic functions
PDF
5.3 Basic functions. Dynamic slides.
PPTX
Application of partial derivatives
DOCX
Nhap du lieu
PDF
10CSL67 CG LAB PROGRAM 9
DOCX
Assignmnt 4
DOC
Sinusoidal graphs example
Eulermethod2
Euler method in c
Faisal
Newton cotes method
IB Maths.Turning points. Second derivative test
Derivatives Lesson Oct 13
Lesson3.1 The Derivative And The Tangent Line
5.3 curve sketching
Calc 3.4
Maple Code for Steepest Descent
0.5.derivatives
Guia de estudio para aa5
Quadratic functions
5.3 Basic functions. Dynamic slides.
Application of partial derivatives
Nhap du lieu
10CSL67 CG LAB PROGRAM 9
Assignmnt 4
Sinusoidal graphs example
Ad

Similar to Numerical methods course project report (20)

PPTX
Root Finding Methods in Numerical Analysis
PPT
Numerical method
PDF
Solution of non-linear equations
PDF
Non linearequationsmatlab
PDF
Non linearequationsmatlab
DOCX
Trabajo Scilab
DOCX
Matlab lab manual
PDF
Newton Raphson iterative Method
PPTX
Numerical analysisgroup19
PPT
Newton raphson method
PPTX
Newton Raphson Of Root Equation
PDF
Mit18 330 s12_chapter4
PDF
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
PPTX
GROUP-4 PRESENTATION ON NR-METHOD.pptx
PPTX
Finding root of equation (numarical method)
DOCX
scientific computing
PDF
Numerical Study of Some Iterative Methods for Solving Nonlinear Equations
DOCX
MolinaLeydi_FinalProject
PPT
Chapter 3
Root Finding Methods in Numerical Analysis
Numerical method
Solution of non-linear equations
Non linearequationsmatlab
Non linearequationsmatlab
Trabajo Scilab
Matlab lab manual
Newton Raphson iterative Method
Numerical analysisgroup19
Newton raphson method
Newton Raphson Of Root Equation
Mit18 330 s12_chapter4
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
GROUP-4 PRESENTATION ON NR-METHOD.pptx
Finding root of equation (numarical method)
scientific computing
Numerical Study of Some Iterative Methods for Solving Nonlinear Equations
MolinaLeydi_FinalProject
Chapter 3
Ad

Recently uploaded (20)

PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PDF
Business Analytics and business intelligence.pdf
PDF
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
PPT
ISS -ESG Data flows What is ESG and HowHow
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
Mega Projects Data Mega Projects Data
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
Supervised vs unsupervised machine learning algorithms
PDF
Clinical guidelines as a resource for EBP(1).pdf
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PPTX
Introduction to Knowledge Engineering Part 1
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
Database Infoormation System (DBIS).pptx
PPTX
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
Business Analytics and business intelligence.pdf
“Getting Started with Data Analytics Using R – Concepts, Tools & Case Studies”
ISS -ESG Data flows What is ESG and HowHow
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Mega Projects Data Mega Projects Data
Reliability_Chapter_ presentation 1221.5784
Supervised vs unsupervised machine learning algorithms
Clinical guidelines as a resource for EBP(1).pdf
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
.pdf is not working space design for the following data for the following dat...
Qualitative Qantitative and Mixed Methods.pptx
Introduction to Knowledge Engineering Part 1
Business Acumen Training GuidePresentation.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
Database Infoormation System (DBIS).pptx
iec ppt-1 pptx icmr ppt on rehabilitation.pptx
IBA_Chapter_11_Slides_Final_Accessible.pptx

Numerical methods course project report

  • 1. NUMERICAL METHODS FAST-NUCES, | AK-BROHI ROAD, H-11/4, ISLAMABAD SEMESTER PROJECT REPORT ZEESHAN ALI, I14-1623, F
  • 2. PROBLEM STATEMENT: A devotee of Newton Raphson used the method to solve an equation x ^ 100 = 0, using the initial estimate xo=0. Calculate next fve Newton method and Bisection estimates. PLOT FORf (x)=x 100 : DERIVATIVE OFf (x)=x 100 : f ' (x)=100 x 99 NEWTON REPHSON METHOD FORMULA:
  • 3. xi+1=xi− f (xi) f ' (xi) , f ' (xi )≠0 NEWTON RAPHSON METHOD IMPLIMENTATION: Given that xo=0 is the initial guess, thereforef ' (x)=0 , the method works only iff ' (x)≠0. Let’s change our assumption as xo=0.6 such thatf ' (x)≠0. The next fve iterations of the Newton Raphson Method can be implemented as under; % Let y = f(x) = 0 be our function such that; y = @(x) x .^ 100; % Let's plot the graph to analyse the behavior of y(x) for 'x' figure; X = -10:0.001:+10; title('f(x)=x^{100}'); plot(X, X .^ 100); xo = 0.1; % Initial estimate % differentiate 'y' w.r.t. x such that; diff_y = @(x) 100 * x .^ 99.0; % Now, let's analyse the first five iterations XN = [0, 0, 0, 0, 0]; YN = [0, 0, 0, 0, 0]; for iteration = 1:5 if diff_y(xo) == 0 disp('Error, Derivative is zero!') break; else % let x be the next value and xo be the previous one; % according to NRM, next value of x can be given as below x = xo - y(xo)/diff_y(xo); % replace the prev value with the next value for next iteration xo = x; % store the results to observe in near future XN(iteration) = xo; YN(iteration) = y(xo); % approx values of y(x) % display the new estimate for x and respective f(x) fprintf('x_%d = %f, y(%f) = %fn', iteration, x, x, y(x)); end end OUTPUT: x_1 = 0.099000, y(0.099000) = 0.000000 x_2 = 0.098010, y(0.098010) = 0.000000 x_3 = 0.097030, y(0.097030) = 0.000000
  • 4. x_4 = 0.096060, y(0.096060) = 0.000000 x_5 = 0.095099, y(0.095099) = 0.000000 PLOT FORf (x)=x 99 : DERIVATIVE OFf (x)=x 99 : f ' (x)=99 x 98 BISECTION METHOD: For x ∈[a,b],midpoint= a+b 2 if f (a)f (midpoint )<0:b=midpoint ,else:a=midpoint
  • 5. BISECTION METHOD IMPLIMENTATION: Let x∈[−1,6], therefore a=−1 and b=6 are satisfying f (a)f (b)<0. The frst fve iterations can be observed using the following set of commands in MATLAB; % Let y = f(x) = 0 be our function such that; y = @(x) x .^ 99; % Let's plot the graph to analyse the behavior of y(x) for 'x' figure; X = -10:0.001:+10; title('f(x)=x^{99}'); plot(X, X .^ 99); % initially we assume that 'x' lies in range [a, b] where; a = -1; b = 6; % since y(a)y(b) < 0 % Now, let's analyse the first five iterations XB = [0, 0, 0, 0, 0]; YB = [0, 0, 0, 0, 0]; for iteration = 1:5 % mid point of interval [a,b] x = (a+b)/2.0; % display the new estimate for x and respective f(x) fprintf('x_%d = %f, y(%f) = %fn', iteration, x, x, y(x)); % store the results to observe in near future XB(iteration) = x; YB(iteration) = y(x); % approx values of y(x) if y(a) * y(x) < 0 b = x; elseif y(x) * y(b) < 0 a = x; end end OUTPUT: x_1 = 2.500000, y(2.500000) = 2489206111144456600000000000000000000000.000000 x_2 = 0.750000, y(0.750000) = 0.000000 x_3 = -0.125000, y(-0.125000) = -0.000000 x_4 = 0.312500, y(0.312500) = 0.000000 x_5 = 0.093750, y(0.093750) = 0.000000
  • 6. ANALYSIS OF THE APPROXIMATIONS: In the above graph, ‘+’ represent the values of ‘f(x)’ at the approximated values x in Bisection Method, while the ‘*’ represents the values of y=x 99 at the respective values of x approximated using the Bisection Method.
  • 7. The behavior of the Newton Raphson Method can be analyzed more clearly by zooming the portion of graph in some range of x as under; In the above graph we can see that for all the approximated values of ‘x’ we are getting ‘f(x)’ approaching zero. CONCLUSION: Newton Raphson method, for the given function converges faster than the Bisection Method as gives more accurate values for f(x). In other words, Newton method can be seen more accurate than the Bisection Method, and is more convergent as well.