SlideShare a Scribd company logo
PRACTICAL
Name- Saloni Singhal
M.Sc. (Statistics) II-Sem.
Roll No: 2046398
Course- MATH-409 L
Numerical Analysis Lab
Submitted To: Dr. S.C. Pandey
1
OBJECTIVE
1. Create an M-file to implement
Bisection method.
2
Theory
Root-finding problem: Bisection Method is also called the interval
halving method, the binary search method, or the dichotomy method. is
based on the Bolzano’s theorem for continuous functions.
Intermediate value theorem states that if f is a continuous
function whose domain contains the interval [a, b], then it takes on any
given value between f(a) and f(b) at some point within the interval.
This has two corollaries:
1.If a continuous function has values of opposite sign inside an interval,
then it has a root in that interval (Bolzano's theorem).
2.The image of a continuous function over an interval is itself an interval
3
Algorithm
Graphical Interpretation
1.Two values a and b are chosen for which f(a) > 0 and f(b)
< 0 (or the other way around)
2.Bisection: a midpoint c is calculated as the arithmetic
mean between a and b, c = (a + b) / 2
3.The function f is evaluated for the value of c
4.If f(c) = 0 means that we found the root of the function,
which is c
5.If f(c) ≠ 0 we check the sign of f(c):
1.if f(c) has the same sign as f(a) we replace a with c and
we keep the same value for b
2.if f(c) has the same sign as f(b), we replace b with c and
we keep the same value for a
6.We go back to step 2. and recalculate c with the new value
of a or b
We continue in this manner and the process is repeated until
the root is obtained. How close the value of c gets to the real
root depends on the value of the tolerance we set for the
algorithm
4
Script File
%define the function
f=@(x)2*x.^3+8*x.^2-20; a=1; b=2; error=10^(-4);
i=1
c=(a+b)/2 %bisection using mean value theorem
d=f(c)
while abs(f(c))>error %defining tolerance
if f(c)<0 && f(a)<0
a=c;
else
b=c;
end
i=i+1
c=(a+b)/2;
d=f(c)
%plot the iterated values using bisection method
x = 1:0.0001:2
plot(c,d,'o');
hold on
end
%plot the final iterated value
plot(c,d,"*")
y=0;
%plot the given function
plot(x, f(x))
z=@(x)0*x;
%plot the x-axis
plot(x,z(x))
hold off
5
Output
6
Plot of the value calculated after ith iterations in Bisection
method
7
Plot of the value calculated after 18th iteration (Final step in the given
tolerance) from Bisection method
8
Conclusion
• The final value calculated after iterations is shown in the
second plot
• to calculate an approximate root of a function within tolerance
ε, the number n of iterations we need to perform is at least:
n ≥ log((b−a)/ε)/log(2)
here, n≥ 4/log(2) = 13.28 (in accordance with the number of
iterations n=18)
• Iteration terminates when bound for relative error is less than
tolerance, |p-pn|/min{|an|,|bn|}< 10-4
and sequence pn convergence to p with rate of convergence
O(1/2n)
9
Caveats
• Bisection Method is a simple root finding method,
easy to implement and very robust.
• However, the disadvantages of this method is that
it’s relatively slow.
• Because of this, most of the time, the bisection
method is used as a starting point to obtain a rough
value of the solution which is used later as a
starting point for more rapidly converging methods.
10

More Related Content

Similar to Bisection Method

Bisection method
Bisection methodBisection method
Bisection methoduis
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methods
Tarun Gehlot
 
A New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order DerivativeA New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order Derivative
IRJESJOURNAL
 
Numerical method for solving non linear equations
Numerical method for solving non linear equationsNumerical method for solving non linear equations
Numerical method for solving non linear equations
MdHaque78
 
MVT mean value theorem نظرية القيمة المتوسطة
MVT mean value theorem نظرية القيمة المتوسطةMVT mean value theorem نظرية القيمة المتوسطة
MVT mean value theorem نظرية القيمة المتوسطة
Dr. Karrar Alwash
 
Bisection method in maths 4
Bisection method in maths 4Bisection method in maths 4
Bisection method in maths 4
Vaidik Trivedi
 
Mth3101 Advanced Calculus Chapter 1
Mth3101 Advanced Calculus Chapter 1Mth3101 Advanced Calculus Chapter 1
Mth3101 Advanced Calculus Chapter 1
saya efan
 
NACA Regula Falsi Method
 NACA Regula Falsi Method NACA Regula Falsi Method
NACA Regula Falsi Method
Mujeeb UR Rahman
 
Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)
Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)
Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)
Minhas Kamal
 
