Sei sulla pagina 1di 4

ENGG3700

Tutorial 3 (Newton’s method extensions: Secant & False Position Method)


References:
Numerical Analysis (10th Edition), R L Burden & J D Faires

1. Let 𝑓(𝑥) = −𝑥 3 − 𝑐𝑜𝑠𝑥, with 𝑝0 = −1 𝑎𝑛𝑑 𝑝1 = 0 , find 𝑝3 .

a. Using the secant method

b. Using the False position method

2. Let 𝑓(𝑥) = 𝑥 2 − 6, with 𝑝0 = 3 𝑎𝑛𝑑 𝑝1 = 2 , find 𝑝3 .

a. Using the secant method

b. Using the False position method

c. Which one is closer to √6 ?

3. Use the Secant method to find solutions accurate to within 10−4 for the following

problems:

a. 𝑥 3 − 2𝑥 2 − 5 = 0, [1,4]

b. 𝑥 3 + 3𝑥 2 − 10 = 0, [−3, −2]

4. Use the false position method to find solutions accurate to within 10−4 for the

following problems:
𝜋
a. 𝑥 − cos(𝑥) = 0, [0, ]
2

b. 𝑥 − 0.8 − 0.2 𝑠𝑖𝑛𝑥 = 0, [0, 𝜋/2]

Sohar University 2018-2019


ENGG3700
Lab 3 (Newton’s method extensions: Secant & False Position Method)
1. Secant Method

Write a Matlab code to find a solution to f (x) = 0 given two initial approximations p0
and p1:

INPUT: initial approximations p0 and p1, TOL, Maximum number of iterations N0.

OUTPUT: approximate solution p or message of failure.

Step 1 Set i = 2;

q0 = f ( p0);

q1 = f ( p1).

Step 2 While i ≤ N0 do Steps 3–6.

Step 3 Set p = p1 − q1( p1 − p0)/(q1 − q0). (Compute pi.)

Step 4 If | p − p1| < TOL then

OUTPUT (p); (The procedure was successful.)

STOP.

Step 5 Set i = i + 1.

Step 6 Set p0 = p1; (Update p0, q0, p1, q1.)

q0 = q1;

p1 = p;

Sohar University 2018-2019


q1 = f (p).

Step 7 OUTPUT (‘The method failed after N0 iterations, N0 =’, N0); (The procedure
was unsuccessful.)

STOP.

2. False Position

To find a solution to f (x) = 0 given the continuous function f on the interval [ p0, p1]

where f ( p0) and f ( p1) have opposite signs:

INPUT initial approximations p0, p1; tolerance TOL; maximum number of iterations
N0.

OUTPUT approximate solution p or message of failure.

Step 1 Set i = 2;

q0 = f ( p0);

q1 = f ( p1).

Step 2 While i ≤ N0 do Steps 3–7.

Step 3 Set p = p1 − q1( p1 − p0)/(q1 − q0). (Compute pi.)

Step 4 If | p − p1| < TOL then

OUTPUT (p); (The procedure was successful.)

STOP.

Step 5 Set i = i + 1;

q = f ( p).

Step 6 If q · q1 < 0 then set p0 = p1;

Sohar University 2018-2019


q0 = q1.

Step 7 Set p1 = p;

q1 = q.

Step 8 OUTPUT (‘Method failed after N0 iterations, N0 =’, N0);

(The procedure unsuccessful.)

STOP.

Sohar University 2018-2019

Potrebbero piacerti anche