11/30/2015 1 secant method industrial engineering majors authors: autar kaw, jai paul

18
03/17/22 http:// numericalmethods.eng.usf.edu 1 Secant Method Industrial Engineering Majors Authors: Autar Kaw, Jai Paul http://numericalmethods.eng.u sf.edu Transforming Numerical Methods Education for STEM Undergraduates

Upload: iris-parsons

Post on 13-Dec-2015

224 views

Category:

Documents


0 download

TRANSCRIPT

04/18/23http://

numericalmethods.eng.usf.edu 1

Secant Method

Industrial Engineering Majors

Authors: Autar Kaw, Jai Paul

http://numericalmethods.eng.usf.eduTransforming Numerical Methods Education for STEM

Undergraduates

Secant Method

http://numericalmethods.eng.usf.edu

http://numericalmethods.eng.usf.edu3

Secant Method – Derivation

)(xf

)f(x - = xx

i

iii 1

f ( x )

f ( x i )

f ( x i - 1 )

x i + 2 x i + 1 x i X

ii xfx ,

1

1 )()()(

ii

iii xx

xfxfxf

)()(

))((

1

11

ii

iiiii xfxf

xxxfxx

Newton’s Method

Approximate the derivative

Substituting Equation (2) into Equation (1) gives the Secant method

(1)

(2)

Figure 1 Geometrical illustration of the Newton-Raphson method.

http://numericalmethods.eng.usf.edu4

Secant Method – Derivation

)()(

))((

1

11

ii

iiiii xfxf

xxxfxx

The Geometric Similar Triangles

f(x)

f(xi)

f(xi-1)

xi+1 xi-1 xi X

B

C

E D A

11

1

1

)()(

ii

i

ii

i

xx

xf

xx

xf

DE

DC

AE

AB

Figure 2 Geometrical representation of the Secant method.

The secant method can also be derived from geometry:

can be written as

On rearranging, the secant method is given as

http://numericalmethods.eng.usf.edu5

Algorithm for Secant Method

http://numericalmethods.eng.usf.edu6

Step 1

0101

1 x

- xx =

i

iia

Calculate the next estimate of the root from two initial guesses

Find the absolute relative approximate error

)()(

))((

1

11

ii

iiiii xfxf

xxxfxx

http://numericalmethods.eng.usf.edu7

Step 2

Find if the absolute relative approximate error is greater than the prespecified relative error tolerance.

If so, go back to step 1, else stop the algorithm.

Also check if the number of iterations has exceeded the maximum number of iterations.

http://numericalmethods.eng.usf.edu8

ExampleYou are working for a start-up computer assembly company and have been asked to determine the minimum number of computers that the shop will have to sell to make a profit.

The equation that gives the minimum number of computers ‘x’ to be sold after considering the total costs and the total sales is:

03500087540)f( 5.1 xxx

http://numericalmethods.eng.usf.edu9

Solution

Use the Secant method of finding roots of equations to find

The minimum number of computers that need to be sold to make a profit. Conduct three iterations to estimate the root of the above equation.

Find the absolute relative approximate error at the end of each iteration, and

The number of significant digits at least correct at the end of each iteration.

http://numericalmethods.eng.usf.edu10

Graph of function f(x) 03500087540 51 xxxf .

0 20 40 60 80 1002 10

4

1 104

0

1 104

2 104

3 104

4 104

f(x)

3.5 104

1.25 104

0

f x( )

1000 x

Graph of function f(x)

http://numericalmethods.eng.usf.edu11

Iteration #1

%474.17

60.587

181255392

2550539250

50,25

1

10

10001

01

a

x

xfxf

xxxfxx

xx

0 20 40 60 80 1003 10

4

2 104

1 104

0

1 104

2 104

3 104

4 104

f(x)x'1, (first guess)x0, (previous guess)Secant linex1, (new guess)

3.5 104

2.007 104

0

f x( )

f x( )

f x( )

secant x( )

f x( )

1000 x x 0 x 1' x x 1

The number of significant digits at least correct is 0.

http://numericalmethods.eng.usf.edu12

Iteration #2

%1672.3

62.569

5392133.850

50587.60133.8505871.60

587.60,50

2

01

01112

10

a

x

xfxf

xxxfxx

xx

0 20 40 60 80 1002 10

4

1 104

0

1 104

2 104

3 104

4 104

f(x)x1 (guess)x0 (previous guess)Secant linex2 (new guess)

3.5 104

1.606 104

0

f x( )

f x( )

f x( )

secant x( )

f x( )

1000 x x 1 x 0 x x 2 The number of significant digits at least correct is 1.

http://numericalmethods.eng.usf.edu13

Iteration #3

%19425.0

62.690

133.850219.49

587.60569.62219.49

569.62

569.62,587.60

a

3

12

12223

21

x

xfxf

xxxfxx

xx

Entered function along given interval with current and next root and the tangent line of the curve at the current root

0 20 40 60 80 1002 10

4

1 104

0

1 104

2 104

3 104

4 104

f(x)x2 (guess)x1 (previous guess)Secant linex3 (new guess)

3.5 104

1.508 104

0

f x( )

f x( )

f x( )

secant x( )

f x( )

1000 x x 2 x 1 x x 3

The number of significant digits at least correct is 2.

http://numericalmethods.eng.usf.edu14

Advantages

Converges fast, if it converges Requires two guesses that do not need

to bracket the root

http://numericalmethods.eng.usf.edu15

Drawbacks

Division by zero

10 5 0 5 102

1

0

1

2

f(x)prev. guessnew guess

2

2

0

f x( )

f x( )

f x( )

1010 x x guess1 x guess2

0 xSinxf

http://numericalmethods.eng.usf.edu16

Drawbacks (continued)

Root Jumping

10 5 0 5 102

1

0

1

2

f(x)x'1, (first guess)x0, (previous guess)Secant linex1, (new guess)

2

2

0

f x( )

f x( )

f x( )

secant x( )

f x( )

1010 x x 0 x 1' x x 1

0Sinxxf

Additional ResourcesFor all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, MathCad and MAPLE, blogs, related physical problems, please visit

http://numericalmethods.eng.usf.edu/topics/secant_method.html

THE END

http://numericalmethods.eng.usf.edu