SlideShare a Scribd company logo
n this module, I include a file called Bisection Technique. I use
an example similar to the textbook described in section 2.1. I
start to solve the example by hand and complete it using
MATLAB. After reading the Bisection technique lesson 4 and
section 2.1 of the textbook, answer the following discussion
question in your own words.
When running the Bisection method in lesson 4 (program 1.1),
with a tolerance of 0.001 the answer is 1.3652 which is
equivalent to p9 according to the table 2.1 from the textbook.
When running p13 in lesson 4 (program 1.2), the answer is
1.3651 which is equivalent to p13. Which one of the answers
do you think is the most accurate answer closest to the solution
and why? Which of the two calculation methods do you prefer
and why? Elaborate in your answers.
file attached
Lesson 4
Bisection Technique
To find a solution or root of an equation f(x) we can apply the
bisection method, which is an
approximation technique to get closer and closer to the value of
the root by dividing the
interval in half after each iteration. The bisection method or
binary search technique is based
on the Intermediate Value Theorem. Suppose f is a continuous
function on the interval [a,b]
with f(a) and f(b) of opposite sign, the Intermediate Value
Theorem implies that a number p
exists in [a,b] with f(p) = 0. The method calls for a repeated
halving or bisecting of subintervals
of [a,b] and at each step locating the half containing p.
Example:
Does
f(x) = x
3
+4x
2
-10
has a root or solution in
[a,b] = [1,2]?
1) Let’s check if f(1) and f(2) have opposite signs according to
the Intermediate Value
Theorem.
f(a) = f(1)
= (1)
3
+ 4(1)
2
– 10 = -5
(negative)
f(b) = f(2)
= (2)
3
+ 4(2)
2
– 10 = 8+16-10 = 14
(positive)
The answer is yes, which means since f is continuous there must
be a solution in the
interval [1,2].
2) Let p be the solution we are searching for and let p1 be the
first midpoint of [a,b] = [1,2].
p1
= (a+b)/2 = (1+2)/2 = 3/2 = 1.5
f(p1)
=
f(1.5)
= (1.5)
3
+4(1.5)
2
-10 = 2.375
(positive)
3) If
f(p1)
= 0
then p1 is the root or the solution, so p= p1. Done.
Otherwise, if
f(p1)
is not equal to zero, which is the case, we’re going to replace
either a or b by
p1 to obtain a new interval closer to the root or the solution.
How do we know which one to replace? Simple. The goal is to
keep two intervals of which
their functions have opposite signs when we calculate the
function
f
at these two intervals. The
question to ask is rather which of the two
f(a)
and
f(b)
has opposite sign to the function
f(p1)
?
a) If
f(p1)
and
f(a)
have the same sign, then they don’t satisfy the Intermediate
Value
Theorem. We replace
a
by
p1
, so the new interval that contains the solution p will be
[p1, b].
b) If
f(p1)
and
f(a)
have opposite signs, then they satisfy the Intermediate Value
Theorem.
We replace
b
by
p1
so the new interval that contains the solution p will be [a, p1].
In our case,
f(a) which is f(1)
has opposite sign to
f(p1) which is f(1.5)
. We replace (
b
which is 2 by
p1
which is 1.5). The new interval that contains a solution is [a,
p1] = [1,
1.5].
Next we go back to step 2 and step 3 by repeating this process
again to find the new
midpoint p2, check if p2 is the solution, if not obtain a new
interval.
Let’s continue with steps 2 and 3.
Step 2:
a. let p2 be the second midpoint of [a, p1] = [1, 1.5].
p2
= (a+p1)/2 = (1+1.5)/2 = 2.5/2 = 1.25
f(p2)
= f(1.25) = (1.25)
3
+4(1.25)
2
-10 = -1.796875
(negative)
Step 3:
Which of the two
f(a)
and
f(p1)
has opposite sign to the function
f(p2)
OR
Which of the two
f(1)
and
f(1.5)
has opposite sign to the function
f(1.25)
?
f(a)
=
f(1)
= -5;
f(p1) = f(1.5) = 2.375;
f(p2) = f(1.25) = -1.796875
The answer is
f(p1) = f(1.5)
and
f(p2) = f(1.25), so we replace a by p2.
Therefore, the new interval that contains a solution i s: [p2, p1]
= [1.25, 1.5].
We repeat steps 2 and 3 again and again until
f(midpoint) = 0
or within a Tolerance, let’s
say 0.001 = 10
-4
.
To do this we can use the MATLAB tool. The following
program 1.1 can be used to find
the root of the same function using bisection method with a
tolerance of 0.001 = 10
-4
%Program 1.1 Bisection Method
%Computes approximate solution of f(x)=0
%Input: inline function f; a,b such that f(a)*f(b)<0,
% and tolerance tol
%Output: Approximate solution xc
function xc = bisect(f,a,b,tol)
if sign(f(a))*sign(f(b)) >= 0,
error('f(a)f(b)<0 not satisfied!')
%ceases execution
end
fa=f(a);
fb=f(b);
k = 0;
while (b-a)/2>tol
c=(a+b)/2;
fc=f(c);
if fc == 0
%c is a solution, done
break
end
if sign(fc)*sign(fa)<0 %
a and c make the new interval
b=c;fb=fc;
else %
c and b make the new interval
a=c;fa=fc;
end
end
xc=(a+b)/2;
%new midpoint is best estimate
1. Copy and paste this program in MATLAB in the editor
window.
2. Save the program as bisect.
3. To run the program, type the following in the command
window:
>> bisect(@(x) x^3+4*x^2-10,1,2,0.0001)
@(x) x^3+4*x^2-10
represents the function
1,2
represents the interval
0.01
represents the Tolerance.
The output is:
ans =
1.3652
The following MATLAB program 1.2 can be used to find the
root of the same function
using bisection method with 13 iterations meaning that we will
find the midpoint 13 times pn =
p13.
%Program 1.2 Bisection Method
function [x e] = mybisect(f,a,b,n)
% function [x e] = mybisect(f,a,b,n)
% Does n iterations of the bisection method for a function f
% Inputs: f -- an inline function
% a,b -- left and right edges of the interval
% n -- the number of bisections to do.
% Outputs: x -- the estimated solution of f(x) = 0
% e -- an upper bound on the error
format long
c = f(a); d = f(b);
if c*d > 0.0
error('Function has same sign at both endpoints.')
end
disp(' x y')
for i = 1:n
x = (a + b)/2;
y = f(x);
disp([ x y])
if y == 0.0
% solved the equation exactly
e = 0;
break
% jumps out of the for loop
end
if c*y < 0
b=x;
else
a=x;
end
end
e = (b-a)/2;
1. Copy and paste this program in MATLAB in the editor
window.
2. Save the program as bisection.
3. To run the program, type the following in the command
window:
>> bisection(@(x) x^3+4*x^2-10,1,2,13)
@(x) x^3+4*x^2-10
represents the function
1,2
represents the interval
13
represents the number of iterations.
The output is:
x
y
1.500000000000000 2.375000000000000
1.250000000000000 -1.796875000000000
1.375000000000000 0.162109375000000
1.312500000000000 -0.848388671875000
1.343750000000000 -0.350982666015625
1.359375000000000 -0.096408843994141
1.367187500000000 0.032355785369873
1.363281250000000 -0.032149970531464
1.365234375000000 0.000072024762630
1.364257812500000 -0.016046690754592
1.364746093750000 -0.007989262812771
1.364990234375000 -0.003959101522923
1.365112304687500 -0.001943659010067
ans =
1.365112304687500

