Math 128A Spring 2003 Week 11 Solutions Burden & Faires 5.6: 1b, 3b, 7, 9, 12 Burden & Faires 5.7: 1b, 3b, 5 Burden & Faires 5.8: 1b, 3b, 4 Burden & Faires 5.6. Multistep Methods 1. Use all the Adams-Bashforth methods to approximate the solutions to the following initial-value problem. In each case use exact starting values, and compare the results to the actual values. y = 1 + (t y) 2, 2 t 3, y(2) = 1, with h = 0.2; actual solution y(t) = t + 1 1 t. The exact starting values are given by: y(t 0 ) = 1.0000000 y(t 1 ) = 1.1909091 y(t 2 ) = 1.3666667 y(t 3 ) = 1.5307692 y(t 4 ) = 1.6857143 For the Adams-Bashforth two-step method, we have: w i+1 = w i + h 2 [3f(t i, w i ) f(t i 1, w i 1 )] for i 1. Thus we get: w 2 = 1.3648760 w 3 = 1.5281685 w 4 = 1.6826555 w 5 = 1.8300568 w 6 = 1.9716512 w 7 = 2.1084333 w 8 = 2.2411849 w 9 = 2.3705285 w 10 = 2.4969658. For the Adams-Bashforth three-step method, we have: w i+1 = w i + h 12 [23f(t i, w i ) 16f(t i 1, w i 1 ) + 5f(t i 2, w i 2 )] 1
for i 2. Thus we get: w 3 = 1.5312423 w 4 = 1.6863578 w 5 = 1.8341075 w 6 = 1.9758148 w 7 = 2.1125880 w 8 = 2.2452510 w 9 = 2.3744624 w 10 = 2.5007431. For the Adams-Bashforth four-step method, we have: w 3 = 1.5307692 w i+1 = w i + h 24 [55f(t i, w i ) 59f(t i 1, w i 1 ) + 37f(t i 2, w i 2 ) 9f(t i 3, w i 3 )] for i 3. Thus we get: w 3 = 1.5307692 w 4 = 1.6855637 w 5 = 1.8331397 w 6 = 1.9747539 w 7 = 2.1115202 w 8 = 2.2441958 w 9 = 2.3734479 w 10 = 2.4997728 For the Adams-Bashforth five-step method, we have: w 3 = 1.5307692 w 4 = 1.6857143 w i+1 = w i + h 720 [1901f(t i, w i ) 2774f(t i 1, w i 1 ) + 2616f(t i 2, w i 2 ) 1274f(t i 3, w i 3 ) + 251f(t i 4, w i 4 )] 2
for i 4. Thus we get: w 3 = 1.5307692 w 4 = 1.6857143 w 5 = 1.8333882 w 6 = 1.9750671 w 7 = 2.1118568 w 8 = 2.2445255 w 9 = 2.3737733 w 10 = 2.5000769 The actual results are as follows: y(t 0 ) = 1.0000000 y(t 1 ) = 1.1909091 y(t 2 ) = 1.3666667 y(t 3 ) = 1.5307692 y(t 4 ) = 1.6857143 y(t 5 ) = 1.8333333 y(t 6 ) = 1.9750000 y(t 7 ) = 2.1117647 y(t 8 ) = 2.2444444 y(t 9 ) = 2.3736842 y(t 10 ) = 2.5000000 3. Use each of the Adams-Bashforth methods to approximate the solution to the following initial-value problem. In each case use starting values obtained from the Runge-Kutta method of order four. Compare the results to the actual values. y = 1 + y/t + (y/t) 2, 1 t 3, y(1) = 0, with h = 0.2; actual solution y(t) = t tan(ln t). The Runge-Kutta method starting values are given by: y(t 0 ) = 0.0000000 y(t 1 ) = 0.2212428 y(t 2 ) = 0.4896817 y(t 3 ) = 0.8127527 y(t 4 ) = 1.1994386 Thus applying the methods, we get the results: 3
t i 2-step 3-step 4-step 5-step exact 1.0 0.0000000 0.0000000 0.0000000 0.0000000 0.0000000 1.2 0.2212457 0.2212457 0.2212457 0.2212457 0.2212428 1.4 0.4867550 0.4896842 0.4896842 0.4896842 0.4896817 1.6 0.8054881 0.8124317 0.8127522 0.8127522 0.8127527 1.8 1.1856931 1.1982110 1.1990422 1.1994320 1.1994386 2.0 1.6377944 1.6584313 1.6603060 1.6613179 1.6612818 2.2 2.1753785 2.2079987 2.2117448 2.2134792 2.2135018 2.4 2.8163947 2.8667672 2.8735320 2.8762776 2.8765514 2.6 3.5849181 3.6617484 3.6733266 3.6777236 3.6784753 2.8 4.5138420 4.6305275 4.6498937 4.6570033 4.6586651 3.0 5.6491203 5.8268008 5.8589944 5.8706101 5.8741000 7. The initial-value problem has solution y = e y, 0 t 0.20, y(0) = 1 y(t) = 1 ln(1 et). Applying the three-step Adams-Moulton method to this problem is equivalent to finding the fixed point w i+1 of g(w) = w i + h 24 [9ew + 19e wi 5e wi 1 + e wi 2 ]. a. With h = 0.01, obtain w i+1 by functional iteration for i = 2,..., 19 using exact starting values w 0, w 1, and w 2. At each step use w i to initially approximate w i+1. Will Newton s method speed the convergence over functional iteration? Proof. a. Using functional iteration we get: Using Newton s method, we get: t i w i iterations y(t i ) 0.00 1.0000000 0 1.0000000 0.01 1.0275591 0 1.0275591 0.02 1.0558993 0 1.0558993 0.03 1.0850661 4 1.0850661 0.04 1.1151093 4 1.1151093 0.05 1.1460831 4 1.1460831 0.06 1.1780471 4 1.1780470 0.07 1.2110665 4 1.2110664 0.08 1.2452136 4 1.2452135 0.09 1.2805681 4 1.2805679 0.10 1.3172184 4 1.3172182 0.11 1.3552633 4 1.3552631 0.12 1.3948131 4 1.3948128 0.13 1.4359917 4 1.4359913 0.14 1.4789390 4 1.4789386 0.15 1.5238140 4 1.5238134 0.16 1.5707977 4 1.5707970 0.17 1.6200982 4 1.6200973 0.18 1.6719560 4 1.6719548 0.19 1.7266507 4 1.7266493 0.20 1.7845111 4 1.7845092 4
t i w i iterations y(t i ) 0.00 1.0000000 0 1.0000000 0.01 1.0275591 0 1.0275591 0.02 1.0558993 0 1.0558993 0.03 1.0850661 3 1.0850661 0.04 1.1151093 3 1.1151093 0.05 1.1460831 3 1.1460831 0.06 1.1780471 3 1.1780470 0.07 1.2110665 3 1.2110664 0.08 1.2452136 3 1.2452135 0.09 1.2805681 3 1.2805679 0.10 1.3172184 3 1.3172182 0.11 1.3552633 3 1.3552631 0.12 1.3948131 3 1.3948128 0.13 1.4359917 3 1.4359913 0.14 1.4789390 3 1.4789386 0.15 1.5238140 3 1.5238134 0.16 1.5707977 3 1.5707970 0.17 1.6200983 3 1.6200973 0.18 1.6719560 3 1.6719548 0.19 1.7266508 3 1.7266493 0.20 1.7845111 3 1.7845092 So, with Newton s method, one less iteration is necessary at each step. 9. a. Derive Eq. (5.32) by using the Lagrange form of the interpolating polynomial. Derive Eq. (5.34) by using Newton s backward-difference form of the interpolating polynomial. a. Letting P (t) be the Lagrange form of the interpolating polynomial, we calculate: ti+1 y(t i+1 ) y(t i ) + t i ti+h P (t) dt [ (f(ti, y(t i )) f(t i 1, y(t i 1 )))t = y(t i ) + t i h + f(t ] i, y(t i ))h + f(t i 1, y(t i 1 ))t i f(t i, y(t i ))t i dt h = y(t i ) + 1 2h (f(t i, y(t i )) f(t i 1, y(t i 1 ))) ( (t i + h) 2 t 2 ) i + f(ti, y(t i ))h +f(t i 1, y(t i 1 ))t i f(t i, y(t i ))t i = y(t i ) + h 2 (3f(t i, y(t i )) f(t i 1, y(t i 1 ))) Letting P (t) be Newton s backward-difference form of the interpolating polynomial, we cal- 5
culate: ti+1 y(t i+1 ) y(t i ) + t i 3 = y(t i ) + k=0 3 ( ) ( 1) k s k f(t k i, y(t i ))h ds k=0 k f(t i, y(t i ))h( 1) k 1 0 ( ) s ds k [ = y(t i ) + h f(t i, y(t i )) + 1 2 f(t i, y(t i )) + 5 = y(t i ) + h { f(t i, y(t i )) + 1 2 [f(t i, y(t i )) f(t i 1, y(t i 1 ))] 12 2 f(t i, y(t i )) + 3 ] 8 3 f(t i, y(t i )) + 5 12 [f(t i, y(t i )) 2f(t i 1, y(t i 1 )) + f(t i 2, y(t i 2 ))] + 3 } 8 [f(t i, y(t i )) 3f(t i 1, y(t i 1 )) + 3f(t i 2, y(t i 2 )) f(t i 3, y(t i 3 ))] = y(t i ) + h 24 [55f(t i, y(t i )) 59f(t i 1, y(t i 1 )) + 37f(t i 2, y(t i 2 )) 9f(t i 3, y(t i 3 ))] 12. Derive Simpson s method by applying Simpson s rule to the integral y(t i+1 ) y(t i 1 ) = ti+1 t i 1 f(t, y(t)) dt. y(t i+1 ) y(t i 1 ) = ti+1 t i 1 f(t, y(t)) dt h 3 [f(t i 1, y(t i 1 )) + 4f(t i, y(t i )) + f(t i+1, y(t i+1 ))] Burden & Faires 5.7. Variable Step-Size Multistep Methods 1. Use the Adams Variable Step-Size Predictor-Corrector Algorithm with tolerance TOL = 10 4, hmax = 0.25, and hmin = 0.025 to approximate the solution to the given initial-value problem. Compare the results to the actual values. y = 1 + (t y) 2, 2 t 3, y(2) = 1; actual solution y(t) = t + 1/(1 t). Applying the Adams Variable Step-Size Predictor-Corrector Algorithm, we get the following results: 6
t i w i h i y(t i ) 2.00000000 1.00000000 0.00000000 1.00000000 2.06250000 1.12132350 0.06250000 1.12132353 2.12500000 1.23611106 0.06250000 1.23611111 2.18750000 1.34539468 0.06250000 1.34539474 2.25000000 1.45000191 0.06250000 1.45000000 2.31250000 1.55059834 0.06250000 1.55059524 2.37500000 1.64773110 0.06250000 1.64772727 2.43750000 1.74185207 0.06250000 1.74184783 2.53110962 1.87799224 0.09360962 1.87798852 2.62471924 2.00923157 0.09360962 2.00922828 2.71832886 2.13637101 0.09360962 2.13636808 2.81193849 2.26004764 0.09360962 2.26004338 2.90554811 2.38076971 0.09360962 2.38076472 2.99915773 2.49895243 0.09360962 2.49894707 2.99936830 2.49921568 0.00021057 2.49921033 2.99957886 2.49947891 0.00021057 2.49947355 2.99978943 2.49974214 0.00021057 2.49973678 3.00000000 2.50000535 0.00021057 2.50000000 3. Use the Adams Variable Step-Size Predictor-Corrector Algorithm with TOL = 10 6 to approximate the solution to the following initial-value problem: y = 1 + y/t + (y/t) 2, 1 t 3, y(1) = 0; actual solution y(t) = t tan(ln t). Applying the Adams Variable Step-Size Predictor-Corrector Algorithm, we get the following results: t w h y(t) 1.00000000 0.00000000 0.00000000 0.00000000 1.03703921 0.03773348 0.03703921 0.03773348 1.07407841 0.07688780 0.03703921 0.07688780 1.11111762 0.11750963 0.03703921 0.11750962 1.14815683 0.15964398 0.03703921 0.15964397 1.18519603 0.20333499 0.03703921 0.20333497 1.22223524 0.24862649 0.03703921 0.24862645 1.25927444 0.29556249 0.03703921 0.29556244 1.29631365 0.34418760 0.03703921 0.34418754 1.33335286 0.39454733 0.03703921 0.39454726 1.37039206 0.44668843 0.03703921 0.44668835 1.40743127 0.50065911 0.03703921 0.50065903 1.44447048 0.55650930 0.03703921 0.55650921 1.48150968 0.61429086 0.03703921 0.61429076 1.51854889 0.67405779 0.03703921 0.67405768 1.55558810 0.73586642 0.03703921 0.73586631 1.59262730 0.79977565 0.03703921 0.79977552 1.62966651 0.86584708 0.03703921 0.86584694 1.66670572 0.93414529 0.03703921 0.93414514 1.70374492 1.00473798 0.03703921 1.00473782 1.74078413 1.07769626 0.03703921 1.07769609 7
t w h y(t) 1.77782333 1.15309479 0.03703921 1.15309460 1.81486254 1.23101209 0.03703921 1.23101189 1.85190175 1.31153076 0.03703921 1.31153054 1.88894095 1.39473775 0.03703921 1.39473752 1.92598016 1.48072467 0.03703921 1.48072442 1.96301937 1.56958804 0.03703921 1.56958777 2.00005857 1.66142969 0.03703921 1.66142940 2.03709778 1.75635706 0.03703921 1.75635675 2.07413699 1.85448361 0.03703921 1.85448328 2.11117619 1.95592923 0.03703921 1.95592886 2.14821540 2.06082065 0.03703921 2.06082026 2.18525460 2.16929198 0.03703921 2.16929156 2.22229381 2.28148519 0.03703921 2.28148474 2.25933302 2.39755070 0.03703921 2.39755020 2.29637222 2.51764797 0.03703921 2.51764743 2.33341143 2.64194621 0.03703921 2.64194563 2.37045064 2.77062509 0.03703921 2.77062447 2.40748984 2.90387557 0.03703921 2.90387489 2.44452905 3.04190073 0.03703921 3.04190000 2.48156826 3.18491677 0.03703921 3.18491598 2.51860746 3.33315406 0.03703921 3.33315320 2.55564667 3.48685829 0.03703921 3.48685736 2.59268587 3.64629174 0.03703921 3.64629073 2.62360638 3.78397753 0.03092051 3.78397647 2.65452689 3.92602442 0.03092051 3.92602332 2.68544740 4.07261602 0.03092051 4.07261487 2.71636790 4.22394689 0.03092051 4.22394566 2.74728841 4.38022329 0.03092051 4.38022199 2.77820892 4.54166415 0.03092051 4.54166276 2.80912943 4.70850200 0.03092051 4.70850052 2.84004993 4.88098407 0.03092051 4.88098249 2.86589042 5.02964820 0.02584049 5.02964655 2.89173091 5.18260036 0.02584049 5.18259865 2.91757139 5.34001213 0.02584049 5.34001036 2.94341188 5.50206466 0.02584049 5.50206279 2.96925237 5.66894925 0.02584049 5.66894729 2.99509285 5.84086817 0.02584049 5.84086610 2.99631964 5.84915884 0.00122679 5.84915677 2.99754643 5.85746136 0.00122679 5.85745929 2.99877321 5.86577576 0.00122679 5.86577369 3.00000000 5.87410206 0.00122679 5.87409998 5. An electrical circuit consists of a capacitor of constant capacitance C = 1.1 farads in series with a resistor of constant resistance R 0 = 2.1 ohms. A voltage E(t) = 110 sin t is applied at time t = 0. When the resistor heats up, the resistance becomes a function of the current i, and the differential equation for i(t) becomes ( 1 + 2k ) di i R 0 R(t) = R 0 + ki, where k = 0.9, dt + 1 R 0 C i = 1 R 0 C 8 de dt.
Find i(2), assuming that i(0) = 0. Running the Adams Variable Step-Size Predictor-Corrector Algorithm with tolerance 10 3 with minimum and maximum mesh size given by 0.001 and 0.5 respectively, we find that i(2) 8.211. Burden & Faires 5.8. Extrapolation Methods 1. Use the Extrapolation Algorithm with tolerance TOL = 10 4, hmax = 0.25, and hmin = 0.05 to approximate the solutions to the following initial-value problems. Compare the results to the actual values. y = 1 + (t y) 2, 2 t 3, y(2) = 1; actual solution y(t) = t + 1/(1 t). Applying the Extrapolation Algorithm, we get the following results: t i w i h i k i y(t i ) 2.25000000 1.44999987 0.25000000 3 1.45000000 2.50000000 1.83333321 0.25000000 3 1.83333333 2.75000000 2.17857133 0.25000000 3 2.17857143 3.00000000 2.49999993 0.25000000 3 2.50000000 3. Use the Extrapolation Algorithm with TOL = 10 6, hmax = 0.5, and hmin = 0.05 to approximate the solutions to the following initial-value problems. Compare the results to the actual values. y = 1 + y/t + (y/t) 2, 1 t 3, y(1) = 0; actual solution y(t) = t tan ln t. Applying the Extrapolation Algorithm, we get the following results: t i w i h i k i y(t i ) 1.50000000 0.64387537 0.50000000 4 0.64387533 2.00000000 1.66128182 0.50000000 5 1.66128176 2.50000000 3.25801550 0.50000000 5 3.25801536 3.00000000 5.87410027 0.50000000 5 5.87409998 4. Let P (t) be the number of individuals in a population at time t, measured in years. If the average birth rate b is constant and the average death rate d is proportional to the size of the population (due to overcrowding), then the growth rate of the population is given by the logistic equation dp (t) dt = bp (t) k[p (t)] 2, where d = kp (t). Suppose P (0) = 50, 976, b = 2.9 10 2, and k = 1.4 10 7. Find the population after 5 years. The population after 5 years is approximately 57.7998. 9