Diffrential Equations

In this post, I'll introduce about Diffrential Equations. 

First-order differential equations Reference: Boyce and DiPrima, Chapter 2 The general first-order differential equation for the function 𝑦 = 𝑦(π‘₯) is written as 𝑑𝑦 𝑑π‘₯ = 𝑓(π‘₯, 𝑦), (2.1) where 𝑓(π‘₯, 𝑦) can be any function of the independent variable π‘₯ and the dependent variable 𝑦. We first show how to determine a numerical solution of this equation, and then learn techniques for solving analytically some special forms of (2.1), namely, separable and linear first-order equations. 2.1 The Euler method view tutorial Although it is not always possible to find an analytical solution of (2.1) for 𝑦 = 𝑦(π‘₯), it is always possible to determine a unique numerical solution given an initial value 𝑦(π‘₯0) = 𝑦0, and provided 𝑓(π‘₯, 𝑦) is a well-behaved function. The differential equation (2.1) gives us the slope 𝑓(π‘₯0, 𝑦0) of the tangent line to the solution curve 𝑦 = 𝑦(π‘₯) at the point (π‘₯0, 𝑦0). With a small step size Ξ”π‘₯, the initial condition (π‘₯0, 𝑦0) can be marched forward in the x-coordinate to π‘₯ = π‘₯0 + Ξ”π‘₯, and along the tangent line using Euler’s method to obtain the y-coordinate 𝑦(π‘₯0 + Ξ”π‘₯) = 𝑦(π‘₯0) + Ξ”π‘₯𝑓(π‘₯0, 𝑦0). This solution (π‘₯0 + Ξ”π‘₯, 𝑦0 + Δ𝑦) then becomes the new initial condition and is marched forward in the x-coordinate another Ξ”π‘₯, and along the newly determined tangent line. For small enough Ξ”π‘₯, the numerical solution converges to the exact solution. 13 14 CHAPTER 2. FIRST-ORDER ODES 2.2 Separable equations view tutorial A first-order ode is separable if it can be written in the form 𝑔(𝑦) 𝑑𝑦 𝑑π‘₯ = 𝑓(π‘₯), 𝑦(π‘₯0) = 𝑦0, (2.2) where the function 𝑔(𝑦) is independent of π‘₯ and 𝑓(π‘₯) is independent of 𝑦. Integration from π‘₯0 to π‘₯ results in ∫︁ π‘₯ π‘₯0 𝑔(𝑦(π‘₯))𝑦 β€² (π‘₯)𝑑π‘₯ = ∫︁ π‘₯ π‘₯0 𝑓(π‘₯)𝑑π‘₯. The integral on the left can be transformed by substituting 𝑒 = 𝑦(π‘₯), 𝑑𝑒 = 𝑦 β€² (π‘₯)𝑑π‘₯, and changing the lower and upper limits of integration to 𝑦(π‘₯0) = 𝑦0 and 𝑦(π‘₯) = 𝑦. Therefore, ∫︁ 𝑦 𝑦0 𝑔(𝑒)𝑑𝑒 = ∫︁ π‘₯ π‘₯0 𝑓(π‘₯)𝑑π‘₯, and since 𝑒 is a dummy variable of integration, we can write this in the equivalent form ∫︁ 𝑦 𝑦0 𝑔(𝑦)𝑑𝑦 = ∫︁ π‘₯ π‘₯0 𝑓(π‘₯)𝑑π‘₯. (2.3) A simpler procedure that also yields (2.3) is to treat 𝑑𝑦/𝑑π‘₯ in (2.2) like a fraction. Multiplying (2.2) by 𝑑π‘₯ results in 𝑔(𝑦)𝑑𝑦 = 𝑓(π‘₯)𝑑π‘₯, which is a separated equation with all the dependent variables on the left-side, and all the independent variables on the right-side. Equation (2.3) then results directly upon integration. Example: Solve 𝑑𝑦 𝑑π‘₯ + 1 2 𝑦 = 3 2 , with 𝑦(0) = 2. We first manipulate the differential equation to the form 𝑑𝑦 𝑑π‘₯ = 1 2 (3 βˆ’ 𝑦), (2.4) and then treat 𝑑𝑦/𝑑π‘₯ as if it was a fraction to separate variables: 𝑑𝑦 3 βˆ’ 𝑦 = 1 2 𝑑π‘₯. We integrate the right-side from the initial condition π‘₯ = 0 to π‘₯ and the left-side from the initial condition 𝑦(0) = 2 to 𝑦. Accordingly, ∫︁ 𝑦 2 𝑑𝑦 3 βˆ’ 𝑦 = 1 2 ∫︁ π‘₯ 0 𝑑π‘₯. (2.5) 2.2. SEPARABLE EQUATIONS 15 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 x y dy/dx + y/2 = 3/2 Figure 2.1: Solution of the following ode: 𝑑𝑦 𝑑π‘₯ + 1 2 𝑦 = 3 2 . The integrals in (2.5) need to be done. Note that 𝑦(π‘₯) < 3 for finite π‘₯ or the integral on the left-side diverges. Therefore, 3 βˆ’ 𝑦 > 0 and integration yields βˆ’ ln (3 βˆ’ 𝑦) ]︀𝑦 2 = 1 2 π‘₯ ]οΈ€π‘₯ 0 , ln (3 βˆ’ 𝑦) = βˆ’ 1 2 π‘₯, 3 βˆ’ 𝑦 = 𝑒 βˆ’ 1 2 π‘₯ , 𝑦 = 3 βˆ’ 𝑒 βˆ’ 1 2 π‘₯ . Since this is our first nontrivial analytical solution, it is prudent to check our result. We do this by differentiating our solution: 𝑑𝑦 𝑑π‘₯ = 1 2 𝑒 βˆ’ 1 2 π‘₯ = 1 2 (3 βˆ’ 𝑦); and checking the initial conditions, 𝑦(0) = 3 βˆ’ 𝑒 0 = 2. Therefore, our solution satisfies both the original ode and the initial condition. Example: Solve 𝑑𝑦 𝑑π‘₯ + 1 2 𝑦 = 3 2 , with 𝑦(0) = 4. This is the identical differential equation as before, but with different initial conditions. We will jump directly to the integration step: ∫︁ 𝑦 4 𝑑𝑦 3 βˆ’ 𝑦 = 1 2 ∫︁ π‘₯ 0 𝑑π‘₯. 16 CHAPTER 2. FIRST-ORDER ODES Now 𝑦(π‘₯) > 3, so that 𝑦 βˆ’ 3 > 0 and integration yields βˆ’ ln (𝑦 βˆ’ 3)]︀𝑦 4 = 1 2 π‘₯ ]οΈ€π‘₯ 0 , ln (𝑦 βˆ’ 3) = βˆ’ 1 2 π‘₯, 𝑦 βˆ’ 3 = 𝑒 βˆ’ 1 2 π‘₯ , 𝑦 = 3 + 𝑒 βˆ’ 1 2 π‘₯ . The solution curves for a range of initial conditions is presented in Fig. 2.1. All solutions have a horizontal asymptote at 𝑦 = 3 at which 𝑑𝑦/𝑑π‘₯ = 0. For 𝑦(0) = 𝑦0, the general solution can be shown to be 𝑦(π‘₯) = 3+(𝑦0βˆ’3) exp(βˆ’π‘₯/2). Example: Solve 𝑑𝑦 𝑑π‘₯ = 2 cos 2π‘₯ 3+2𝑦 , with 𝑦(0) = βˆ’1. (i) For what values of π‘₯ > 0 does the solution exist? (ii) For what value of π‘₯ > 0 is 𝑦(π‘₯) maximum? Notice that the solution of the ode may not exist when 𝑦 = βˆ’3/2, since 𝑑𝑦/𝑑π‘₯ β†’ ∞. We separate variables and integrate from initial conditions: (3 + 2𝑦)𝑑𝑦 = 2 cos 2π‘₯ 𝑑π‘₯ ∫︁ 𝑦 βˆ’1 (3 + 2𝑦)𝑑𝑦 = 2 ∫︁ π‘₯ 0 cos 2π‘₯ 𝑑π‘₯ 3𝑦 + 𝑦 2 ]︀𝑦 βˆ’1 = sin 2π‘₯ ]οΈ€π‘₯ 0 𝑦 2 + 3𝑦 + 2 βˆ’ sin 2π‘₯ = 0 𝑦± = 1 2 [βˆ’3 Β± √ 1 + 4 sin 2π‘₯]. Solving the quadratic equation for 𝑦 has introduced a spurious solution that does not satisfy the initial conditions. We test: 𝑦±(0) = 1 2 [βˆ’3 Β± 1] = {οΈ‚ -1; -2. Only the + root satisfies the initial condition, so that the unique solution to the ode and initial condition is 𝑦 = 1 2 [βˆ’3 + √ 1 + 4 sin 2π‘₯]. (2.6) To determine (i) the values of π‘₯ > 0 for which the solution exists, we require 1 + 4 sin 2π‘₯ β‰₯ 0, or sin 2π‘₯ β‰₯ βˆ’ 1 4 . (2.7) Notice that at π‘₯ = 0, we have sin 2π‘₯ = 0; at π‘₯ = πœ‹/4, we have sin 2π‘₯ = 1; at π‘₯ = πœ‹/2, we have sin 2π‘₯ = 0; and at π‘₯ = 3πœ‹/4, we have sin 2π‘₯ = βˆ’1 We therefore need to determine the value of π‘₯ such that sin 2π‘₯ = βˆ’1/4, with π‘₯ in the range πœ‹/2 < π‘₯ < 3πœ‹/4. The solution to the ode will then exist for all π‘₯ between zero and this value. 2.3. LINEAR EQUATIONS 17 0 0.5 1 1.5 βˆ’1.6 βˆ’1.4 βˆ’1.2 βˆ’1 βˆ’0.8 βˆ’0.6 βˆ’0.4 βˆ’0.2 0 x y (3+2y) dy/dx = 2 cos 2x, y(0) = βˆ’1 Figure 2.2: Solution of the following ode: (3 + 2𝑦)𝑦 β€² = 2 cos 2π‘₯, 𝑦(0) = βˆ’1. To solve sin 2π‘₯ = βˆ’1/4 for π‘₯ in the interval πœ‹/2 < π‘₯ < 3πœ‹/4, one needs to recall the definition of arcsin, or sinβˆ’1 , as found on a typical scientific calculator. The inverse of the function 𝑓(π‘₯) = sin π‘₯, βˆ’πœ‹/2 ≀ π‘₯ ≀ πœ‹/2 is denoted by arcsin. The first solution with π‘₯ > 0 of the equation sin 2π‘₯ = βˆ’1/4 places 2π‘₯ in the interval (πœ‹, 3πœ‹/2), so to invert this equation using the arcsine we need to apply the identity sin (πœ‹ βˆ’ π‘₯) = sin π‘₯, and rewrite sin 2π‘₯ = βˆ’1/4 as sin (πœ‹ βˆ’ 2π‘₯) = βˆ’1/4. The solution of this equation may then be found by taking the arcsine, and is πœ‹ βˆ’ 2π‘₯ = arcsin (βˆ’1/4), or π‘₯ = 1 2 (οΈ‚ πœ‹ + arcsin 1 4 )οΈ‚ . Therefore the solution exists for 0 ≀ π‘₯ ≀ (πœ‹ + arcsin (1/4)) /2 = 1.6971 . . . , where we have used a calculator value (computing in radians) to find arcsin(0.25) = 0.2527 . . . . At the value (π‘₯, 𝑦) = (1.6971 . . . , βˆ’3/2), the solution curve ends and 𝑑𝑦/𝑑π‘₯ becomes infinite. To determine (ii) the value of π‘₯ at which 𝑦 = 𝑦(π‘₯) is maximum, we examine (2.6) directly. The value of 𝑦 will be maximum when sin 2π‘₯ takes its maximum value over the interval where the solution exists. This will be when 2π‘₯ = πœ‹/2, or π‘₯ = πœ‹/4 = 0.7854 . . . . The graph of 𝑦 = 𝑦(π‘₯) is shown in Fig. 2.2. 2.3 Linear equations view tutorial 18 CHAPTER 2. FIRST-ORDER ODES The first-order linear differential equation (linear in 𝑦 and its derivative) can be written in the form 𝑑𝑦 𝑑π‘₯ + 𝑝(π‘₯)𝑦 = 𝑔(π‘₯), (2.8) with the initial condition 𝑦(π‘₯0) = 𝑦0. Linear first-order equations can be integrated using an integrating factor πœ‡(π‘₯). We multiply (2.8) by πœ‡(π‘₯), πœ‡(π‘₯) [οΈ‚ 𝑑𝑦 𝑑π‘₯ + 𝑝(π‘₯)𝑦 ]οΈ‚ = πœ‡(π‘₯)𝑔(π‘₯), (2.9) and try to determine πœ‡(π‘₯) so that πœ‡(π‘₯) [οΈ‚ 𝑑𝑦 𝑑π‘₯ + 𝑝(π‘₯)𝑦 ]οΈ‚ = 𝑑 𝑑π‘₯[πœ‡(π‘₯)𝑦]. (2.10) Equation (2.9) then becomes 𝑑 𝑑π‘₯[πœ‡(π‘₯)𝑦] = πœ‡(π‘₯)𝑔(π‘₯). (2.11) Equation (2.11) is easily integrated using πœ‡(π‘₯0) = πœ‡0 and 𝑦(π‘₯0) = 𝑦0: πœ‡(π‘₯)𝑦 βˆ’ πœ‡0𝑦0 = ∫︁ π‘₯ π‘₯0 πœ‡(π‘₯)𝑔(π‘₯)𝑑π‘₯, or 𝑦 = 1 πœ‡(π‘₯) (οΈ‚ πœ‡0𝑦0 + ∫︁ π‘₯ π‘₯0 πœ‡(π‘₯)𝑔(π‘₯)𝑑π‘₯)οΈ‚ . (2.12) It remains to determine πœ‡(π‘₯) from (2.10). Differentiating and expanding (2.10) yields πœ‡ 𝑑𝑦 𝑑π‘₯ + π‘πœ‡π‘¦ = π‘‘πœ‡ 𝑑π‘₯𝑦 + πœ‡ 𝑑𝑦 𝑑π‘₯; and upon simplifying, π‘‘πœ‡ 𝑑π‘₯ = π‘πœ‡. (2.13) Equation (2.13) is separable and can be integrated: ∫︁ πœ‡ πœ‡0 π‘‘πœ‡ πœ‡ = ∫︁ π‘₯ π‘₯0 𝑝(π‘₯)𝑑π‘₯, ln πœ‡ πœ‡0 = ∫︁ π‘₯ π‘₯0 𝑝(π‘₯)𝑑π‘₯, πœ‡(π‘₯) = πœ‡0 exp (οΈ‚βˆ«οΈ π‘₯ π‘₯0 𝑝(π‘₯)𝑑π‘₯)οΈ‚ . Notice that since πœ‡0 cancels out of (2.12), it is customary to assign πœ‡0 = 1. The solution to (2.8) satisfying the initial condition 𝑦(π‘₯0) = 𝑦0 is then commonly written as 𝑦 = 1 πœ‡(π‘₯) (οΈ‚ 𝑦0 + ∫︁ π‘₯ π‘₯0 πœ‡(π‘₯)𝑔(π‘₯)𝑑π‘₯)οΈ‚ , with πœ‡(π‘₯) = exp (οΈ‚βˆ«οΈ π‘₯ π‘₯0 𝑝(π‘₯)𝑑π‘₯)οΈ‚ the integrating factor. This important result finds frequent use in applied mathematics. 2.3. LINEAR EQUATIONS 19 Example: Solve 𝑑𝑦 𝑑π‘₯ + 2𝑦 = 𝑒 βˆ’π‘₯ , with 𝑦(0) = 3/4. Note that this equation is not separable. With 𝑝(π‘₯) = 2 and 𝑔(π‘₯) = 𝑒 βˆ’π‘₯ , we have πœ‡(π‘₯) = exp (οΈ‚βˆ«οΈ π‘₯ 0 2𝑑π‘₯)οΈ‚ = 𝑒 2π‘₯ , and 𝑦 = 𝑒 βˆ’2π‘₯ (οΈ‚ 3 4 + ∫︁ π‘₯ 0 𝑒 2π‘₯ 𝑒 βˆ’π‘₯ 𝑑π‘₯)οΈ‚ = 𝑒 βˆ’2π‘₯ (οΈ‚ 3 4 + ∫︁ π‘₯ 0 𝑒 π‘₯ 𝑑π‘₯)οΈ‚ = 𝑒 βˆ’2π‘₯ (οΈ‚ 3 4 + (𝑒 π‘₯ βˆ’ 1))οΈ‚ = 𝑒 βˆ’2π‘₯ (οΈ‚ 𝑒 π‘₯ βˆ’ 1 4 )οΈ‚ = 𝑒 βˆ’π‘₯ (οΈ‚ 1 βˆ’ 1 4 𝑒 βˆ’π‘₯ )οΈ‚ . Example: Solve 𝑑𝑦 𝑑π‘₯ βˆ’ 2π‘₯𝑦 = π‘₯, with 𝑦(0) = 0. This equation is separable, and we solve it in two ways. First, using an integrating factor with 𝑝(π‘₯) = βˆ’2π‘₯ and 𝑔(π‘₯) = π‘₯: πœ‡(π‘₯) = exp (οΈ‚ βˆ’2 ∫︁ π‘₯ 0 π‘₯𝑑π‘₯)οΈ‚ = 𝑒 βˆ’π‘₯ 2 , and 𝑦 = 𝑒 π‘₯ 2 ∫︁ π‘₯ 0 π‘₯π‘’βˆ’π‘₯ 2 𝑑π‘₯. The integral can be done by substitution with 𝑒 = π‘₯ 2 , 𝑑𝑒 = 2π‘₯𝑑π‘₯: ∫︁ π‘₯ 0 π‘₯π‘’βˆ’π‘₯ 2 𝑑π‘₯ = 1 2 ∫︁ π‘₯ 2 0 𝑒 βˆ’π‘’ 𝑑𝑒 = βˆ’ 1 2 𝑒 βˆ’π‘’ ]οΈ€π‘₯ 2 0 = 1 2 (︁ 1 βˆ’ 𝑒 βˆ’π‘₯ 2 )︁ . Therefore, 𝑦 = 1 2 𝑒 π‘₯ 2 (︁ 1 βˆ’ 𝑒 βˆ’π‘₯ 2 )︁ = 1 2 (︁ 𝑒 π‘₯ 2 βˆ’ 1 )︁ . 20 CHAPTER 2. FIRST-ORDER ODES Second, we integrate by separating variables: 𝑑𝑦 𝑑π‘₯ βˆ’ 2π‘₯𝑦 = π‘₯, 𝑑𝑦 𝑑π‘₯ = π‘₯(1 + 2𝑦), ∫︁ 𝑦 0 𝑑𝑦 1 + 2𝑦 = ∫︁ π‘₯ 0 π‘₯𝑑π‘₯, 1 2 ln (1 + 2𝑦) = 1 2 π‘₯ 2 , 1 + 2𝑦 = 𝑒 π‘₯ 2 , 𝑦 = 1 2 (︁ 𝑒 π‘₯ 2 βˆ’ 1 )︁ . The results from the two different solution methods are the same, and the choice of method is a personal preference.

Komentar

Postingan populer dari blog ini

Finance in Math

Diffrentiation and integration

Any Formulas In the Mathematics