More Related Content

Similar to n this module, I include a file called Bisection Technique. I us

Master method
Master method Master method
Master method
Rajendran
 
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
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
Computer Network Assignment Help
 
Evaluating functions
Evaluating functionsEvaluating functions
Evaluating functions
EFREN ARCHIDE
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
Mumtaz Ali
 
Math 116 pres. 1
Math 116 pres. 1Math 116 pres. 1
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
B.Kirron Reddi
 
lecture4-recursion.pptx
lecture4-recursion.pptxlecture4-recursion.pptx
lecture4-recursion.pptx
Lizhen Shi
 
Calculus - Functions Review
Calculus - Functions ReviewCalculus - Functions Review
Calculus - Functions Review
hassaanciit
 
Laplace
LaplaceLaplace
Evaluating Functions
Evaluating FunctionsEvaluating Functions
Evaluating Functions
NICO MONTERO
 
Sure interview algorithm-1103
Sure interview algorithm-1103Sure interview algorithm-1103
Sure interview algorithm-1103
Sure Interview
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
jayavignesh86
 
Divide and conquer strategy
Divide and conquer strategyDivide and conquer strategy
Divide and conquer strategy
Nisha Soms
 
INVERSE TO ONE TO ONE FUNCTIONS.pptx
INVERSE TO ONE TO ONE FUNCTIONS.pptxINVERSE TO ONE TO ONE FUNCTIONS.pptx
INVERSE TO ONE TO ONE FUNCTIONS.pptx
Zệnn Jímệnệz
 