Bisection method
Bisection methodBisection method
Bisection method
Tirth Parmar
 
An Improvement to the Brent’s Method
An Improvement to the Brent’s MethodAn Improvement to the Brent’s Method
An Improvement to the Brent’s Method
Waqas Tariq
 
Prac 3 lagrange's thm
Prac  3 lagrange's thmPrac  3 lagrange's thm
Prac 3 lagrange's thm
Himani Asija
 
Prac 3 lagrange's thm
Prac  3 lagrange's thmPrac  3 lagrange's thm
Prac 3 lagrange's thm
Himani Asija
 
Mac2311 study guide-tcm6-49721
Mac2311 study guide-tcm6-49721Mac2311 study guide-tcm6-49721
Mac2311 study guide-tcm6-49721
Glicerio Gavilan
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqp
Prasanth566435
 
Laboratory 7
Laboratory 7Laboratory 7
Laboratory 7
Shafiul Omam
 

Similar to Bisection Method (20)

Bisection method
Bisection methodBisection method
Bisection method
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methods
 
A New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order DerivativeA New Double Numerical Integration Formula Based On The First Order Derivative
A New Double Numerical Integration Formula Based On The First Order Derivative
 
Numerical method for solving non linear equations
Numerical method for solving non linear equationsNumerical method for solving non linear equations
Numerical method for solving non linear equations
 
MVT mean value theorem نظرية القيمة المتوسطة
MVT mean value theorem نظرية القيمة المتوسطةMVT mean value theorem نظرية القيمة المتوسطة
MVT mean value theorem نظرية القيمة المتوسطة
 
Bisection method in maths 4
Bisection method in maths 4Bisection method in maths 4
Bisection method in maths 4
 
Mth3101 Advanced Calculus Chapter 1
Mth3101 Advanced Calculus Chapter 1Mth3101 Advanced Calculus Chapter 1
Mth3101 Advanced Calculus Chapter 1
 
NACA Regula Falsi Method
 NACA Regula Falsi Method NACA Regula Falsi Method
NACA Regula Falsi Method
 
Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)
Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)
Numerical Method Analysis: Algebraic and Transcendental Equations (Non-Linear)
 
Midterm II Review
Midterm II ReviewMidterm II Review
Midterm II Review
 
MEAN VALUE THEOREM
MEAN VALUE THEOREMMEAN VALUE THEOREM
MEAN VALUE THEOREM
 
Bisection method
Bisection methodBisection method
Bisection method
 
An Improvement to the Brent’s Method
An Improvement to the Brent’s MethodAn Improvement to the Brent’s Method
An Improvement to the Brent’s Method
 
Prac 3 lagrange's thm
Prac  3 lagrange's thmPrac  3 lagrange's thm
Prac 3 lagrange's thm
 
Prac 3 lagrange's thm
Prac  3 lagrange's thmPrac  3 lagrange's thm
Prac 3 lagrange's thm
 
Mac2311 study guide-tcm6-49721
Mac2311 study guide-tcm6-49721Mac2311 study guide-tcm6-49721
Mac2311 study guide-tcm6-49721
 
Computer science sqp
Computer science sqpComputer science sqp
Computer science sqp
 
azEssay2
azEssay2azEssay2
azEssay2
 
L 4 4
L 4 4L 4 4
L 4 4
 
Laboratory 7
Laboratory 7Laboratory 7
Laboratory 7
 

More from Saloni Singhal

Finite Difference Method
Finite Difference MethodFinite Difference Method
Finite Difference Method
Saloni Singhal
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
Saloni Singhal
 
Euler Method
Euler MethodEuler Method
Euler Method
Saloni Singhal
 
Simpson's Three-Eighth Method
Simpson's Three-Eighth MethodSimpson's Three-Eighth Method
Simpson's Three-Eighth Method
Saloni Singhal
 
Trapezoidal Rule
Trapezoidal RuleTrapezoidal Rule
Trapezoidal Rule
Saloni Singhal
 
Simpson One-Third
Simpson One-ThirdSimpson One-Third
Simpson One-Third
Saloni Singhal
 
