Please write a c++ program to solve b(ii). I've done b(i), and the pictures attached below are my solution to the b(i)
Question:
b. Consider the following difference equation: Pn+1 = apn + pn-1 n = 1,2,3,... PO, P1 are given. (7) (i) For certain conditions on a and b, the general form of the solution to (7) is Pn = 1 + 215 (8) Determine the conditions on a and b so that (8) is valid. Also determine ci, C2, 11, and 12 in terms of Po, P1, a, and b. (ii) Write a computer program to implement (7). Try your program with a = 2.0, b = 1.25, po = 1.0, and pi = -0.5. What results do you get and how do they compare with expected analytical results? What if po and pi are multiplied by 1 + for = 10" where r = 0,1,2,...? What are the analytical expected results? How can the computer results be explained from the perspective of "propagation of error" due to round off error? HINT: find A1, 12, C, and C2 corresponding to the given a, b, Po, and p1; what if Po and/or P are slightly perturbed? 5 3. ) ) Progromo ed - (i) h crit = 10-15 i) Putla a pntbonai, n=1, 2, 3,..., pop, are given Po1 - 0p, - b- Pn =) "" - " - bT"-" = 0 * - - = ot Jo +4, - h +4, 5, -- 146 2 Scott Williams solution Checking Each os ato t46 ( a + vatas)? - ala + 19.746) -6=0 a + 2a 1a +46 +9+46 + - 20 - 2ava +46 -1=0 a.2a + 2000+46-Zatat 46 ta #46 -40 - a + a=0 -0 ta=0 7 - a=-a-> (a -> a = 1 -> a = 1 Scott Willian x2 = a-Ja+46 x - at ab=0 (a-- ofa-vane) - 6 = a-2a 1a +46 +9+46 + - 20 + zavar45 - 46 = 0 6 concels everywhere no value con be solved! However, to avoid complex roots at 46 70 467-a 67-0/4 Po=C+ (2 , . , + . . C 72 = p. - (Po-(2) -> (2 2 2 - Cadi = piopoli -> C2 = e,-poli Scott Williams C = Po - Pi - pod 2-> Po (^2 ->) - Pit Pole = Pelz -%o) -Pi + loti With lisa+Ja+46 & 2 = a - Ja+46 2 ii) Part = 2.01 - ) + 1o2s (100) = -1.0t 1.25= 25 Numerical Results are exactly the some. It Po & pi are slightly perturbed, the solution will eventually blow up due to the error being multiplied with each iteration. Scott Willians por loo (1+E) P = - 2 (1+E) For analytical purposes perform E = lor, r=0 Po sloo (1+1) Pir-(1+) po= 2 p,=-1 Phuis 2.0 (-1 + 1.25 (2) E-2.0 + 2.50 3.50 Numerical results are exactly the same. As the (1+E) factor continues to get larger the computer vill have to start rounding off to keep format consistent. This will lead to loss of precision as more and more information about the true value is lost. Due to restrictions on how much information can be stored, adding large numbers with small numbers will cause problems as the information from the small value will most likely be rounded orr. b. Consider the following difference equation: Pn+1 = apn + pn-1 n = 1,2,3,... PO, P1 are given. (7) (i) For certain conditions on a and b, the general form of the solution to (7) is Pn = 1 + 215 (8) Determine the conditions on a and b so that (8) is valid. Also determine ci, C2, 11, and 12 in terms of Po, P1, a, and b. (ii) Write a computer program to implement (7). Try your program with a = 2.0, b = 1.25, po = 1.0, and pi = -0.5. What results do you get and how do they compare with expected analytical results? What if po and pi are multiplied by 1 + for = 10" where r = 0,1,2,...? What are the analytical expected results? How can the computer results be explained from the perspective of "propagation of error" due to round off error? HINT: find A1, 12, C, and C2 corresponding to the given a, b, Po, and p1; what if Po and/or P are slightly perturbed