An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...
An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...
An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...
Annibale Panichella
 
Bisection method
Bisection methodBisection method
Bisection method
Putera Shafiq
 
Factoring difference of two squares
Factoring difference of two squaresFactoring difference of two squares
Factoring difference of two squares
laila_barrera
 
algo_vc_lecture8.ppt
algo_vc_lecture8.pptalgo_vc_lecture8.ppt
algo_vc_lecture8.ppt
Nehagupta259541
 
calculus-4c-1.pdf
calculus-4c-1.pdfcalculus-4c-1.pdf
calculus-4c-1.pdf
HUSSAINGHAZI1
 

Similar to n this module, I include a file called Bisection Technique. I us (20)

Master method
Master method Master method
Master method
 
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
 
Computer Network Assignment Help
Computer Network Assignment HelpComputer Network Assignment Help
Computer Network Assignment Help
 
Evaluating functions
Evaluating functionsEvaluating functions
Evaluating functions
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
 
Math 116 pres. 1
Math 116 pres. 1Math 116 pres. 1
Math 116 pres. 1
 
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
 
lecture4-recursion.pptx
lecture4-recursion.pptxlecture4-recursion.pptx
lecture4-recursion.pptx
 
Calculus - Functions Review
Calculus - Functions ReviewCalculus - Functions Review
Calculus - Functions Review
 
Laplace
LaplaceLaplace
Laplace
 
Evaluating Functions
Evaluating FunctionsEvaluating Functions
Evaluating Functions
 
Sure interview algorithm-1103
Sure interview algorithm-1103Sure interview algorithm-1103
Sure interview algorithm-1103
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
 
Divide and conquer strategy
Divide and conquer strategyDivide and conquer strategy
Divide and conquer strategy
 
INVERSE TO ONE TO ONE FUNCTIONS.pptx
INVERSE TO ONE TO ONE FUNCTIONS.pptxINVERSE TO ONE TO ONE FUNCTIONS.pptx
INVERSE TO ONE TO ONE FUNCTIONS.pptx
 
An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...
An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...
An Adaptive Evolutionary Algorithm based on Non-Euclidean Geometry for Many-O...
 
Bisection method
Bisection methodBisection method
Bisection method
 
Factoring difference of two squares
Factoring difference of two squaresFactoring difference of two squares
Factoring difference of two squares
 
algo_vc_lecture8.ppt
algo_vc_lecture8.pptalgo_vc_lecture8.ppt
algo_vc_lecture8.ppt
 
calculus-4c-1.pdf
calculus-4c-1.pdfcalculus-4c-1.pdf
calculus-4c-1.pdf
 

More from EstelaJeffery653

Individual ProjectMedical TechnologyWed, 9617Num.docx
Individual ProjectMedical TechnologyWed, 9617Num.docxIndividual ProjectMedical TechnologyWed, 9617Num.docx
Individual ProjectMedical TechnologyWed, 9617Num.docx
EstelaJeffery653
 
Individual ProjectThe Post-Watergate EraWed, 3817Numeric.docx
Individual ProjectThe Post-Watergate EraWed, 3817Numeric.docxIndividual ProjectThe Post-Watergate EraWed, 3817Numeric.docx
Individual ProjectThe Post-Watergate EraWed, 3817Numeric.docx
EstelaJeffery653
 
Individual ProjectArticulating the Integrated PlanWed, 31.docx
Individual ProjectArticulating the Integrated PlanWed, 31.docxIndividual ProjectArticulating the Integrated PlanWed, 31.docx
Individual ProjectArticulating the Integrated PlanWed, 31.docx
EstelaJeffery653
 
