SlideShare une entreprise Scribd logo
1  sur  3
Télécharger pour lire hors ligne
Lecture 6
Secant Methods
In this lecture we introduce two additional methods to find numerical solutions of the equation f(x) = 0.
Both of these methods are based on approximating the function by secant lines just as Newton’s method
was based on approximating the function by tangent lines.
The Secant Method
The secant method requires two initial approximations x0 and x1, preferrably both reasonably close to the
solution x∗
. From x0 and x1 we can determine that the points (x0, y0 = f(x0)) and (x1, y1 = f(x0)) both
lie on the graph of f. Connecting these points gives the (secant) line
y − y1 =
y1 − y0
x1 − x0
(x − x1) .
Since we want f(x) = 0, we set y = 0, solve for x, and use that as our next approximation. Repeating this
process gives us the iteration
xi+1 = xi −
xi − xi−1
yi − yi−1
yi (6.1)
with yi = f(xi). See Figure 6.1 for an illustration.
✉
xi
✉
xi−1xi+1
Figure 6.1: The secant method in the case where the the root is bracketed.
For example, suppose f(x) = x4
− 5, which has a solution x∗
= 4
√
5 ≈ 1.5. Choose x0 = 1 and x1 = 2 as
initial approximations. Next we have that y0 = f(1) = −4 and y1 = f(2) = 11. We may then calculate x2
17
18 LECTURE 6. SECANT METHODS
from the formula (6.1):
x2 = 2 −
2 − 1
11 − (−4)
11 =
19
15
≈ 1.2666....
Pluggin x2 = 19/15 into f(x) we obtain y2 = f(19/15) ≈ −2.425758.... In the next step we would use x1 = 2
and x2 = 19/15 in the formula (6.1) to find x3 and so on.
Below is a program for the secant method. Notice that it requires two input guesses x0 and x1, but it
does not require the derivative to be input.
function x = mysecant(f,x0 ,x1 ,n)
% Solves f(x) = 0 by doing n steps of the secant method
% starting with x0 and x1.
% Inputs: f -- the function , input as an inline function
% x0 -- starting guess , a number
% x1 -- second starting geuss
% n -- the number of steps to do
% Output: x -- the approximate solution
y0 = f(x0);
y1 = f(x1);
for i = 1:n % Do n times
x = x1 - (x1 -x0)*y1/(y1 -y0) % secant formula.
y=f(x) % y value at the new approximate solution.
% Move numbers to get ready for the next step
x0=x1;
y0=y1;
x1=x;
y1=y;
end
The Regula Falsi (False Position) Method
The Regula Falsi method is a combination of the secant method and bisection method. As in the bisection
method, we have to start with two approximations a and b for which f(a) and f(b) have different signs. As
in the secant method, we follow the secant line to get a new approximation, which gives a formula similar
to (6.1),
x = b −
b − a
f(b) − f(a)
f(b) .
Then, as in the bisection method, we check the sign of f(x); if it is the same as the sign of f(a) then x
becomes the new a and otherwise let x becomes the new b. Note that in general either a → x∗
or b → x∗
but not both, so b − a → 0. For example, for the function in Figure 6.1, a → x∗
but b would never move.
Convergence
If we can begin with a good choice x0, then Newton’s method will converge to x∗
rapidly. The secant method
is a little slower than Newton’s method and the Regula Falsi method is slightly slower than that. However,
both are still much faster than the bisection method.
If we do not have a good starting point or interval, then the secant method, just like Newton’s method,
can fail altogether. The Regula Falsi method, just like the bisection method, always works because it keeps
the solution inside a definite interval.
19
Simulations and Experiments
Although Newton’s method converges faster than any other method, there are contexts when it is not
convenient, or even impossible. One obvious situation is when it is difficult to calculate a formula for f′
(x)
even though one knows the formula for f(x). This is often the case when f(x) is not defined explicitly,
but implicitly. There are other situations, which are very common in engineering and science, where even
a formula for f(x) is not known. This happens when f(x) is the result of experiment or simulation rather
than a formula. In such situations, the secant method is usually the best choice.
Exercises
6.1 Perform 3 iterations of the Regula Falsi method on the function f(x) = x3
− 4, with starting interval
[1, 3]. (On paper, but use a calculator.) Calculate the errors and percentage errors of x0, x1, x2, and
x3. Compare the errors with those in exercises 3.3 and 5.2.
6.2 Write a function program myregfalsi that runs the Regula Falsi method until the absolute value of
the residual is below a given tolerance. Run your program on the function f(x) = 2x3
+ 3x − 1 with
starting interval [0, 1] and a tolerance of 10−8
. How many steps does the program use to achieve this
tolerance? Compare with exercise 5.1. Turn in your program and a brief summary of the results.

