Chabot Mathematics §9.2 1st Order ODEs Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Chabot College Mathematics 1 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Review § 9.1 Any QUESTIONS About • §9.1 → Variable Separable Ordinary Differential Equations Any QUESTIONS About HomeWork • §9.1 → HW-13 Chabot College Mathematics 2 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx §9.2 Learning Goals Solve first-order linear differential equations and • Initial Value Problems (IVP) • Boundary Value Problems (BVP) Explore compartmental analysis with applications to finance, drug administration, and dilution models. Chabot College Mathematics 3 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx FirstOrder, Linear ODE The General form of a First Order, Linear Ordinary Differential Equation dy pt y qt dt IVP dy px y qx dx BVP Solve the General Equation with Integrating Factor p u du • Let I u e 1 • Then the ODE yu I u qu du C Solution I u Chabot College Mathematics 4 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Quick Example dy Find Solution to ODE: +y=x dx The Integrating 1 dx ò x I(x) = e =e Factor → Thus the 1é x y = x ë ò xe dx + C ùû Solution e 1é x x = x ë xe - e + Cùû e x 1 Ce Chabot College Mathematics 5 x Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Solve dy Find the Particular dy yt t Solution for ODE: dt t 2 1 Subject to Initial Value: yt 0 1.000 SOLUTION: Note that this Eqn is NOT Variable Separable, so ReWrite in General Form dy p (u ) y q (u ) du dy t 2 y t dt t 1 pt Chabot College Mathematics 6 dt t yt t 1 2 qt Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Solve dy p ( t ) dt Then the Integrating t 1 dt I t e e Factor: Now Let u t 2 1 du du t dt Then 2t dt 2 Using u and du in integrating Factor t 2 I t e t dt t 2 1 e du 2 u e 1 du 2 u e 1 ln u 2 e 1 ln t 2 1 2 Now t2+1 is always positive so: I t e 1 ln t 2 1 2 Chabot College Mathematics 7 e 1 ln t 2 1 2 e ln t 1 2 e ln 1 2 dt t yt t 1 2 t 2 1 t 2 1 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Solve dy dt t yt t 1 2 Using this Integrating Factor find: y 1 1 t2 t 2 1 t dt C Using u and du from before y 1 1 t2 Chabot College Mathematics 8 1 du t 1 t dt C u 2 C u 1 1 u du C u 2 2 1 12 u 1 3/ 2 3 u C Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Solve dy dt t yt t 1 2 Then the General Solution by Back SubStitution 1 y 12 u ReCall the y0 1.00 Initial Condition (IC) Using IC 1 = 1 0 2 +1 + C 02 +1 -1/2 ( ) ( ) 3 in Solution 2 C 3 Chabot College Mathematics 9 1 2 1 2 1 3/ 2 1 1 1 2 2 3 u C 3 u Cu 3 t 1 C t 1 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Solve dy Finally the Full General Solution -1/2 1 2 2 2 y = ( t +1) + ( t +1) . 3 3 MTH16 • Bruce Mayer, PE 8 7 y = f(t) 6 5 4 3 2 1 MTH15 Quick Plot BlueGreenBkGnd 130911.m 0 Chabot College Mathematics 10 1 2 3 t dt t yt t 1 2 4 5 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx I(x) → How Does it Work? Multiplication of Both Sides of the ODE by I(x) changes ODE appearance dy I x p x y q x dx dy I x I x px y I x qx dx For Solution This must be of the form d I x y I x qx dx Chabot College Mathematics 11 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx I(x) → How Does it Work? So that by the PRODUCT Rule d dy dI x I x y I x y dx dx dx ReCall the I(x) multiplied ODE L.H.S. dy I x I x px y I x qx dx Thus by Correspondence need dI x I x px dx Chabot College Mathematics 12 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx I(x) → How Does it Work? Then by Substitution dy dy dI x d I x I x p x y I x y I x y dx dx dx dx Then the I(x) multiplied ODE dy d d I x y I x I x p x y I x qx I x y dx dx dx Which is VARIABLE SEPARABLE d I x y d I x y I x qx dx I x qx dx 1 dx 1 Chabot College Mathematics 13 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx I(x) → How Does it Work? Or d I x y I x qx dx 1 d I x y I x qx dx Then Let: u I x y Using u in the Variable Separated ODE 1 d u I x qx dx BackSubbing for u u C1 I x qx dx u C1 I x y C1 I x qx dx Let −C1 = +C I x qx dx C y 1 y I x qx dx C I x Chabot College Mathematics 14 I x Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx 1 No Need for Memorization Do Need to 1 y I x qx dx C Memorize I x Only need to find a good I(x) to multiply the ODE so that by the PRODUCT Rule the L.H.S.: dy d I x y dy I x px y I x I x px y dx dx dx Then can Separate the Variables and Integrate 1 d I x y I x qx dx Chabot College Mathematics 15 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Key to Integrating Factor Need dI x I x px dx Then ln I x px dx e ln I x e p x dx • Assumes, withOUT loss of generality, that the Constant of Integration is Zero So Finally the Integrating-Factor Formula I x e Chabot College Mathematics 16 p x dx Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Key to Integrating Factor dI x For Solution Need: I x px dx Next Integrate this ODE dI x 1 px dx dI x px dx I x I x Then ln I x px dx elnI x e p x dx • Assumes, withOUT loss of generality, that the Constant of Integration is Zero So Finally the Integrating-Factor Formula Chabot College Mathematics 17 I x e p x dx Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time A 60-gallon barrel containing 20 gallons of simple syrup at 1:1 sugar-to-water ratio is being stirred and filled with pure sugar at a rate of 1 gallon per minute. Unfortunately, a crack in the bottom of the barrel is leaking solution at a rate of 4 oz per minute. After how long will there be 40 gallons of Pure Sugar in the barrel? Chabot College Mathematics 18 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time SOLUTION: First to set up an equation to model the quantity of sugar in the barrel over time, Next solve this eqn and find the time at which the desired quantity occurs. A general Mass Balance for a “Control Volume” • Storage Rate = InFlow InFlow − OutFlow Chabot College Mathematics 19 Storage OutFlow Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time The Pure Sugar Mass Balance Statement æ rate of ö æ rate of ö æ rate of ö ç ÷ ç ÷ ç ÷ ç change in ÷ = çsugar ÷ - çsugar ÷ ç ÷ ç ÷ ç ÷ èsugar amt. ø è inflow ø è outflowø The Model above accounts for modeling the change in pure-sugar quantity, the inflow is 1 Gallon per Minute (1 gpm) or 128 oz per minute. Chabot College Mathematics 20 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time The outflow is of the mixed solution, so it leaks at a rate of 4 oz/min, with total quantity of sugar Q(t) and total quantity of solution equal to: V s 20 gal inflow of solution outflow of solution 20 128 128t 4t So the concentration of OutFlowing Syrup: Chabot College Mathematics 21 Q(t ) 20 124t Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time Now we express the differential equation for the rate of change in sugar quantity: æ rate of ö æ rate of ö æ rate of ö ç ÷ ç ÷ ç ÷ ç change in ÷ = çsugar ÷ - çsugar ÷ ç ÷ ç ÷ ç ÷ sugar amt. inflow outflow è ø è ø è ø dQ Q 128 4 dt 20 124t This ODE is first-order and linear, so it can solved using the general strategy. Chabot College Mathematics 22 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time Calculate the Integrating dQ 4 Q 128 Factor for the ODE dt 20 124t I(t) = e 4 dt ò 20+124t =e 1 31 ln 5+31t (5 31t ) 1 31 Then the form of the solution 1 1 31 é ù y= ×128 dt + C 1 ë ò (5+ 31t) û (5+ 31t) 31 é128 31 ù 32 1 31 y= × (5+ 31t) + Cú 1 ê û (5+ 31t) 31 ë 31 32 C y 20 124t 1 (5 31t ) 31 Chabot College Mathematics 23 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time Use the IC to find the Constant Value • Initially there is a 1:1 ratio of water to sugar, so exactly half of the 20 gallons, or 10 gallons (1280 oz), is sugar. Use this Data-Point to find the value of C: C y = 20 +124t + 1 (5 + 31t) 31 C 1280 20 124 0 5 31 0 1 31 C 1260 5 1327.14 1 31 Chabot College Mathematics 24 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time Finally, find the time at which there are 40 gallons of sugar in the barrel, which happens when y = 40*128 = 5120 oz. 1327.14 y = 20 +124t + 1 (5 + 31t) 31 1327.14 5120 = 20 +124t + 1 (5+ 31t) 31 1327.14 0 5100 124t 1 (5 31t ) 31 Chabot College Mathematics 25 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Example Dilution over Time This a transcendental (NonAlgebraic) eqn for which there is NO exact solution Solve using the MuPAD Computer Algebra System (CAS): t 32.568 In other words, after about 32.6 minutes of pouring and mixing, there will be 20 gallons of pure sugar in the barrel. Chabot College Mathematics 26 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx MuPAD Calculation tsoln := 124*t - 5100 + 1327.14/(5+31*t)^(1/31) numeric::solve(tsoln) Chabot College Mathematics 27 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx WhiteBoard Work Problems From §9.2 • P51 Glacier Ice Removal Rate Chabot College Mathematics 28 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx All Done for Today Linear st 1 Order ODEs Chabot College Mathematics 29 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Chabot Mathematics Appendix r s r s r s 2 2 Bruce Mayer, PE Licensed Electrical & Mechanical Engineer 2a – Chabot College Mathematics 30 BMayer@ChabotCollege.edu 2b Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Chabot College Mathematics 31 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Chabot College Mathematics 32 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Chabot College Mathematics 33 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx Chabot College Mathematics 34 Bruce Mayer, PE BMayer@ChabotCollege.edu • MTH16_Lec-14_Sp14_sec_9-2_1st_Linear_ODEs.pptx