SlideShare a Scribd company logo
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

What's hot

Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2
stellajoh
 
Euler method in c
Euler method in cEuler method in c
Euler method in c
Subir Halder
 
Faisal
FaisalFaisal
Faisal
Faisal Saeed
 
Newton cotes method
Newton cotes methodNewton cotes method
Newton cotes method
Faisal Saeed
 
IB Maths.Turning points. Second derivative test
IB Maths.Turning points. Second derivative testIB Maths.Turning points. Second derivative test
IB Maths.Turning points. Second derivative test
estelav
 
Derivatives Lesson Oct 13
Derivatives Lesson  Oct 13Derivatives Lesson  Oct 13
Derivatives Lesson Oct 13
ingroy
 
Lesson3.1 The Derivative And The Tangent Line
Lesson3.1 The Derivative And The Tangent LineLesson3.1 The Derivative And The Tangent Line
Lesson3.1 The Derivative And The Tangent Line
seltzermath
 
5.3 curve sketching
5.3 curve sketching5.3 curve sketching
5.3 curve sketchingdicosmo178
 
Calc 3.4
Calc 3.4Calc 3.4
Calc 3.4
hartcher
 
Maple Code for Steepest Descent
Maple Code for Steepest DescentMaple Code for Steepest Descent
Maple Code for Steepest Descent
Jeremy Lane
 
0.5.derivatives
0.5.derivatives0.5.derivatives
0.5.derivatives
m2699
 
Guia de estudio para aa5
Guia de estudio  para aa5 Guia de estudio  para aa5
Guia de estudio para aa5
Doris Diaz Flores
 
Brains
BrainsBrains
Quadratic functions
Quadratic functionsQuadratic functions
Quadratic functions
AlexisGood1
 
5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.
Jan Plaza
 
Application of partial derivatives
Application of partial derivativesApplication of partial derivatives
Application of partial derivatives
Maharshi Dave
 
Nhap du lieu
Nhap du lieuNhap du lieu
Nhap du lieu
bichdinh
 
10CSL67 CG LAB PROGRAM 9
10CSL67 CG LAB PROGRAM 910CSL67 CG LAB PROGRAM 9
10CSL67 CG LAB PROGRAM 9
Vanishree Arun
 
Assignmnt 4
Assignmnt 4Assignmnt 4
Assignmnt 4
Sajid Khokhar
 
Sinusoidal graphs example
Sinusoidal graphs  exampleSinusoidal graphs  example
Sinusoidal graphs example
monster2010
 

What's hot (20)

Eulermethod2
Eulermethod2Eulermethod2
Eulermethod2
 
Euler method in c
Euler method in cEuler method in c
Euler method in c
 
Faisal
FaisalFaisal
Faisal
 
Newton cotes method
Newton cotes methodNewton cotes method
Newton cotes method
 
IB Maths.Turning points. Second derivative test
IB Maths.Turning points. Second derivative testIB Maths.Turning points. Second derivative test
IB Maths.Turning points. Second derivative test
 
Derivatives Lesson Oct 13
Derivatives Lesson  Oct 13Derivatives Lesson  Oct 13
Derivatives Lesson Oct 13
 
Lesson3.1 The Derivative And The Tangent Line
Lesson3.1 The Derivative And The Tangent LineLesson3.1 The Derivative And The Tangent Line
Lesson3.1 The Derivative And The Tangent Line
 
5.3 curve sketching
5.3 curve sketching5.3 curve sketching
5.3 curve sketching
 
Calc 3.4
Calc 3.4Calc 3.4
Calc 3.4
 
Maple Code for Steepest Descent
Maple Code for Steepest DescentMaple Code for Steepest Descent
Maple Code for Steepest Descent
 
0.5.derivatives
0.5.derivatives0.5.derivatives
0.5.derivatives
 
Guia de estudio para aa5
Guia de estudio  para aa5 Guia de estudio  para aa5
Guia de estudio para aa5
 
Brains
BrainsBrains
Brains
 
Quadratic functions
Quadratic functionsQuadratic functions
Quadratic functions
 
5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.5.3 Basic functions. Dynamic slides.
5.3 Basic functions. Dynamic slides.
 
Application of partial derivatives
Application of partial derivativesApplication of partial derivatives
Application of partial derivatives
 
Nhap du lieu
Nhap du lieuNhap du lieu
Nhap du lieu
 
10CSL67 CG LAB PROGRAM 9
10CSL67 CG LAB PROGRAM 910CSL67 CG LAB PROGRAM 9
10CSL67 CG LAB PROGRAM 9
 
Assignmnt 4
Assignmnt 4Assignmnt 4
Assignmnt 4
 
Sinusoidal graphs example
Sinusoidal graphs  exampleSinusoidal graphs  example
Sinusoidal graphs example
 

Similar to Numerical methods course project report

Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
sheetslibrary
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
ZunAib Ali
 
Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equations
ZunAib Ali
 
Application of derivative
Application of derivativeApplication of derivative
SECTION 7.3 word.docx
SECTION 7.3 word.docxSECTION 7.3 word.docx
SECTION 7.3 word.docx
LMinhTm26
 
Lecture6
Lecture6Lecture6
Lecture6
ladybuzz_89
 
