MatLab Project 2 - m-File, Bisection Method and Fixed

MatLab Project 2 - m-File, Bisection Method and Fixed-Point Iteration
( Due February 23)
1. Use the MatLab program for the Bisection Method to solve the follow problems:
Page 53: 3(a), 5 - fŸx x " tan x for x in 0, 4. 5 , 7(b), 10, 11, 18 (extra points).
For each equation, you need to update your MatLab function file fun.m. Make sure the current function is
being active. Turn in the following:
a. the approximation to the solution;
b. the function value at the approximation;
c. the number of iterations needed.
3(a) fŸx x 3 " 7x 2 14x " 6, 0, 1 , / 10 "2
n 7, p 7 0. 5859375, fŸp 7 0. 00103139877319
5. fŸx x " tan x for x in 0, 4. 5 , / 10 "3 , n 0, a 0 is a solution.
7(b) fŸx e x " x 2 3x " 2, 0, 1 , / 10 "5
n 17, p 17 0. 25753021240234, fŸp 17 "2. 759847070876731 • 10 "7
10. fŸx x 2 " 3, 1, 2 , / 10 "4
n 14, p 14 1. 73199462890625, fŸp 14 "1. 946054399013519 • 10 "4
11. fŸx x 3 " 25, 1, 3 , / 10 "4
n 15, p 15 2. 92401123046875, fŸp 15 "1. 669209170813701 • 10 "4
18. (Extra points)
g
ŸsinhŸwt " sinŸwt 2w 2
dx g Ÿw coshŸwt " w cosŸwt g ŸcoshŸwt " cosŸwt 2w
dt
2w 2
g
Solve dx | t1 1. 7 for w. fŸw ŸcoshŸwt " cosŸwt " 1. 7
2w
dt
xŸt 20
15
10
a, b
"1, 0
w X p 17 "0. 1057
fŸp 17 2. 4279e " 005
5
-1.4
-1.2
-1
-0.8
-0.6
-0.4
-0.2
0
1
2. Use the MatLab program for the Fixed-point Iteration to solve the following problems:
Page 63: 7, 10, 11(b)(c), 12, 15.
For each equation, you need to update your MatLab function file gfun.m. Make sure the current function is
being active. Let K max 200. Turn in the following:
a. the approximation to the solution;
b. the number of iterations used.
For each of 11(b), 11(c) and 12, compare the number of iterations used and the number of iterations you
estimated.
7. gŸx = 0. 5 sin x , 0, 2= . p 4 3. 62699562243874
2
10. fŸx x 3 " 25, use g’s which are similar to the ones given in 3.(a)(b)(d). Recall the sequence
generated by g in 3(c) diverges. p 0 1, / 10 "4 , 3 25 2. 924 017 738 212 866 07
(a) Ÿ25x " 24x x 2 25, 25x 24x 252 , x 1 24x 252 gŸx , 1, 3
25
x
x
p 55 2. 92337094856321
3
(b) Ÿx " x Ÿ3x 2 "Ÿx 3 " 25 , x x " x " 225 gŸx , 1, 3
3x
p 8 2. 92401773821287
25 gŸx , 1, 3
(d) xx 2 25, x 2 25
x
x , x
p 17 2. 92404167439179
x 52 2, gŸx 52 2,
x
x
gŸx has a fixed-point in 1, 4 .
11(b)
|g U Ÿx | " 103
x
Let p 0 2. 5.
103 t 103 0. 64 for x in 2. 5, 4
2. 5
x
|p n " p| t Ÿ0. 64 n max 2. 5 " 2. 5, 4 " 2. 5
Let N 27.
, n
6
5
4
3
1. 5Ÿ0. 64 n 10 "5
"5
n lnŸ0. 64 ln 10
1. 5
7
lnŸ10 "5 " lnŸ1. 5 26. 706
lnŸ0. 64 p 17 2. 69064975842301
2
1
1
2
x3
4
5
– y gŸx , - - y x
2
x
ex 3
e x/2
3
gŸx 7
gŸx has a fixed-point in 0, 2 .
U
1
2 3
g Ÿx 11(c)
e x/2 t
1
2 3
6
e 0. 784 7 K 1
5
4
Let p 0 0. By Cor. 24,
|p n " p| t K n max 0, 2 " 0
lnŸ0. 7847 n ln
1
2
3
2Ÿ0. 7847 n 10 "5
2
10 "5 ,
1
ln 12 10 "5
n
50. 34, N 51
lnŸ0. 7847 0
1
p 15 0. 91000287942203
e x/2
3
12(a) 3x 2 " e x 0, x 0, =
4
gŸx ,
2
2
4
5
0, 2 . Same result as 11(c).
= " 2
2
4
Ÿ"1 and p 0 0. x cos x gŸx ,
2
2
|p n " p| t
n ln
3
x
– y gŸx , - - y x
12(b) x " cos x 0, fŸx x " cos x, fŸ0 f =
4
Let a, b
2
"5
ln 10
=/4
n
2
1.
2
U
g Ÿx |" sinŸx | t
max 0, =
4
, n
" 7. 829 138 • 10 "2 0
=
4
lnŸ10 "5 " ln =
4
2
ln
2
n
2
2
10 "5
32. 522 273 , N 33.
p 30 0. 73908229852240
15. 2 sinŸ=x x 0,
1, 2 , p 0 1.
sinŸ=Ÿx " 2 " x ,
2
x
"
2
2
" x 2 sinŸ=x 2 sinŸ=Ÿx " 2 ,
1 sin "1
=Ÿx " 2 sin "1 " x , x =
2
2
2
1.5
1.8
1
1.6
0.5
1.4
0
1.2
1.4
x
1.6
-0.5
1.8
2
1.2
1
1
y 2 sinŸ=x x
1.2
–y
1
=
1.4
x
sin "1 " 2x
1.6
1.8
2
2, - - y x
p 5 1. 68324099261395
3