Individual Multilingualism Guidelines1)Where did the a.docx
Individual Multilingualism Guidelines1)Where did the a.docxIndividual Multilingualism Guidelines1)Where did the a.docx
Individual Multilingualism Guidelines1)Where did the a.docx
EstelaJeffery653
 
Individual Implementation Strategiesno new messagesObjectives.docx
Individual Implementation Strategiesno new messagesObjectives.docxIndividual Implementation Strategiesno new messagesObjectives.docx
Individual Implementation Strategiesno new messagesObjectives.docx
EstelaJeffery653
 
Individual Refine and Finalize WebsiteDueJul 02View m.docx
Individual Refine and Finalize WebsiteDueJul 02View m.docxIndividual Refine and Finalize WebsiteDueJul 02View m.docx
Individual Refine and Finalize WebsiteDueJul 02View m.docx
EstelaJeffery653
 
Individual Cultural Communication Written Assignment  (Worth 20 of .docx
Individual Cultural Communication Written Assignment  (Worth 20 of .docxIndividual Cultural Communication Written Assignment  (Worth 20 of .docx
Individual Cultural Communication Written Assignment  (Worth 20 of .docx
EstelaJeffery653
 
Individual ProjectThe Basic Marketing PlanWed, 3117N.docx
Individual ProjectThe Basic Marketing PlanWed, 3117N.docxIndividual ProjectThe Basic Marketing PlanWed, 3117N.docx
Individual ProjectThe Basic Marketing PlanWed, 3117N.docx
EstelaJeffery653
 
Individual ProjectFinancial Procedures in a Health Care Organiza.docx
Individual ProjectFinancial Procedures in a Health Care Organiza.docxIndividual ProjectFinancial Procedures in a Health Care Organiza.docx
Individual ProjectFinancial Procedures in a Health Care Organiza.docx
EstelaJeffery653
 
Individual Expanded Website PlanView more »Expand view.docx
Individual Expanded Website PlanView more  »Expand view.docxIndividual Expanded Website PlanView more  »Expand view.docx
Individual Expanded Website PlanView more »Expand view.docx
EstelaJeffery653
 
Individual Expanded Website PlanDueJul 02View more .docx
Individual Expanded Website PlanDueJul 02View more .docxIndividual Expanded Website PlanDueJul 02View more .docx
Individual Expanded Website PlanDueJul 02View more .docx
EstelaJeffery653
 
Individual Communicating to Management Concerning Information Syste.docx
Individual Communicating to Management Concerning Information Syste.docxIndividual Communicating to Management Concerning Information Syste.docx
Individual Communicating to Management Concerning Information Syste.docx
EstelaJeffery653
 
Individual Case Analysis-MatavIn max 4 single-spaced total pag.docx
Individual Case Analysis-MatavIn max 4 single-spaced total pag.docxIndividual Case Analysis-MatavIn max 4 single-spaced total pag.docx
Individual Case Analysis-MatavIn max 4 single-spaced total pag.docx
EstelaJeffery653
 
Individual Assignment Report Format• Report should contain not m.docx
Individual Assignment Report Format• Report should contain not m.docxIndividual Assignment Report Format• Report should contain not m.docx
Individual Assignment Report Format• Report should contain not m.docx
EstelaJeffery653
 
Include LOCO api that allows user to key in an address and get the d.docx
Include LOCO api that allows user to key in an address and get the d.docxInclude LOCO api that allows user to key in an address and get the d.docx
Include LOCO api that allows user to key in an address and get the d.docx
EstelaJeffery653
 
Include the title, the name of the composer (if known) and of the .docx
Include the title, the name of the composer (if known) and of the .docxInclude the title, the name of the composer (if known) and of the .docx
Include the title, the name of the composer (if known) and of the .docx
EstelaJeffery653
 
include as many events as possible to support your explanation of th.docx
include as many events as possible to support your explanation of th.docxinclude as many events as possible to support your explanation of th.docx
include as many events as possible to support your explanation of th.docx
EstelaJeffery653
 
Incorporate the suggestions that were provided by your fellow projec.docx
Incorporate the suggestions that were provided by your fellow projec.docxIncorporate the suggestions that were provided by your fellow projec.docx
Incorporate the suggestions that were provided by your fellow projec.docx
EstelaJeffery653
 
inal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docx
inal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docxinal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docx
inal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docx
EstelaJeffery653
 
include 1page proposal- short introduction to research paper and yo.docx
include 1page proposal- short introduction to research paper and yo.docxinclude 1page proposal- short introduction to research paper and yo.docx
include 1page proposal- short introduction to research paper and yo.docx
EstelaJeffery653
 

More from EstelaJeffery653 (20)

Individual ProjectMedical TechnologyWed, 9617Num.docx
Individual ProjectMedical TechnologyWed, 9617Num.docxIndividual ProjectMedical TechnologyWed, 9617Num.docx
Individual ProjectMedical TechnologyWed, 9617Num.docx
 
Individual ProjectThe Post-Watergate EraWed, 3817Numeric.docx
Individual ProjectThe Post-Watergate EraWed, 3817Numeric.docxIndividual ProjectThe Post-Watergate EraWed, 3817Numeric.docx
Individual ProjectThe Post-Watergate EraWed, 3817Numeric.docx
 
Individual ProjectArticulating the Integrated PlanWed, 31.docx
Individual ProjectArticulating the Integrated PlanWed, 31.docxIndividual ProjectArticulating the Integrated PlanWed, 31.docx
Individual ProjectArticulating the Integrated PlanWed, 31.docx
 
Individual Multilingualism Guidelines1)Where did the a.docx
Individual Multilingualism Guidelines1)Where did the a.docxIndividual Multilingualism Guidelines1)Where did the a.docx
Individual Multilingualism Guidelines1)Where did the a.docx
 
