Homework 3 solutios Sectio 2.2: Ex 3,4,5,9,12,14 Sectio 2.3: Ex 1,4; AP 1,2 20 poits. Grded 2.2, Ex 4,5, d 2.3, AP 1,2 Sectio 2.2 3. For ech uctio, id itervl [,] so tht d hve dieret sigs. x = e x 2 x -3 > 0, 0 < 0, 3 > 0; thus roots lie i the itervls [-3,0] d [0,3]. x = cosx + 1 x /4 > 0 d /2 < 0; thus root lies i the itervl [ /4, /2]. c x = lx 5 + x 3 < 0 d 5 > 0; thus root lies i the itervl [3,5] d x = x 2 10x + 23 3 > 0, 5 < 0, 7 > 0; thus roots lie i the itervls [3,5] d [5,7]. 4-5. Strt with [ o, o ] d use the lse positio method to compute c o, c 1, c 2, d c 3. 4. x = e x 2 x = 0, [ o, o ] = [-2.4, -1.6] c o = -1.83008, c 1 = -1.84093, c 2 = -1.84139, c 3 = -1.8414 5. x = cosx + 1 x, [ o, o ] = [.8, 1.6] c o = 1.27012, c 1 = 1.2823, c 2 = 1.28343, c 3 = 1.28343 9. Wht will hppe i the isectio method is used with the uctio x = 1/x-2 d the itervl is [3,7]? 37 = 1/5 > 0, so the lgorithm would tell us tht there is o root i [3,7], which is true. the itervl is [1,7]? 17 = -1/5 < 0, ut there is o root i 1,7. The method ils, ecuse the uctio is ot cotiuous i [1,7].
12. Show tht the ormul c is lgericlly equivlet to c. We dd the terms: c 14. The polyomil x = x-1 3 x-2x-3 hs 3 zeros: x=1 o multiplicity 3, x=2, d x=3, ech o multiplicity 1. I o d o re y two rel umers such tht o < 1 d o > 3, the o o <0. Thus, o the itervl [ o, o ] the isectio method will coverge to oe o the three zeros. I o <1 d o >3 re selected so tht c = + /2 is ot equl to 1, 2, or 3 or y >= 1, the the isectio method will ever coverge to which zeros? Why? It c t coverge to x=2, uless it hits c =2 exctly extremely ulikely, or the ollowig reso. Excludig the cses where c hits 1 or 3 exctly, i o <1, d o >3, the the midpoit c o will e either less th 1, greter th 3, or i the itervl 1,3. I the irst d secod cses, 1 =c o or 1 =c o, d we ck to the origil cse o <1, o >3. Assume, thereore, tht the itertio hs proceeded util c is i 1,3, d relel this poit c o. I, 1 < c o < 3, the there re three possiilities: i 1 < c o < 2, i which cse c o >0, so 1 = c o, d x=2 is outside o the rcket, ii 2 < c o < 3, i which cse c o <0, so 1 = c o, d gi, x=2 is outside o the rcket, or iii c o = 2. I either cse, oce itertio gets poit i the itervl 1,3, it rckets i o either 1 or 3, ut ever 2, uless it hppes to hit o 2 exctly.
Sectio 2.3 Exercises 1,4 Grphiclly determie the pproximte loctio o the roots o x=0 i the give itervl. Determie itervl [,] over which the isectio or lse positio lgorithms c e used to determie the roots. 1. x = x 2 e x or x i [-2, 2] The grph o x is show elow: So the root is pproximtely t x=-0.7. You could use the itervl [-1,-.5] i the lgorithms. 4. x = cosx + 1+x 2-1 or x i [-2,2] The grph o x is show elow: There re two roots, t pproximtely x = -1.8 d x = 1.8. You could use the itervls [-2, -1.6] or [1.6, 2].
Algorithms d Progrms 1-2. Approximte the rel roots, to 12 deciml plces, o ech uctio over the give itervl. 1. x = 1,000,000 x 3 111,000 x 2 + 1110 x 1, or x i [-2, 2]. Three roots, t x = 0.1,.01,.001. Note tht x c e ctored: x = 1000 x 1 100 x 1 10 x -1. 2. x = 5 x 10 38 x 9 + 21 x 8 5 x 6 3 x 5 5x 2 + 8x 3, or x i [-15, 15] Two roots, t x = -0.847129818132 d x = 7.010824348276 MATLAB codes re show elow. Three iles were used: i script tht deies the uctio d ouds, ii uctio to id corse pproximtios o the roots, d iii uctio tht perorms the isectio lgorithm to id ie pproximtio o the roots. The output ws the ollowig: x = 1,000,000 x 3 111,000 x 2 + 1110 x 1 x = 5x 10 38x 9 + 21x 8 5 x 6 3 x 5 5x 2 + 8x 3 Corse pproximtio: 1.0500e-003 28 itertios Root: 1.000000000372e-003, c=3.318e-010 Corse pproximtio: -8.4715e-001 28 itertios Root: -8.471298181321e-001, c=4.005e-011 Corse pproximtio: 9.9500e-003 28 itertios Root: 1.000000000037e-002, c=-3.017e-010 Corse pproximtio: 7.0108e+000 28 itertios Root: 7.010824348276e+000, Error: 7.452e-013 c=5.923e-005 Corse pproximtio: 1.0005e-001 28 itertios Root: 1.000000000004e-001, c=3.318e-009
MATLAB codes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Fid root o x=0 usig isectio method % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Deie uctio to id zero o, d regio to id zero i =@x1000000*x.^3-111000*x.^2+1110*x-1; i=-2; i=2; =@x5*x.^10-38*x.^9 + 21*x.^8-5*pi*x.^6-3*pi*x.^5-5*x.^2 + 8*x - 3; i=-5; i=8; % Tolerces or error delt1 = 10^-4; % error i corse pproximtio delt2 = 10^-12; % error i isectio method % Fid corse pproximtio o roots: R = pproot,i:delt1:i; rts=0; % Use isectio method to id ie pproximtio: or i=1:legthr =Ri-delt1; =Ri+delt1; [c,err,yc,k]=isect,,,delt2; rtsi=c; dispsprit'\corse pproximtio: %.4e\%i itertios\root: %.12e, \Error: %.3e \c=%.3e',ri,k,c,err,c ed % Plot uctio d roots igure1; ezplot,[i,i] hold o; plotrts,0*rts,'r*'%,[i i],[0 0],'g' uctio R = pproot,x % Iput - is oject uctio % - X is the vector o scisss % Output - R is the vector o pproximte loctios or roots Y=X; =legthx; m=0; or k=2:, i Yk-1*Yk <= 0, m=m+1; Rm=Xk-1+Xk/2; ed ed
uctio [c,err,yc,k]=isect,,,delt %Iput - is the uctio % - d re the let d right edpoits % - delt is the tolerce %Output - c is the zero % - yc= c % - err is the error estimte or c %I is deied s M-ile uctio use the @ ottio % cll [c,err,yc]=isect@,,,delt. %I is deied s oymous uctio use the % cll [c,err,yc]=isect,,,delt. y=; y=; i y*y > 0,retur,ed mx1=1+roudlog--logdelt/log2; or k=1:mx1 c=+/2; yc=c; i yc==0 =c; =c; elsei y*yc>0 =c; y=yc; else =c; y=yc; ed i - < delt, rek,ed ed c=+/2; err=s-; yc=c;