Newton Forward Interpolation
Newton Forward InterpolationNewton Forward Interpolation
Newton Forward Interpolation
Saloni Singhal
 
Newton Backward Interpolation
Newton Backward InterpolationNewton Backward Interpolation
Newton Backward Interpolation
Saloni Singhal
 
Lagrange Interpolation
Lagrange InterpolationLagrange Interpolation
Lagrange Interpolation
Saloni Singhal
 
Forward & Backward Differenece Table
Forward & Backward Differenece TableForward & Backward Differenece Table
Forward & Backward Differenece Table
Saloni Singhal
 
Newton's Raphson method
Newton's Raphson methodNewton's Raphson method
Newton's Raphson method
Saloni Singhal
 
Fixed Point Interation
Fixed Point InterationFixed Point Interation
Fixed Point Interation
Saloni Singhal
 
Power Method
Power MethodPower Method
Power Method
Saloni Singhal
 
Eigen Show
Eigen ShowEigen Show
Eigen Show
Saloni Singhal
 
Inverse Power Method
 Inverse Power Method Inverse Power Method
Inverse Power Method
Saloni Singhal
 
Convergence Analysis
Convergence AnalysisConvergence Analysis
Convergence Analysis
Saloni Singhal
 
MARLAB codes for Gauss Seidel
MARLAB codes for Gauss SeidelMARLAB codes for Gauss Seidel
MARLAB codes for Gauss Seidel
Saloni Singhal
 
MATLAB Codes for Jacobi method
MATLAB Codes for Jacobi methodMATLAB Codes for Jacobi method
MATLAB Codes for Jacobi method
Saloni Singhal
 
L-U Decomposition
L-U DecompositionL-U Decomposition
L-U Decomposition
Saloni Singhal
 
Gauss Elimination (without pivot).pptx
Gauss Elimination (without pivot).pptxGauss Elimination (without pivot).pptx
Gauss Elimination (without pivot).pptx
Saloni Singhal
 

More from Saloni Singhal (20)

Finite Difference Method
Finite Difference MethodFinite Difference Method
Finite Difference Method
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
 
Euler Method
Euler MethodEuler Method
Euler Method
 
Simpson's Three-Eighth Method
Simpson's Three-Eighth MethodSimpson's Three-Eighth Method
Simpson's Three-Eighth Method
 
Trapezoidal Rule
Trapezoidal RuleTrapezoidal Rule
Trapezoidal Rule
 
Simpson One-Third
Simpson One-ThirdSimpson One-Third
Simpson One-Third
 
Newton Forward Interpolation
Newton Forward InterpolationNewton Forward Interpolation
Newton Forward Interpolation
 
Newton Backward Interpolation
Newton Backward InterpolationNewton Backward Interpolation
Newton Backward Interpolation
 
Lagrange Interpolation
Lagrange InterpolationLagrange Interpolation
Lagrange Interpolation
 
Forward & Backward Differenece Table
Forward & Backward Differenece TableForward & Backward Differenece Table
Forward & Backward Differenece Table
 
Newton's Raphson method
Newton's Raphson methodNewton's Raphson method
Newton's Raphson method
 
Fixed Point Interation
Fixed Point InterationFixed Point Interation
Fixed Point Interation
 
Power Method
Power MethodPower Method
Power Method
 
Eigen Show
Eigen ShowEigen Show
Eigen Show
 
Inverse Power Method
 Inverse Power Method Inverse Power Method
Inverse Power Method
 
Convergence Analysis
Convergence AnalysisConvergence Analysis
Convergence Analysis
 
MARLAB codes for Gauss Seidel
MARLAB codes for Gauss SeidelMARLAB codes for Gauss Seidel
MARLAB codes for Gauss Seidel
 
MATLAB Codes for Jacobi method
MATLAB Codes for Jacobi methodMATLAB Codes for Jacobi method
MATLAB Codes for Jacobi method
 
L-U Decomposition
L-U DecompositionL-U Decomposition
L-U Decomposition
 
Gauss Elimination (without pivot).pptx
Gauss Elimination (without pivot).pptxGauss Elimination (without pivot).pptx
Gauss Elimination (without pivot).pptx
 

Recently uploaded

The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
jerlynmaetalle
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
ocavb
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
ewymefz
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
pchutichetpong
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Subhajit Sahu
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
Opendatabay
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
yhkoc
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
enxupq
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
slg6lamcq
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
Tiktokethiodaily
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
benishzehra469
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 

