EXERCISE 4. Solve The Following Problems Using Secant Method and Show The Graph of

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Secant Method

EXERCISE 4. Solve the following problems using Secant method and show the graph of
a function.

1.) Find a root of a function f(x) = cos(x) + 2 sin(x) + x2. Use x0 = 0 ,x1 = 0.1 as initial
approximations. Perform a maximum 100 number of iterations.

ANSWER:
Step x0 x1 x2 f(x2)

1 0.000000 1.000000 -0.449793 0.233292

2 1.000000 -0.449793 -0.562914 0.095270

3 -0.449793 -0.562914 -0.640996 0.016388

4 -0.562914 -0.640996 -0.657218 0.001797

5 -0.640996 -0.657218 -0.659216 0.000044

6 -0.657218 -0.659216 -0.659266 0.000000

Root is at -0.659266 (After 6 iterations)

GRAPH:

2.) Find a root of a function f(x) = x4 −5. Choose x0 = 1 and x1


= 2 as initial approximations.
ANSWER:

Updat
n x0 ( )
f x0 x1 ( )
f x1 x2 ( )
f x2 e
-
1.266666666 x0=x1
1 1 -4 2 11 2.425758024
7 x1=x2
7
- -
1.266666666 1.399164899 x0=x1
2 2 11 2.425758024 1.167557860
7 9 x1=x2
7 6
- -
1.266666666 1.399164899 1.522117795 0.367759559 x0=x1
3 2.425758024 1.167557860
7 9 7 7 x1=x2
7 6
- -
1.399164899 1.522117795 0.367759559 x0=x1
4 1.167557860 1.49266649 0.035778714
9 7 7 x1=x2
6 1
- -
1.522117795 0.367759559 1.495277716 x0=x1
5 1.49266649 0.035778714 0.000950409
7 7 5 x1=x2
1 2
- -
1.495277716 1.495348972 0.000002561 x0=x1
6 1.49266649 0.035778714 0.000950409
5 7 3 x1=x2
1 2

Approximate root of the equation x4-5=0 using Secant Method is 1.4953489727 (After 6 Iterations)

GRAPH:

3.) Locate the first positive root of f(x) = sin x + cos (1 + x2) − 1 where x is in radians.
Use four iterations of the secant method with initial guesses of
(a) xi−1 = 1.0 and xi = 3.0;

ANSWER:

Updat
n x0 ( )
f x0 x1 ( )
f x1 x2 ( )
f x2 e
- -
0.192959612 1.748631191 x0=x1
1 1 0.574675851 2 0.624674791
3 1 x1=x2
7 4
- -
0.192959612 1.748631191 1.940677608 x0=x1
2 2 0.624674791 0.013815138
3 1 8 x1=x2
4 1
- -
1.748631191 1.940677608 1.945020910 0.001449790 x0=x1
3 0.624674791 0.013815138
1 8 6 5 x1=x2
4 1
- -
1.940677608 1.945020910 0.001449790 1.944608404 x0=x1
4 0.013815138 0.000000072
8 6 5 4 x1=x2
1 8

( )
Approximate root of the equation sin(x)+cos 1+x2 -1=0 using Secant Method is 1.9446084044
(After 4 iterations)

(b) xi−1 = 1.5 and xi = 2.5; and


ANSWER:

Updat
n x0 ( )
f x0 x1 ( )
f x1 x2 ( )
f x2 e
-
0.166396317 0.669842314 x0=x1
1 1.5 0.996634689 2.5 2.356928735
4 3 x1=x2
5
-
0.166396317 0.669842314 2.547287160 x0=x1
2 2.5 2.356928735 0.082827907
4 3 4 x1=x2
4
-
0.669842314 2.547287160 2.526339088 0.031471092 x0=x1
3 2.356928735 0.082827907
3 4 4 6 x1=x2
4
-
2.547287160 2.526339088 0.031471092 2.532106931 0.000570066 x0=x1
4 0.082827907
4 4 6 6 4 x1=x2
4
-
2.526339088 0.031471092 2.532106931 0.000570066 2.532213337 x0=x1
5 0.000004236
4 6 6 4 6 x1=x2
8

( )
Approximate root of the equation sin(x)+cos 1+x2 -1=0 using Secant Method is 2.5322133376 (After 5
iterations)

(c) xi−1 = 1.5 and xi = 2.25 to locate the root.


ANSWER:

( )
Approximate root of the equation sin(x)+cos 1+x2 -1=0 using Secant Method 1.9446044579 (After 3
iterations)

Updat
n x0 ( )
f x0 x1 ( )
f x1 x2 ( )
f x2 e
- -
0.753820862 1.927017993 x0=x1
1 1.5 0.996634689 2.25 0.061769484
7 2 x1=x2
5 7
-
0.753820862 1.927017993 1.951479332 0.024146834 x0=x1
2 2.25 0.061769484
7 2 4 4 x1=x2
7
- -
1.927017993 1.951479332 0.024146834 1.944604457 x0=x1
3 0.061769484 0.000013943
2 4 4 9 x1=x2
7 7

4.) Determine the root of f(x) = x4.5 −80 using initial approximations x0 = 0 and x1 = 1 up to six
decimal places.
ANSWER:

Step x0 x1 x2 f(x2)

1 1.000000 3.000000 2.134274 -49.687202

2 3.000000 2.134274 2.525383 -15.364217

3 2.134274 2.525383 2.700458 7.391375

4 2.525383 2.700458 2.643591 -0.590160

5 2.700458 2.643591 2.647796 -0.020199

6 2.643591 2.647796 2.647945 0.000058

7 2.647796 2.647945 2.647945 -0.000000

Root is : 2.647945

GRAPH:

5.) Find the root of a function f(x) = −2x6 − 1.5x4


+ 10x + 2 using initial approximations x0 = 0.5 and x1 = 1.5 up to six decimal places.
ANSWER:

n x0 ( )
f x0 x1 ( )
f x1 x2 ( )
f x2 Update

x0=x1
1 0.5 6.875 1.5 -13.375 0.839506 8.949888
x1=x2
x0=x1
2 1.5 -13.375 0.839506 8.949888 1.104293 7.185385
x1=x2
x0=x1
3 0.839506 8.949888 1.104293 7.185385 2.182556 -226.395103
x1=x2
x0=x1
4 1.104293 7.185385 2.182556 -226.395103 1.137463 6.532017
x1=x2
x0=x1
5 2.182556 -226.395103 1.137463 6.532017 1.166771 5.841831
x1=x2
x0=x1
6 1.137463 6.532017 1.166771 5.841831 1.414836 -5.904488
x1=x2
x0=x1
7 1.166771 5.841831 1.414836 -5.904488 1.290142 1.523132
x1=x2
x0=x1
8 1.414836 -5.904488 1.290142 1.523132 1.315712 0.286917
x1=x2
x0=x1
9 1.290142 1.523132 1.315712 0.286917 1.321646 -0.019364
x1=x2
x0=x1
10 1.315712 0.286917 1.321646 -0.019364 1.321271 0.000222
x1=x2

Approximate root of the equation -2x6-1.5x4+10x+2=0 using Secant Method is 1.321271(After 10


iterations)

GRAPH:

You might also like