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

Tahun 2018, tahun untuk memulai hal yang baru

Somtheing New

Any Formulas In the Mathematics