Recently uploaded (20)

The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...The affect of service quality and online reviews on customer loyalty in the E...
The affect of service quality and online reviews on customer loyalty in the E...
 
一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单一比一原版(TWU毕业证)西三一大学毕业证成绩单
一比一原版(TWU毕业证)西三一大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
Data Centers - Striving Within A Narrow Range - Research Report - MCG - May 2...
 
SOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape ReportSOCRadar Germany 2024 Threat Landscape Report
SOCRadar Germany 2024 Threat Landscape Report
 
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
Levelwise PageRank with Loop-Based Dead End Handling Strategy : SHORT REPORT ...
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单一比一原版(QU毕业证)皇后大学毕业证成绩单
一比一原版(QU毕业证)皇后大学毕业证成绩单
 
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
一比一原版(UniSA毕业证书)南澳大学毕业证如何办理
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
 
Empowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptxEmpowering Data Analytics Ecosystem.pptx
Empowering Data Analytics Ecosystem.pptx
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 

Bisection Method

  • 1. PRACTICAL Name- Saloni Singhal M.Sc. (Statistics) II-Sem. Roll No: 2046398 Course- MATH-409 L Numerical Analysis Lab Submitted To: Dr. S.C. Pandey 1
  • 2. OBJECTIVE 1. Create an M-file to implement Bisection method. 2
  • 3. Theory Root-finding problem: Bisection Method is also called the interval halving method, the binary search method, or the dichotomy method. is based on the Bolzano’s theorem for continuous functions. Intermediate value theorem states that if f is a continuous function whose domain contains the interval [a, b], then it takes on any given value between f(a) and f(b) at some point within the interval. This has two corollaries: 1.If a continuous function has values of opposite sign inside an interval, then it has a root in that interval (Bolzano's theorem). 2.The image of a continuous function over an interval is itself an interval 3
  • 4. Algorithm Graphical Interpretation 1.Two values a and b are chosen for which f(a) > 0 and f(b) < 0 (or the other way around) 2.Bisection: a midpoint c is calculated as the arithmetic mean between a and b, c = (a + b) / 2 3.The function f is evaluated for the value of c 4.If f(c) = 0 means that we found the root of the function, which is c 5.If f(c) ≠ 0 we check the sign of f(c): 1.if f(c) has the same sign as f(a) we replace a with c and we keep the same value for b 2.if f(c) has the same sign as f(b), we replace b with c and we keep the same value for a 6.We go back to step 2. and recalculate c with the new value of a or b We continue in this manner and the process is repeated until the root is obtained. How close the value of c gets to the real root depends on the value of the tolerance we set for the algorithm 4
  • 5. Script File %define the function f=@(x)2*x.^3+8*x.^2-20; a=1; b=2; error=10^(-4); i=1 c=(a+b)/2 %bisection using mean value theorem d=f(c) while abs(f(c))>error %defining tolerance if f(c)<0 && f(a)<0 a=c; else b=c; end i=i+1 c=(a+b)/2; d=f(c) %plot the iterated values using bisection method x = 1:0.0001:2 plot(c,d,'o'); hold on end %plot the final iterated value plot(c,d,"*") y=0; %plot the given function plot(x, f(x)) z=@(x)0*x; %plot the x-axis plot(x,z(x)) hold off 5
  • 7. Plot of the value calculated after ith iterations in Bisection method 7
  • 8. Plot of the value calculated after 18th iteration (Final step in the given tolerance) from Bisection method 8
  • 9. Conclusion • The final value calculated after iterations is shown in the second plot • to calculate an approximate root of a function within tolerance ε, the number n of iterations we need to perform is at least: n ≥ log((b−a)/ε)/log(2) here, n≥ 4/log(2) = 13.28 (in accordance with the number of iterations n=18) • Iteration terminates when bound for relative error is less than tolerance, |p-pn|/min{|an|,|bn|}< 10-4 and sequence pn convergence to p with rate of convergence O(1/2n) 9
  • 10. Caveats • Bisection Method is a simple root finding method, easy to implement and very robust. • However, the disadvantages of this method is that it’s relatively slow. • Because of this, most of the time, the bisection method is used as a starting point to obtain a rough value of the solution which is used later as a starting point for more rapidly converging methods. 10