Homework 4 solutions

Homework 4 solutions - 10.2(a The coefficient:31 is...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 12
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 14
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 10.2 (a) The coefficient (:31 is eliminated by multiplying row 1 hyfgl = 2:“? and subtracting the result fi'om row 2. 1:31 is eliminated by nuiltiplymg row 1 hyfg.‘ = If? and subtracting the result from row 3. The factors fgl andfn can be stored in (131 and an. T 2 —3 {1235?14 4.4235?1 —2. 142 36 0.14235? —1.235?1 —5.5?143 1132 is eliminated by multiple row 2 hyfn = —l.235?11’4.4235?1 = 41.29032 and subtracting the result fiom row 3. The factor f}: can be stored in (133. T 2 —3 DEBETH 4.42357'1 —2.l4236 0.14235? —0.29032 —fi.19355 Therefore. the LU decomposition is l [J [J T 2 —3- [1E]= fl.235?14 1 Cl [U]= Cl 4.4235?1 —2.14236 0.14235? 43.29032 1 [II D —fi.19355 These two matrices can be multiplied to yield the original system. For example. using MATLAB to perform the multiplication git-"es b} 1=[1 fl C;O.235114 1 D;E.14235T —0.29032 _], P} U=[? 2 —3;E 4.é235?1 —2.1428£,E 0 —E.19355], P} ltt ans = T.EODE 2.3EEO —3.EOUE 2.EDUE 5.38E0 —3.EDUE 1.803E —1.JEED —E.EDUE (b) Forward substitution: [L] {D} = {B} 1 :1 :1 1:11 —12 11.235?14 1 :1 d3 = —2o 11.142357 41.29032 1 d3 —25 Solving yields a" = —12 ._ d2 = —1|5. 5? l4, and d3. = —29.0963. x__.,.__-' Back substitution: 1 2 —3 111 —12 11 4.423511 —2.14235 23 = —15.5114 11 11 —5.151555 x3 —25.115153 —25.3553 13 =—=4.1551511 —15.15355 _ _ —7 3“: 115.5114 ( 21435191551511)=_li463?5 - 4.423511 —12— —3 4.1551151141415315 111 =¥=311315 (1:) Forward substitution: [L]{D} = {B} 1 11 11 151 12 11.235114 1 11 d3 = 13 11.142351 41.251152 1 113 —15 Snlvmg 3:131:13 21:11:19: = 14.5"1'143, and d3 = 4.43381 Back substitution: 1 2 —3 111 12 11 4.423511 —2.14235 23 = 14.51145 11 11 —5.151555 x3 —3.43331 —3.43331 13 =—=11.51525 —15.15355 — —7 J[61451143 { 2142351111.5:5251=3iStags - 4.423511 12— —5 3.5525 —2 3.5525 x1 =w=39355 "1' 10.3 (it) The coefficient (:31 is eliminated by multiplyiug row 1 byfgl = 4 and subtracting the result fiom row 2. {:31 is eliminated by multiplying row 1 byfil = 12 and subtracting the result from row 3. The factors ffl 3116;31 can be stored in (131 and an. 1 t —4'_ 4 —32 25 12 —ss 51_| as: is eliminated by multiplying row 2 byfig = 435132 = 2.65625 and subtracting the result fi'om row 3. The factorf}: can be stored in 4132. l T —4 4 —32 25 12 2.65625 45.40625 Therefore. the LU decomposition is 1 o o 1 "t —4 '_ [r]: 4 1 o [U]: o —32 25 12 2.65625 1 CI 0 —lfi.4-C|625_I Forward substitution: [L] {D} = {B} 1 o 0 tall" —51 4 1 0 mg = 62 12 2.65625 1 tag 3 Solving yields all: 11,115 = 40. and d3 =—18.?5. Back substitution: 1 "t —4 pl” 11 o —32 25 q; = —4t1 o 11 45.46625 [3:3 —1s.?5 —13.".I'5 x3 =—=1.2l?039 —15.4D625 _’J h = —411 fineness) = 2200311 ' —32 ll 41.212039 —? 2.260811 x1: # = g_4534?5 1 (b) The first column of the inverse can be computed by using [L] {D} = {B} 1 o 1:: d1" 1 4 1 11 d2 = c- 12 2.55625 1 3:13” 11 This can be solved for or] = 1, d3 = —4, and d3 = —1.3?5. Then, we can implement back substitution 1 T —4 x1” 1 o —32 25 x2 = —4 r1 [1 4540525 5L —1.3?5 to yield the first column of the inverse —o.oosuss‘ {X} = (1.1945215 _ 0.039249 For the second column use {3}? = {Cl 1 CI} which gives {£31}T = {Cl 1 —2.6525 Back substitution then gives {X}T= {—11.054433 11.105443 {1.112414}. For the third column use {B}T = {t} t] 1} which gives {D}I = {D t] 1}. Back substitution then gives {2r}T = {11.095335 —s.o5s?1 43.05491}. Therefore: the matrix inverse is 1 —fl_Dflfifl35 —D_fl34433 [1.095335 [AT = D.194?26 {11133443 —fl.DSflT10 0.1339249 {1.13414 —G.Dfi49fl9 We can verifj.r that this is correct by multiplying [A] [A]—I to yield the identityr matrix. For example, using mm: b} A=[l T -4;é -4 9-12 -1 3:; 38> AI=inv{A] AI = —':|.CUEJ. 43:33-25 33953 3.194? I3.1E34 —:I.I35-:I'? Cull-3‘92 I3.1"1'2¢l fuller}? :>:> Al'DI ans = LED-CID I) I3 —':|.CUCIE l :IEEI) CI ISO-CID I3 I) LED-CH3 10.4 As the system is set up, we must first pivot by switching the first and third rows of [A]. Note that we must make the same switch for the right-hand-side vector {3} —s 1 —2 —2:1‘ [.1] = [—3 —1 v] {s} ={—34} 2 —s —1 —3s The coefficient (:31 is eliminated by multiplying roe.r l byjfil = —3.-’—8 = 0.335 and subtracting the result fiom row 2. (:31 is eliminated by multiplying row 1 byfil = HIE—3} = —C|.25 and subtracting the result fiom row 3. The fietorsfgl andfil can be stored in (131 11nd ml. —3 1 —2 [A]: 0.3?5 —1.3?5 m —o.25 —5.?5 —1.5 Next; we pivot by switching rows 2 and 3. Again, we must also make the same switch for the right- hsnd—side vector {3} —s 1 —2 —2o [.1]: —o.25 —5.?5 —1.5 {3}: —3s 0.3?5 —1.3?5 NS —34 a3: is ehminated by multiplying row 2 byfig = —l.3?5.-’(—5.'.I'5) = {1.239 13 and subtracting the result fiom row 3. The fietorffl can be stored in (:33. —s 1 —2 '_ [.1]= —o.25 —5.1'5 —1.5 0.3?5 0.23913 3.1035945] Therefore. the LU decomposition is 1 0 o" —s 1 —2 [it]= —o.25 1 11_ [U]: :1 —5.?5 —1.5 . 11.3?5 11.23913 11 1'1 11 8.1036915] Forward Substimtion: [L] {D} = {B} 1 o o'_ (311 [—20 —o.25 1 0 d1 =<—33 0.3?5 0.23913 1_| d3] [—34 Solving yields d1: —2fl_ d2 = —43_ and d3 = —lfi_21?4_ Back substitution: —3 1 —2 _x11[ —2ol 0 —5.?5 —1.5 _x1 = —43 o 0 3.1035945] x3] l_—le_21?4j —lfi.21?4 x3 = — = —2 3.1036915 h = —43+1.5(—2} =3 _ —5.?5 —2.U 2 —2 —3 x1: —+ (3 } = 4 10.20 The problem can be set up as 2M1+5M1 “1:3 = —5—{—3} = —2 Axl+2flx1+flx3 =3_4=_l which can be solved for An = 0.25, or; = 43.416561 and M3 = 43.4166? These can be used to yield the corrected results x1: 2 + 13.25 = 2.25 x3 = —3 — 0.4166? = —3.4166? x3 = 8—13.4166? = 158333 These results are exact. 11.9 The first iteration can be implemented as _ 531mm:2 +33 3550 +333) +0 c1——P =—=22r: 15 15 '7') £1 = 1200+3c1 +1533 =1200+5(--0)+5{0) =1033333 13 13 2400+4 + . 5 $3 = 1:1 :1 = _4oo+4(22102)+103.3553 = 2813444 Second iteration: _ 3300+3c2 +153 3300 +3[103.3333) + 231.9444 {31 F =— = 259.453 15 15 1200+3 +5. '15 C1 2 c1 c3 21200+3(_.9.455)+5(231.9444) : 203392 18 15 '3 F " '3 C3 = 2400+1fiq+32 = -330+4(2:+9.14)63)+203.89_ £034”? The error estimates can be computed as gm] 4% x10055=152155 '3— 5-“ . = W morass = 49.32% -- 203.352 _') gas 2 w X10091, : 51% - 355.453? The reminder of the calculation proceeds until all the errors fall below the stopping criterion of 5%. The entire computation can be summarized as iteration unknown value 5., maximum .55. 1 c1 220 100.00% 02 103.3333 100.00% 03 231.9444 100.00% 100.00% 2 {:1 253.433 15.21% {:2 203.332 43.32% ca 303.4 T3? 7'. 10% 43.32% 3 {:1 231.0103 T.BT% C: 214.3313 5.02% ea 311.5535 2.53% ?.3?% 4 {:1 233.?023 0.35% 02 21?.3033 1.44% ea 312.?1?3 0.3?% 1.44% Thus. after 4 iterations, the maximlmfl. error is 1.44% and we arrive at the result: :71 = 283 . WES, c3 = 2118033 and c3. = 312.?1T9. 13.2 (a) The function can be plotted -30 420 {b} The function can be differentiated twice to give Fix] = —4s.r'* — 24,112 Thus. the second derivative will always be negative and hence the function is concave for all values of x. [c] Differentiating the function and setting the result equal to zero results in the following roots problem to locate the maximum f'Lr) =U=—9.'t5 —s.r3 +12 A plot of this function can he developed 400 400 A technique such as bisection can be employed to determine the root. Here are the first fevir iterations: iteration x, x“ x, fire} 11er fixitxflxr} ea 1 0.00000 2.00000 1.00000 12 -5 450.0000 2 0.00000 1.00000 0.50000 12 10.?10?5 128.6250 100.00% 3 0.50000 1.00000 0.?5000 10.?18?5 6.430253 60.555? 33.33% 4 0.?5000 1.00000 0.87500 6.480253 2.024445 13.13T1 14.29% 5 0 .3?500 1 .00000 0.03?50 2.024445 —1 .10056 22403 5.671% The approach can he continued to yield a result 0fX= 0.91692. 13.3 First. the golden ratio can be used to create the interior points. 33—1 dzTIIZ—D} 21.2361 XI =0+l.2331=1.23'fil 12 : 2—1.2361:3.7339 The function can be evaluated at the interior points HIE} = duress: =31er for.) = 73.2351) = 4.3142 Because 11:13} :> 71:11). the maximum is in the interval defined by 1;. 12. and X[.WhEI'E A“: is the optimum. The error at this point can be computed as E? = [1—3.31333) x133% =133% ' 3.7639 For the second iteration. X; = 0 and x” = 1.233]. The former 12 value becomes the new X1. that is. X] = 0.7339 and 111]] = 31379. The new.r values of ct and .152 can be computed as a =% (1.2351 — n) = 0.7639 x: =1.2331—0.7333 = [1.4721 The function evaluation at 313) = 5.5496. Since this value is less than the function value at It, the maximum is in the interval prescribed by 12, X1 and x... The process can be repeated and all three iterations summarized as r' x, mm x; flxz} x1 qu 3| Jr“ fix“) :7 x0," .5, 1 0.0000 0.0000 0.7639 3.1379 1.2361 4.3142 2.0000 404.0000 1.2361 0.7639 100.00% 2 0.0000 0.0000 0.4721 5.5496 0.7639 3.1379 1.2361 4.3142 0.7639 0.7639 61.30% 3 0.4721 5.5436 3.7339 3.1379 3.9443 3.6773 1.2361 4.3142 3.4721 3.9443 33.93% 13.4 First, the function values at the initial values can be evaluated fiat]! = ftflt =0 for.) = to} =s.5 rota) = o2} =—uu and substituted into Eq. (13.?) to give, _ 0(12—22}+8.5{22 —ozt+(—1o4){nz—12) I“ _ 2{n)(1— 2) + erasure —o) + 2(—104}{D —1) = Mm“ which has a function value of 40.5?0243) = 6.5?99. Because the function value for the new point is lower than for the intermediate point I:le and the new xvalue is to the left of the intermediate point, the lower guess {m} is discarded. Therefore, for the next iteration, rte) = mamas) =s.eass HA1) = m} =s.5 rug) = H2} 2—104 which can be substituted into Eq. (13.?) to give .153 = 0.312431, which has a function value of 110312431) = 3.445523. At this point, an approximate error can be computed as _ D.31243—U.5?0243 0.81243 Ea. x100%=29.31% The process can be repeated, with the results tabulated below: 4‘ Xu fion X1 11M} 1’2 fire} X3 fixal £3 1 0.00000 0.00000 1.00000 3.50000 2.0000 -104 0.5?025 5.53991 2 0.57025 5.57991 1.00000 3.50000 2.0000 —104 0.31243 3.44552 29.31% 3 0.31243 8.44352 1.00000 3.50000 2.0000 —104 0.903972 3.39525 10.50% Thus. after 3 iterations. the result is converging on the true value of fix) = 3.69i'93 at x: 0.91592. 13.5 The first and seoond derivatives of the function can be evaluated as r'rn ref—313 +12 rm 2 —45x* —2412 which can be substituted into Eq. [13.8] to give 4;? —s,rf +12 ,1: =1— “ ‘ —4s,r;*—24xf Substituting the initial guess yields 5 3 EI{2 )4 31:2 i+212 = 2 340 =L583333 —45{2 }—24[2 II —81Ei Arr+J =2 which has a function value of 412029. The second iteration gives —9{t.5333335}—a{1.5333333) +12 —tes.313 rm =1.533333 _ 4 _ 2 =1.533333——=1.2r.452 —45{t.:.33333 i—24[1.333333 ) —342. 931 which has a function value of 3.92451? At this point. an approximate error can be computed as _ t.2fi452—t.533333 _ 1.25452 Ea x1flfl%=25.316% The process can be repeated, with the results tabulated below: r' x fix] fix} f'tx] :3 I] 2 404 340 -816 1 1.583333 412323 433.313 342.381 25.31633 2 3 1.26462 3.92461? 33.2393 453.4?6 25.2fl2‘h’: 1.04??16 3.1?8616 3.156231 —BU.5683 20.?D3‘i-i: Thus. within five iterations, the result is converging on the true value of fix) 2 BfiEITEIS at 1': 1191592. 13.13 (a) First, the golden ratio can be used to create the interior points, d=%[4—t—ZJ) =3.msz XL =—2+3.7062 21.7062 x2 = 4—3.7082 = 0.2918 The function can be evaluated at the interior points 711;): {(02913} 21.04156 Hm = 111.7032} =5.oorso Because flirt} > flag}. the maximum is in the interval defined by X2} 11 and it}, where 11 is the optimum. The error at this point can be computed as 4— (—2) 17032 E” = (1—051803)‘ x100% =134.15% The process can be repeated and all the iterations summarized as r' x: flxfit x: fin} x1 flan] x” fix“) of x0," :3 1 —2.0000 —29.6000 0.2918 1.0416 1.7062 5.0075 4.0000 —12.6000 3.7062 1.7082 134.16% 2 0.2918 1.0416 1.7082 5.0075 2.5636 5.6474 4.0000 —12.6000 2.2916 2.5836 54.62% 3 1.7082 5.0075 2.5836 5.6474 3.1246 2.9361 4.0000 —12.6000 1.4164 2.5836 33.66% 4 1.7082 5.0075 2.2492 5.8672 2.5636 5.6474 3.1246 2.9361 0.6754 2.2492 24.05% 5 1.7082 5.0075 2.0426 5.6646 2.2492 5.8672 2.5636 5.6474 0.5410 2.2492 14.67% 6 2.0426 5.6646 2.2492 5.8672 2.3769 5.8770 2.5636 5.6474 0.3344 2.3769 8.69% 7 2.2492 5.6672 2.3769 5.8770 2.4559 5.8267 2.5636 5.6474 0.2C 67 2.3769 5.37% 8 2.2492 5.6672 2.3282 5.8653 2.3769 5.8770 2.4559 5.6287 0.1277 2.3282 3.39% 9 2.2492 5.6672 2.2980 5.8626 2.3262 5.8653 2.3769 5.6770 0.0769 2.3282 2.10% 10 2.2980 5.6626 2.3282 5.8653 2.3466 5.8640 2.3769 5.6770 0.0466 2.3282 1.30% 11 2.2980 5.6626 2.3166 5.8650 2.3262 5.8653 2.3466 5.6640 0.0301 2.3282 0.80% lb} First, the function values at the initial values can be evaluated rm} = £0.75) = 5.1051 Hm = f12}=5.5 HIE) = £12.51 =5.7313 and substituted into Eq. [13.7) to give, 5.1051(22 — 2.52} +5.e(2.s2 —1.r52}+5.7313{1.752 — 23) . _ 4.3341 xi 2{5.1051){2 — 2.5) + arsenas —1.?5) + 25.73133015 — 2} Second iteration: mm = 421:5.6 for.) = {(2.5) = 5.?313 HIE) = 02.3341) = 5.3352 which can be substituted into Eq. (13.?) to give .13 = 2.3112, which has a function value of 112.31 12} = 5.3345. At this point. an approximate error can be computed as 2.3112—2.3341 2.3112 x100% = [1.99% The process can be repeated, with the results tabulated below: .1 an] rpm] at. flan] x: fin] Jr; furs] £3 1 1.?500 5.1051 2.0000 5.6000 2.5000 5.7813 2.3341 5.8852 2 2.0000 5.6000 2.5000 5.7813 2.3341 5.8852 2.3112 5.8846 0.99% 3 2.5000 5.7813 2.3341 5.8852 2.3112 5.8848 2.3230 5.8853 0.84% 4 2.3341 5.8852 2.3112 5.8845 2.3280 5.8853 2.3263 5.8853 0.01% Thus. after 4 iterations, the result is converging rapidly on the true value of 1111 = 5.3853 at x: 2.3253. (c) The first and second derivatives of the function can be evaluated as I'm = 4—3.fix+3.fix2 4.2.13 f"{x) = —3.s+r.2.r—a.t-.‘l2 which can be substituted into Eq. [13.3) to give 4—3.5 +3.5X2—1213 —. a+r=rr '19 i .J i =3— 5‘3 22.52rs —3.s+r.2x.—3.sl; —14.4 which has a function value of 5.7434. The second iteration gives 2.3517, which has a function value of 5.3333. At this point. an approximate error can be computed as Ea = 18.53196. The process can be repeated. with the results tabulated below: 1' Jr fix} fix} 1"[1'] £3 0 3.0000 3.9000 45.8000 44.4000 1 2.5278 5.?434 —1 .4792 —8.4028 18.631% 2 2.3517 5.8833 -0.1639 -6.5?79 148533 3 2.3268 5.8853 —0.0030 6.3377 1.071% 4 2.3264 5.8853 0.0000 —Ei.3332 0.020% Thus. within four iterations, the result is converging on the true value of it] = 5.8853 at x: 2.3264. ...
View Full Document

This note was uploaded on 01/20/2011 for the course ENG EAD 115 taught by Professor Rocke during the Spring '10 term at UC Davis.

Page1 / 14

Homework 4 solutions - 10.2(a The coefficient:31 is...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online