Individual Implementation Strategiesno new messagesObjectives.docx
Individual Implementation Strategiesno new messagesObjectives.docxIndividual Implementation Strategiesno new messagesObjectives.docx
Individual Implementation Strategiesno new messagesObjectives.docx
 
Individual Refine and Finalize WebsiteDueJul 02View m.docx
Individual Refine and Finalize WebsiteDueJul 02View m.docxIndividual Refine and Finalize WebsiteDueJul 02View m.docx
Individual Refine and Finalize WebsiteDueJul 02View m.docx
 
Individual Cultural Communication Written Assignment  (Worth 20 of .docx
Individual Cultural Communication Written Assignment  (Worth 20 of .docxIndividual Cultural Communication Written Assignment  (Worth 20 of .docx
Individual Cultural Communication Written Assignment  (Worth 20 of .docx
 
Individual ProjectThe Basic Marketing PlanWed, 3117N.docx
Individual ProjectThe Basic Marketing PlanWed, 3117N.docxIndividual ProjectThe Basic Marketing PlanWed, 3117N.docx
Individual ProjectThe Basic Marketing PlanWed, 3117N.docx
 
Individual ProjectFinancial Procedures in a Health Care Organiza.docx
Individual ProjectFinancial Procedures in a Health Care Organiza.docxIndividual ProjectFinancial Procedures in a Health Care Organiza.docx
Individual ProjectFinancial Procedures in a Health Care Organiza.docx
 
Individual Expanded Website PlanView more »Expand view.docx
Individual Expanded Website PlanView more  »Expand view.docxIndividual Expanded Website PlanView more  »Expand view.docx
Individual Expanded Website PlanView more »Expand view.docx
 
Individual Expanded Website PlanDueJul 02View more .docx
Individual Expanded Website PlanDueJul 02View more .docxIndividual Expanded Website PlanDueJul 02View more .docx
Individual Expanded Website PlanDueJul 02View more .docx
 
Individual Communicating to Management Concerning Information Syste.docx
Individual Communicating to Management Concerning Information Syste.docxIndividual Communicating to Management Concerning Information Syste.docx
Individual Communicating to Management Concerning Information Syste.docx
 
Individual Case Analysis-MatavIn max 4 single-spaced total pag.docx
Individual Case Analysis-MatavIn max 4 single-spaced total pag.docxIndividual Case Analysis-MatavIn max 4 single-spaced total pag.docx
Individual Case Analysis-MatavIn max 4 single-spaced total pag.docx
 
Individual Assignment Report Format• Report should contain not m.docx
Individual Assignment Report Format• Report should contain not m.docxIndividual Assignment Report Format• Report should contain not m.docx
Individual Assignment Report Format• Report should contain not m.docx
 
Include LOCO api that allows user to key in an address and get the d.docx
Include LOCO api that allows user to key in an address and get the d.docxInclude LOCO api that allows user to key in an address and get the d.docx
Include LOCO api that allows user to key in an address and get the d.docx
 
Include the title, the name of the composer (if known) and of the .docx
Include the title, the name of the composer (if known) and of the .docxInclude the title, the name of the composer (if known) and of the .docx
Include the title, the name of the composer (if known) and of the .docx
 
include as many events as possible to support your explanation of th.docx
include as many events as possible to support your explanation of th.docxinclude as many events as possible to support your explanation of th.docx
include as many events as possible to support your explanation of th.docx
 
Incorporate the suggestions that were provided by your fellow projec.docx
Incorporate the suggestions that were provided by your fellow projec.docxIncorporate the suggestions that were provided by your fellow projec.docx
Incorporate the suggestions that were provided by your fellow projec.docx
 
inal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docx
inal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docxinal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docx
inal ProjectDUE Jun 25, 2017 1155 PMGrade DetailsGradeNA.docx
 
include 1page proposal- short introduction to research paper and yo.docx
include 1page proposal- short introduction to research paper and yo.docxinclude 1page proposal- short introduction to research paper and yo.docx
include 1page proposal- short introduction to research paper and yo.docx
 

Recently uploaded

LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 

n this module, I include a file called Bisection Technique. I us

  • 1. n this module, I include a file called Bisection Technique. I use an example similar to the textbook described in section 2.1. I start to solve the example by hand and complete it using MATLAB. After reading the Bisection technique lesson 4 and section 2.1 of the textbook, answer the following discussion question in your own words. When running the Bisection method in lesson 4 (program 1.1), with a tolerance of 0.001 the answer is 1.3652 which is equivalent to p9 according to the table 2.1 from the textbook. When running p13 in lesson 4 (program 1.2), the answer is 1.3651 which is equivalent to p13. Which one of the answers do you think is the most accurate answer closest to the solution and why? Which of the two calculation methods do you prefer and why? Elaborate in your answers. file attached Lesson 4 Bisection Technique To find a solution or root of an equation f(x) we can apply the bisection method, which is an approximation technique to get closer and closer to the value of the root by dividing the interval in half after each iteration. The bisection method or binary search technique is based
  • 2. on the Intermediate Value Theorem. Suppose f is a continuous function on the interval [a,b] with f(a) and f(b) of opposite sign, the Intermediate Value Theorem implies that a number p exists in [a,b] with f(p) = 0. The method calls for a repeated halving or bisecting of subintervals of [a,b] and at each step locating the half containing p. Example: Does f(x) = x 3 +4x 2 -10 has a root or solution in [a,b] = [1,2]? 1) Let’s check if f(1) and f(2) have opposite signs according to the Intermediate Value Theorem. f(a) = f(1)
  • 3. = (1) 3 + 4(1) 2 – 10 = -5 (negative) f(b) = f(2) = (2) 3 + 4(2) 2 – 10 = 8+16-10 = 14 (positive) The answer is yes, which means since f is continuous there must be a solution in the interval [1,2]. 2) Let p be the solution we are searching for and let p1 be the first midpoint of [a,b] = [1,2]. p1
  • 4. = (a+b)/2 = (1+2)/2 = 3/2 = 1.5 f(p1) = f(1.5) = (1.5) 3 +4(1.5) 2 -10 = 2.375 (positive) 3) If f(p1) = 0 then p1 is the root or the solution, so p= p1. Done. Otherwise, if f(p1) is not equal to zero, which is the case, we’re going to replace either a or b by
  • 5. p1 to obtain a new interval closer to the root or the solution. How do we know which one to replace? Simple. The goal is to keep two intervals of which their functions have opposite signs when we calculate the function f at these two intervals. The question to ask is rather which of the two f(a) and f(b) has opposite sign to the function f(p1) ? a) If f(p1) and f(a) have the same sign, then they don’t satisfy the Intermediate Value
  • 6. Theorem. We replace a by p1 , so the new interval that contains the solution p will be [p1, b]. b) If f(p1) and f(a) have opposite signs, then they satisfy the Intermediate Value Theorem. We replace b by p1 so the new interval that contains the solution p will be [a, p1].
  • 7. In our case, f(a) which is f(1) has opposite sign to f(p1) which is f(1.5) . We replace ( b which is 2 by p1 which is 1.5). The new interval that contains a solution is [a, p1] = [1, 1.5]. Next we go back to step 2 and step 3 by repeating this process again to find the new midpoint p2, check if p2 is the solution, if not obtain a new interval. Let’s continue with steps 2 and 3. Step 2: a. let p2 be the second midpoint of [a, p1] = [1, 1.5].
  • 8. p2 = (a+p1)/2 = (1+1.5)/2 = 2.5/2 = 1.25 f(p2) = f(1.25) = (1.25) 3 +4(1.25) 2 -10 = -1.796875 (negative) Step 3: Which of the two f(a) and f(p1) has opposite sign to the function f(p2) OR Which of the two
  • 9. f(1) and f(1.5) has opposite sign to the function f(1.25) ? f(a) = f(1) = -5; f(p1) = f(1.5) = 2.375; f(p2) = f(1.25) = -1.796875 The answer is f(p1) = f(1.5) and f(p2) = f(1.25), so we replace a by p2. Therefore, the new interval that contains a solution i s: [p2, p1] = [1.25, 1.5].
  • 10. We repeat steps 2 and 3 again and again until f(midpoint) = 0 or within a Tolerance, let’s say 0.001 = 10 -4 . To do this we can use the MATLAB tool. The following program 1.1 can be used to find the root of the same function using bisection method with a tolerance of 0.001 = 10 -4 %Program 1.1 Bisection Method %Computes approximate solution of f(x)=0 %Input: inline function f; a,b such that f(a)*f(b)<0, % and tolerance tol %Output: Approximate solution xc function xc = bisect(f,a,b,tol) if sign(f(a))*sign(f(b)) >= 0,
  • 11. error('f(a)f(b)<0 not satisfied!') %ceases execution end fa=f(a); fb=f(b); k = 0; while (b-a)/2>tol c=(a+b)/2; fc=f(c); if fc == 0 %c is a solution, done break end if sign(fc)*sign(fa)<0 % a and c make the new interval b=c;fb=fc;
  • 12. else % c and b make the new interval a=c;fa=fc; end end xc=(a+b)/2; %new midpoint is best estimate 1. Copy and paste this program in MATLAB in the editor window. 2. Save the program as bisect. 3. To run the program, type the following in the command window: >> bisect(@(x) x^3+4*x^2-10,1,2,0.0001) @(x) x^3+4*x^2-10 represents the function 1,2 represents the interval 0.01 represents the Tolerance.
  • 13. The output is: ans = 1.3652 The following MATLAB program 1.2 can be used to find the root of the same function using bisection method with 13 iterations meaning that we will find the midpoint 13 times pn = p13. %Program 1.2 Bisection Method function [x e] = mybisect(f,a,b,n) % function [x e] = mybisect(f,a,b,n) % Does n iterations of the bisection method for a function f % Inputs: f -- an inline function % a,b -- left and right edges of the interval % n -- the number of bisections to do. % Outputs: x -- the estimated solution of f(x) = 0
  • 14. % e -- an upper bound on the error format long c = f(a); d = f(b); if c*d > 0.0 error('Function has same sign at both endpoints.') end disp(' x y') for i = 1:n x = (a + b)/2; y = f(x); disp([ x y]) if y == 0.0 % solved the equation exactly e = 0; break % jumps out of the for loop end if c*y < 0
  • 15. b=x; else a=x; end end e = (b-a)/2; 1. Copy and paste this program in MATLAB in the editor window. 2. Save the program as bisection. 3. To run the program, type the following in the command window: >> bisection(@(x) x^3+4*x^2-10,1,2,13) @(x) x^3+4*x^2-10 represents the function 1,2 represents the interval
  • 16. 13 represents the number of iterations. The output is: x y 1.500000000000000 2.375000000000000 1.250000000000000 -1.796875000000000 1.375000000000000 0.162109375000000 1.312500000000000 -0.848388671875000 1.343750000000000 -0.350982666015625 1.359375000000000 -0.096408843994141 1.367187500000000 0.032355785369873 1.363281250000000 -0.032149970531464 1.365234375000000 0.000072024762630 1.364257812500000 -0.016046690754592