Contenu connexe

Tendances (20)

Unit4
Unit4Unit4
Unit4
 
Regulafalsi_bydinesh
Regulafalsi_bydineshRegulafalsi_bydinesh
Regulafalsi_bydinesh
 
Presentation on application of numerical method in our life
Presentation on application of numerical method in our lifePresentation on application of numerical method in our life
Presentation on application of numerical method in our life
 
Es272 ch3a
Es272 ch3aEs272 ch3a
Es272 ch3a
 
Bisection and fixed point method
Bisection and fixed point methodBisection and fixed point method
Bisection and fixed point method
 
Root Equations Methods
Root Equations MethodsRoot Equations Methods
Root Equations Methods
 
Regula Falsi (False position) Method
Regula Falsi (False position) MethodRegula Falsi (False position) Method
Regula Falsi (False position) Method
 
Bisection method
Bisection methodBisection method
Bisection method
 
Numerical Analysis (Solution of Non-Linear Equations) part 2
Numerical Analysis (Solution of Non-Linear Equations) part 2Numerical Analysis (Solution of Non-Linear Equations) part 2
Numerical Analysis (Solution of Non-Linear Equations) part 2
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Es272 ch4b
Es272 ch4bEs272 ch4b
Es272 ch4b
 
Matlab lecture 7 – regula falsi or false position method@taj
Matlab lecture 7 – regula falsi or false position method@tajMatlab lecture 7 – regula falsi or false position method@taj
Matlab lecture 7 – regula falsi or false position method@taj
 
Es272 ch3b
Es272 ch3bEs272 ch3b
Es272 ch3b
 
Es272 ch4a
Es272 ch4aEs272 ch4a
Es272 ch4a
 
Es272 ch2
Es272 ch2Es272 ch2
Es272 ch2
 
Sol78
Sol78Sol78
Sol78
 
ROOT OF NON-LINEAR EQUATIONS
ROOT OF NON-LINEAR EQUATIONSROOT OF NON-LINEAR EQUATIONS
ROOT OF NON-LINEAR EQUATIONS
 
Numerical solutions of algebraic equations
Numerical solutions of algebraic equationsNumerical solutions of algebraic equations
Numerical solutions of algebraic equations
 
MATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and IntegrationMATLAB : Numerical Differention and Integration
MATLAB : Numerical Differention and Integration
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 

En vedette

Regula falsi method
Regula falsi methodRegula falsi method
Regula falsi methodandrushow
 
Bisection & Regual falsi methods
Bisection & Regual falsi methodsBisection & Regual falsi methods
Bisection & Regual falsi methodsDivya Bhatia
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methodsTarun Gehlot
 

En vedette (6)

Presentation aust final
Presentation aust finalPresentation aust final
Presentation aust final
 
Numerical Method
Numerical MethodNumerical Method
Numerical Method
 
Regula falsi method
Regula falsi methodRegula falsi method
Regula falsi method
 
Bisection & Regual falsi methods
Bisection & Regual falsi methodsBisection & Regual falsi methods
Bisection & Regual falsi methods
 
Numerical method
Numerical methodNumerical method
Numerical method
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methods
 

Similaire à Lecture6

Roots of equations
Roots of equationsRoots of equations
Roots of equationsMileacre
 
