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

Secant Method

Embed Size (px)

DESCRIPTION

Secant Method. Chemical Engineering Majors Authors: Autar Kaw, Jai Paul http://numericalmethods.eng.usf.edu Transforming Numerical Methods Education for STEM Undergraduates. Secant Method http://numericalmethods.eng.usf.edu. Secant Method – Derivation. Newton’s Method. (1). - PowerPoint PPT Presentation

Citation preview

04/19/23http://

numericalmethods.eng.usf.edu 1

Secant Method

Chemical 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

Example 1You have a spherical storage tank containing oil. The tank has a diameter of 6 ft. You are asked to calculate the height, h, to which a dipstick 8 ft long would be wet with oil when immersed in the tank when it contains 4 ft3 of oil.

h

r

Spherical Storage Tank

Dipstick

Figure 2 Spherical Storage tank problem.

http://numericalmethods.eng.usf.edu9

Example 1 Cont.

The equation that gives the height, h, of liquid in the spherical tank for the given volume and radius is given by

Use the secant method of finding roots of equations to find the height, h, to which the dipstick is wet with oil. 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.

0819739 23 .hhf(h)

http://numericalmethods.eng.usf.edu10

Example 1 Cont.

Figure 3 Graph of the function f(h) 0819739 23 .hhf(h)

0 1 2 3 4 5 6120

100

80

60

40

20

0

20

f(x)

3.82

104.18

0

f x( )

60 x x guess1 x guess2

http://numericalmethods.eng.usf.edu11

Example 1 Cont.Solution Initial guesses of the

root:

64423.0

8197.398197.39

8197.3921

31

20

30

1020

30

0

10

10001

hhhh

hhhhh

hfhf

hhhfhh

.1 and 5.0 01 hh

Iteration 1The estimate of the root is

Figure 4 Graph of the estimated root of the

equation after Iteration 1.

0 1 2 3 4 5 6120

100

80

60

40

20

0

20

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

7.57

104.18

0

f x( )

f x( )

f x( )

secant x( )

f x( )

60 x x 0 x 1' x x 1 The absolute relative approximate error is

% 224.55

1001

01

h

hha

The number of significant digits at least correct is 0.

http://numericalmethods.eng.usf.edu12

Example 1 Cont.

67185.0

8197.398197.39

8197.3920

30

21

31

012

131

1

01

01112

hhhh

hhhhh

hfhf

hhhfhh

Iteration 2The estimate of the root is

Figure 5 Graph of the estimated root after Iteration 2.

0 1 2 3 4 5 6120

100

80

60

40

20

0

20

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

8.559

104.18

0

f x( )

f x( )

f x( )

secant x( )

f x( )

60 x x 1 x 0 x x 2

The absolute relative approximate error is

% 1104.4

1002

12

h

hha

The number of significant digits at least correct is 1.

http://numericalmethods.eng.usf.edu13

Example 1 Cont.

67759.0

8197.398197.39

8197.392

131

22

32

1222

32

2

12

12223

hhhh

hhhhh

hfhf

hhhfhh

Iteration 3The estimate of the root is

The absolute relative approximate error is

% 84768.0

1002

12

h

hha

The number of significant digits at least correct is 1.

Figure 6 Graph of the estimated root after Iteration 3.

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

0 1 2 3 4 5 6120

100

80

60

40

20

0

20

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

7.145

104.18

0

f x( )

f x( )

f x( )

secant x( )

f x( )

60 x x 2 x 1 x x 3

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