Interpolation techniques - Background and implementation
Interpolation techniques - Background and implementationInterpolation techniques - Background and implementation
Interpolation techniques - Background and implementation
Quasar Chunawala
 
AJMS_389_22.pdf
AJMS_389_22.pdfAJMS_389_22.pdf
AJMS_389_22.pdf
BRNSS Publication Hub
 
Calculas
CalculasCalculas
Calculas
Utkarsh Patel
 
Continuity and Uniform Continuity
Continuity and Uniform ContinuityContinuity and Uniform Continuity
Continuity and Uniform Continuity
DEVTYPE
 
AJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdfAJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdf
BRNSS Publication Hub
 
Applications of Differential Calculus in real life
Applications of Differential Calculus in real life Applications of Differential Calculus in real life
Applications of Differential Calculus in real life
OlooPundit
 
Mathematics with awesome example.pdf
Mathematics with awesome example.pdfMathematics with awesome example.pdf
Mathematics with awesome example.pdf
elistemidayo
 
Roots equations
Roots equationsRoots equations
Roots equations
oscar
 
Roots equations
Roots equationsRoots equations
Roots equations
oscar
 
Famous problem IMO 1988 Q6.pdf
Famous problem IMO 1988 Q6.pdfFamous problem IMO 1988 Q6.pdf
Famous problem IMO 1988 Q6.pdf
AbdulHannif2
 
104newton solution
104newton solution104newton solution
104newton solution
VictorQuezada38
 
Ch 2
Ch 2Ch 2
Logit model testing and interpretation
Logit model testing and interpretationLogit model testing and interpretation
Logit model testing and interpretation
Felipe Affonso
 
Newton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsmNewton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsm
Nemish Bhojani
 

Similar to Numerical methods course project report (20)

Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
 
Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equations
 
Application of derivative
Application of derivativeApplication of derivative
Application of derivative
 
SECTION 7.3 word.docx
SECTION 7.3 word.docxSECTION 7.3 word.docx
SECTION 7.3 word.docx
 
Lecture6
Lecture6Lecture6
Lecture6
 
Interpolation techniques - Background and implementation
Interpolation techniques - Background and implementationInterpolation techniques - Background and implementation
Interpolation techniques - Background and implementation
 
AJMS_389_22.pdf
AJMS_389_22.pdfAJMS_389_22.pdf
AJMS_389_22.pdf
 
Calculas
CalculasCalculas
Calculas
 
Continuity and Uniform Continuity
Continuity and Uniform ContinuityContinuity and Uniform Continuity
Continuity and Uniform Continuity
 
AJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdfAJMS_402_22_Reprocess_new.pdf
AJMS_402_22_Reprocess_new.pdf
 
Applications of Differential Calculus in real life
Applications of Differential Calculus in real life Applications of Differential Calculus in real life
Applications of Differential Calculus in real life
 
Mathematics with awesome example.pdf
Mathematics with awesome example.pdfMathematics with awesome example.pdf
Mathematics with awesome example.pdf
 
Roots equations
Roots equationsRoots equations
Roots equations
 
Roots equations
Roots equationsRoots equations
Roots equations
 
Famous problem IMO 1988 Q6.pdf
Famous problem IMO 1988 Q6.pdfFamous problem IMO 1988 Q6.pdf
Famous problem IMO 1988 Q6.pdf
 
104newton solution
104newton solution104newton solution
104newton solution
 
Ch 2
Ch 2Ch 2
Ch 2
 
Logit model testing and interpretation
Logit model testing and interpretationLogit model testing and interpretation
Logit model testing and interpretation
 
Newton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsmNewton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsm
 

Recently uploaded

University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
ihavuls
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
jitskeb
 
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
slg6lamcq
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
bmucuha
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
writing report business partner b1+ .pdf
writing report business partner b1+ .pdfwriting report business partner b1+ .pdf
writing report business partner b1+ .pdf
VyNguyen709676
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
Social Samosa
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
AndrzejJarynowski
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
nyfuhyz
 
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
yuvarajkumar334
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
SaffaIbrahim1
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理
一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理
一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理
y3i0qsdzb
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
apvysm8
 
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
bmucuha
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
ElizabethGarrettChri
 

Recently uploaded (20)

University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
Experts live - Improving user adoption with AI
Experts live - Improving user adoption with AIExperts live - Improving user adoption with AI
Experts live - Improving user adoption with AI
 
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
writing report business partner b1+ .pdf
writing report business partner b1+ .pdfwriting report business partner b1+ .pdf
writing report business partner b1+ .pdf
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
4th Modern Marketing Reckoner by MMA Global India & Group M: 60+ experts on W...
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
Intelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicineIntelligence supported media monitoring in veterinary medicine
Intelligence supported media monitoring in veterinary medicine
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
 
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCAModule 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
Module 1 ppt BIG DATA ANALYTICS_NOTES FOR MCA
 
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docxDATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
DATA COMMS-NETWORKS YR2 lecture 08 NAT & CLOUD.docx
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理
一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理
一比一原版巴斯大学毕业证(Bath毕业证书)学历如何办理
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
 
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
一比一原版(CU毕业证)卡尔顿大学毕业证如何办理
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
 

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.