Equations root
Equations rootEquations root
Equations rootMileacre
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlabsheetslibrary
 
Solution of non-linear equations
Solution of non-linear equationsSolution of non-linear equations
Solution of non-linear equationsZunAib Ali
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlabZunAib Ali
 
Numerical differentation with c
Numerical differentation with cNumerical differentation with c
Numerical differentation with cYagya Dev Bhardwaj
 
Newton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsmNewton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsmNemish Bhojani
 
Lecture 04 newton-raphson, secant method etc
Lecture 04 newton-raphson, secant method etcLecture 04 newton-raphson, secant method etc
Lecture 04 newton-raphson, secant method etcRiyandika Jastin
 
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...Stephen Faucher
 
CHAP6 Limits and Continuity.pdf
CHAP6 Limits and Continuity.pdfCHAP6 Limits and Continuity.pdf
CHAP6 Limits and Continuity.pdfmekkimekki5
 
Maths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayMaths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayDr. Asish K Mukhopadhyay
 
Introduction to Functions
Introduction to FunctionsIntroduction to Functions
Introduction to FunctionsMelanie Loslo
 
Mit18 330 s12_chapter4
Mit18 330 s12_chapter4Mit18 330 s12_chapter4
Mit18 330 s12_chapter4CAALAAA
 
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
 
Differential Equations Homework Help
Differential Equations Homework HelpDifferential Equations Homework Help
Differential Equations Homework HelpMath Homework Solver
 

Similaire à Lecture6 (20)

Roots of equations
Roots of equationsRoots of equations
Roots of equations
 
Equations root
Equations rootEquations root
Equations root
 
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
 
Non linearequationsmatlab
Non linearequationsmatlabNon linearequationsmatlab
Non linearequationsmatlab
 
Numerical differentation with c
Numerical differentation with cNumerical differentation with c
Numerical differentation with c
 
Term paper
Term paperTerm paper
Term paper
 
Newton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsmNewton-Raphson Iteration marths 4 ntsm
Newton-Raphson Iteration marths 4 ntsm
 
S3-3.pdf
S3-3.pdfS3-3.pdf
S3-3.pdf
 
Lecture 04 newton-raphson, secant method etc
Lecture 04 newton-raphson, secant method etcLecture 04 newton-raphson, secant method etc
Lecture 04 newton-raphson, secant method etc
 
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
A Comparison Of Iterative Methods For The Solution Of Non-Linear Systems Of E...
 
CHAP6 Limits and Continuity.pdf
CHAP6 Limits and Continuity.pdfCHAP6 Limits and Continuity.pdf
CHAP6 Limits and Continuity.pdf
 
104newton solution
104newton solution104newton solution
104newton solution
 
Maths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K MukhopadhyayMaths iii quick review by Dr Asish K Mukhopadhyay
Maths iii quick review by Dr Asish K Mukhopadhyay
 
Introduction to Functions
Introduction to FunctionsIntroduction to Functions
Introduction to Functions
 
Mit18 330 s12_chapter4
Mit18 330 s12_chapter4Mit18 330 s12_chapter4
Mit18 330 s12_chapter4
 
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)
 
CALCULUS 2.pptx
CALCULUS 2.pptxCALCULUS 2.pptx
CALCULUS 2.pptx
 
Problems 2
Problems 2Problems 2
Problems 2
 
Differential Equations Homework Help
Differential Equations Homework HelpDifferential Equations Homework Help
Differential Equations Homework Help
 

Dernier

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 

