Skip to content

MANE 3351

Lecture 12

Classroom Management

Agenda

  • Test 1 not graded; some people still need to take
  • Homework 3 Assignment
  • Lab 6 Assignme
  • Secant Method; last root finding method

Calendar

Date Lecture Lab
10/7 Secant Method, Homework 3 Lab 6
10/9 Trapezoid Rule Lab 6, continued
10/14 Simpson's Rule, Homework 4 Lab 7
10/16 Romberg Integration Lab 7, continued
10/21 No Class, Dr. Timmer on ABET Visit No Class, Dr. Timmer on ABET Visit
10/23 Gaussian Quadrature, Homework 5 Lab 8
10/28 Numerical Differentiation (not on Test 2) Lab 8, continued
11/4 Numerical Integration (not on Test 2) Lab 9
11/6 Linear Algebra, part 1 (not on Test 2) Lab 9, continued
11/11 Test 2 (Root Finding and Numerical Integration) No Lab

Resources

Handouts


Lecture 12 Content

  • Today's topic is the secant method.
  • The secant method does not utilize derivative information as Newton's method does.
  • The secant method is also similar to the false position method.
  • The secant method is the last root finding method covered

Limit Definition of the Derivative

Recall the limit definition of the derivative1

Definition of Derivative


Geometric Inspiration

Cheney and Kincaid (2004)3 demonstrate the geometric inspiration for secant method

Secant method


Secant Method

  • The formula is simply
\[ x_{n+1}=x_n - g(x_n)\frac{x_n-x_{n-1}}{g(x_n)-g(x_{n-1})} \]

Example Problem Used for Newton's Method

  • Consider a new function, \(f(x)=e^x+2^{-x}+2\cos(x)-6=0\)

Example Function for Newton's method


Pseudo-code

Brin (2020)2provides the following pseudo-code

Secant Method pseud-ocode


Convergence

  • Brin (2020)2 study the performance of Secant Method
  • The secant method converges with order \(\frac{1+\sqrt{5}}{2}=1.62\)
  • Not quite as fast as Newton's Method (quadratic)

Similarity to False Position

  • Secant method: \(x_{n+1}=x_n - g(x_n)\frac{x_n-x_{n-1}}{g(x_n)-g(x_{n-1})}\)
  • False Position method: \(x_r=x_u-\frac{f(x_u)(x_l-x_u)}{f(x_l)-f(x_u)}\)
  • Secant method is not guaranteed to bracket result when starting

Speed of Convergence

Chapra and Canale (2015)4 compared the performance of various root finding methods

Comparison


Secant Code

import math
def f(x):
    return (math.exp(x)+2**(-x)+2*math.cos(x)-6)

N=100
tol=0.0005
x0=6.0
x1=5.0
# step 1
y0=f(x0)
y1=f(x1)
# counter is additional
counter=0
for j in range(N+1):
    counter=counter+1
    # step 3
    x=x1-y1*((x1-x0)/(y1-y0))
    if math.fabs(x-x1)<tol:
        print("the root is {} with value {}, required {} steps".format(x,f(x),counter))
        break
    # step 5
    x0=x1
    y0=y1
    x1=x
    y1=f(x1)
print("completed")


  1. https://math.hmc.edu/calculus/hmc-mathematics-calculus-online-tutorials/single-variable-calculus/limit-definition-of-the-derivative/ 

  2. Brin, L, (2020), Tea Time Numerical Analysis: Experiences in Mathematics, 3rd edition 

  3. Cheny, W., and Kincaid, D., (2004), Numerical Mathematics and Computer, 5th edition 

  4. Chapra, S., and Canale, R., (2015), Numerical Methods for Engineers, 7th edition