Dernier (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 

Lecture6

  • 1. Lecture 6 Secant Methods In this lecture we introduce two additional methods to find numerical solutions of the equation f(x) = 0. Both of these methods are based on approximating the function by secant lines just as Newton’s method was based on approximating the function by tangent lines. The Secant Method The secant method requires two initial approximations x0 and x1, preferrably both reasonably close to the solution x∗ . From x0 and x1 we can determine that the points (x0, y0 = f(x0)) and (x1, y1 = f(x0)) both lie on the graph of f. Connecting these points gives the (secant) line y − y1 = y1 − y0 x1 − x0 (x − x1) . Since we want f(x) = 0, we set y = 0, solve for x, and use that as our next approximation. Repeating this process gives us the iteration xi+1 = xi − xi − xi−1 yi − yi−1 yi (6.1) with yi = f(xi). See Figure 6.1 for an illustration. ✉ xi ✉ xi−1xi+1 Figure 6.1: The secant method in the case where the the root is bracketed. For example, suppose f(x) = x4 − 5, which has a solution x∗ = 4 √ 5 ≈ 1.5. Choose x0 = 1 and x1 = 2 as initial approximations. Next we have that y0 = f(1) = −4 and y1 = f(2) = 11. We may then calculate x2 17
  • 2. 18 LECTURE 6. SECANT METHODS from the formula (6.1): x2 = 2 − 2 − 1 11 − (−4) 11 = 19 15 ≈ 1.2666.... Pluggin x2 = 19/15 into f(x) we obtain y2 = f(19/15) ≈ −2.425758.... In the next step we would use x1 = 2 and x2 = 19/15 in the formula (6.1) to find x3 and so on. Below is a program for the secant method. Notice that it requires two input guesses x0 and x1, but it does not require the derivative to be input. function x = mysecant(f,x0 ,x1 ,n) % Solves f(x) = 0 by doing n steps of the secant method % starting with x0 and x1. % Inputs: f -- the function , input as an inline function % x0 -- starting guess , a number % x1 -- second starting geuss % n -- the number of steps to do % Output: x -- the approximate solution y0 = f(x0); y1 = f(x1); for i = 1:n % Do n times x = x1 - (x1 -x0)*y1/(y1 -y0) % secant formula. y=f(x) % y value at the new approximate solution. % Move numbers to get ready for the next step x0=x1; y0=y1; x1=x; y1=y; end The Regula Falsi (False Position) Method The Regula Falsi method is a combination of the secant method and bisection method. As in the bisection method, we have to start with two approximations a and b for which f(a) and f(b) have different signs. As in the secant method, we follow the secant line to get a new approximation, which gives a formula similar to (6.1), x = b − b − a f(b) − f(a) f(b) . Then, as in the bisection method, we check the sign of f(x); if it is the same as the sign of f(a) then x becomes the new a and otherwise let x becomes the new b. Note that in general either a → x∗ or b → x∗ but not both, so b − a → 0. For example, for the function in Figure 6.1, a → x∗ but b would never move. Convergence If we can begin with a good choice x0, then Newton’s method will converge to x∗ rapidly. The secant method is a little slower than Newton’s method and the Regula Falsi method is slightly slower than that. However, both are still much faster than the bisection method. If we do not have a good starting point or interval, then the secant method, just like Newton’s method, can fail altogether. The Regula Falsi method, just like the bisection method, always works because it keeps the solution inside a definite interval.
  • 3. 19 Simulations and Experiments Although Newton’s method converges faster than any other method, there are contexts when it is not convenient, or even impossible. One obvious situation is when it is difficult to calculate a formula for f′ (x) even though one knows the formula for f(x). This is often the case when f(x) is not defined explicitly, but implicitly. There are other situations, which are very common in engineering and science, where even a formula for f(x) is not known. This happens when f(x) is the result of experiment or simulation rather than a formula. In such situations, the secant method is usually the best choice. Exercises 6.1 Perform 3 iterations of the Regula Falsi method on the function f(x) = x3 − 4, with starting interval [1, 3]. (On paper, but use a calculator.) Calculate the errors and percentage errors of x0, x1, x2, and x3. Compare the errors with those in exercises 3.3 and 5.2. 6.2 Write a function program myregfalsi that runs the Regula Falsi method until the absolute value of the residual is below a given tolerance. Run your program on the function f(x) = 2x3 + 3x − 1 with starting interval [0, 1] and a tolerance of 10−8 . How many steps does the program use to achieve this tolerance? Compare with exercise 5.1. Turn in your program and a brief summary of the results.