ENGI 3424 1. First Order ODEs Page 1-01 Ordinary Differential Equations Equations involving only one independent variable and one or more dependent variables, together with their derivatives with respect to the independent variable, are ordinary differential equations (ODEs). Similar equations involving derivatives and more than one independent variable are partial differential equations (to be studied in a later term). Contents: 1.1 1.2 1.3 1.4 1.5 First Order Separable ODEs Examples for First Order Separable ODEs First Order Linear ODEs Reduction of Order Numerical Methods for First Order First Degree ODEs Appendix [not examinable] 1.6 1.7 1.8 Exact First Order ODEs Integrating Factor Derivation of the General Solution of First Order Linear ODEs Additional Material: 1.9 Integration by Parts [Tutorial in Week 2 or 3] There is also a tutorial in Week 1 or 2 on partial fractions. That material will be posted on the web site for this course after the tutorial has taken place. ENGI 3424 1.1 1.1 – First Order Separable ODEs Page 1-02 Separation of Variables Example 1.1.1 Unconstrained population growth can be modelled by (current rate of increase) is proportional to (current population level). With x(t) = number in the population at time t, This is a first order, first degree ODE that is both linear and separable. The order of an ODE is that of the highest order derivative present. The degree of an ODE is the exponent of the highest order derivative present. An ODE is linear if each derivative that appears is raised to the power 1 and is not multiplied by any other derivative (but possibly by a function of the independent variable), that is, if the ODE is of the form n k 0 ak x dk y R x dx k A first order ODE is separable if it can be re-written in the form f (y) dy = g(x) dx The solution of a separable first order ODE follows from f y dy g x dx Solution of Example 1.1.1: ENGI 3424 1.1 – First Order Separable ODEs Page 1-03 Example 1.1.1 (continued) Example 1.1.2 One of the simplest constrained growth (or predator-prey) models assumes that the rate of increase in x, (the population as a fraction of the maximum population), is directly proportional to both the current population and the current level of resources (or room to grow). In turn, the level of resources is assumed to be complementary to the population: resources (1 x). This leads to the constrained population growth model dx k x 1 x dt Classification of this ODE: ENGI 3424 1.1 – First Order Separable ODEs Example 1.1.2 (continued) Page 1-04 ENGI 3424 1.1 – First Order Separable ODEs Example 1.1.2 (continued) Page 1-05 ENGI 3424 1.1 – First Order Separable ODEs Page 1-06 In this course, the only first order ODEs to be considered will have the general form M(x, y) dx + N(x, y) dy = 0 with the following classification: Type Separable Reducible to separable Exact Feature M(x, y) = f (x) g(y) and N(x, y) = h(x) k(y) M(tx, ty) = tn M(x, y) and N(tx, ty) = tn N(x, y) for the same n M N y x M/N = P(x)y R(x) or N/M = Q(y)x S(y) Bernoulli M/N = P(x)y R(x)yn or N/M = Q(y)x S(y)xn [Only the separable and linear types will be examinable.] Linear Example 1.1.3 Terminal Speed A particle falls under gravity from rest through a viscous medium such that the drag force is proportional to the square of the speed. Find the speed v(t) at any time t > 0 and find the terminal speed v. ENGI 3424 1.1 – First Order Separable ODEs Example 1.1.3 (continued) Page 1-07 ENGI 3424 1.1 – First Order Separable ODEs Example 1.1.3 (continued) Page 1-08 1.1 – First Order Separable ODEs ENGI 3424 Example 1.1.4 A block is sliding down a slope of angle α, as shown, under the influence of its weight, the normal reaction force and the dynamic friction (which consists of two components, a surface term that is proportional to the normal reaction force and an air resistance term that is proportional to the speed). The block starts sliding from rest at A. Find the distance s(t) travelled down the slope after any time t (until the block reaches B). AP = s(t) AB = L Friction = surface + air Starts at rest from A Forces down-slope: Separation of variables method: Page 1-09 ENGI 3424 1.1 – First Order Separable ODEs Example 1.1.4 (continued) Page 1-10 ENGI 3424 1.1 – First Order Separable ODEs Page 1-11 Example 1.1.4 (continued) The terminal speed v∞ is The object will not begin to move unless 3 1 and k , with 4 2 and the graphs of speed and For a 10 kg block sliding down a slope of angle 30°, with g ≈ 9.81 ms−2, the terminal speed is just over 24.51 ms−1 position are ENGI 3424 1.2 1.2 – First Order Separable ODEs Page 1-12 Examples for Separable First Order ODEs Orthogonal trajectories A family of curves in 2 can be represented by the ODE dy f x, y dx Any curve, whose intersection with any member of that family occurs at right angles, must satisfy the ODE Another family of curves, all of which intersect each member of the first family only at right angles, must also satisfy the ODE Example 1.2.1 Find the orthogonal trajectories to the family of curves xy = c 1.2 – First Order Separable ODEs ENGI 3424 Page 1-13 Example 1.2.2 Find the orthogonal trajectories to the equipotentials of the electric field, Q V x, y c, 4 r where r x2 y 2 . Lines of force and equipotential curves are examples of orthogonal trajectories. Taking the inverse case to Example 1.2.2, for a central force law, the lines of force are radial dy y lines y = k x. All of these lines satisfy the ODE . The equipotential curves dx x must then be solutions of the ODE dy x y2 x2 y dy x dx c dx y 2 2 The general solution can be re-written as x2 + y2 = r2 , which is clearly the equations of a family of concentric circles. ENGI 3424 1.2 – First Order Separable ODEs Page 1-14 Newton’s Law of Cooling If t = time, Θ(t) = temperature and Θf = ambient [surrounding] temperature, then the rate at which the temperature of an object decreases, when it is immersed in some other substance whose steady temperature is Θf , is proportional to the temperature difference: d k t f dt k 0 Example 1.2.3 An object is removed from boiling water (at 100°C) and is left in air at room temperature (20°C). After ten minutes, its temperature has fallen to 60°C. Find its temperature Θ(t). 1.2 – First Order Separable ODEs ENGI 3424 Page 1-15 Example 1.2.4 A right circular cylindrical tank is oriented with its axis of symmetry vertical. Its circular cross-sections have an area A (m2). Water enters the tank at the rate Q (m3s1). Water leaves through a hole, of area a , in the base of the tank. The initial height of the water is ho. Find the height h(t) and the steady-state height h. Torricelli: v 2 gh Change of volume: Change = IN OUT ENGI 3424 1.2 – First Order Separable ODEs Example 1.2.4 (continued) Page 1-16 1.3 – First Order Linear ODEs ENGI 3424 1.3 Page 1-17 First Order Linear ODEs The general form of a first order linear ordinary differential equation is dy P x y R x dx [or, in some cases, dx Q y x S y ] dy The derivation of the solution of a first order linear ODE requires knowledge of exact ODEs and integrating factors, which in turn require familiarity with partial differentiation (Chapter 4). Exact ODEs, integrating factors and the derivation of the solution of a first order linear ODE are presented in the appendix to this chapter. The general solution of y x e dy P x y R x is dx h x e h x R x dx C , where h x P x dx The arbitrary constant of integration in the expression for h(x) may be ignored safely. Let us verify that this is indeed a solution to First note that dh h x dx dy P x y R x : dx ENGI 3424 Example 1.3.1 Solve y' + 2y = 6ex 1.3 – First Order Linear ODEs Page 1-18 1.3 – First Order Linear ODEs ENGI 3424 Example 1.3.2 : Find the current i (t) flowing through this simple RL circuit at any time t. The electromotive force is sinusoidal: E(t) = Eosin t The voltage drop across the resistor is The voltage drop across the inductor is Therefore the ODE to be solved is The integrating factor is therefore A two-step integration by parts and some algebraic simplification lead to E eh R dt 2 o 2 e Rt / L R sin t L cos t R L Details: Page 1-19 1.3 – First Order Linear ODEs ENGI 3424 Page 1-20 Example 1.3.2 (continued) Introducing the phase angle , such that L = R tan , leads to R R2 L cos 2 and L R2 L sin 2 Also sin ωt cos δ − cos ωt sin δ ≡ sin(ωt − δ) Therefore Eo e Rt / L sin t e h R dt 2 R 2 L The general solution i t e h t e h t R t dt C then becomes i t Eo sin t R 2 L 2 A e Rt / L transient steady - state For most realistic circuits, the current reaches 99% of its steady state value in just a few microseconds. ENGI 3424 1.3 – First Order Linear ODEs Example 1.3.3 Find the general solution of the ODE y' − y = sinh x Therefore y eh eh R dx C Note: sinh x e x e x 2 Page 1-21 ENGI 3424 1.3 – First Order Linear ODEs Example 1.3.4 Solve the ODE 1 2 x e2 y dydx e2 y This ODE is neither separable nor linear for y as a function of x . However, dy 1 2 x e2 y e2 y dx Page 1-22 1.4 – Reduction of Order ENGI 3424 1.4 Page 1-23 Reduction of Order Occasionally a second order ordinary differential equation can be reduced to a linked pair of first order ordinary differential equations. If the ODE is of the form f (y", y', x) = 0 (that is, no y term), then the ODE becomes the pair of linked first order ODEs f (p', p, x) = 0 , p = y' If the ODE is of the form g (y", y', y) = 0 (that is, no x term), then the ODE becomes the pair of linked first order ODEs dp dy g p , p, y 0 , p dx dy where the chain rule d2y d dy dp dp dy dp p 2 dx dx dx dy dx dy dx Example 1.4.1 Find the general solution of the second order ordinary differential equation x y" + 2y' = 4x3 1.4 – Reduction of Order ENGI 3424 Page 1-24 Example 1.4.1 (continued) Note that the number of arbitrary constants of integration in the general solution matches the order of the ordinary differential equation. Example 1.4.2 2 d2y dy Solve . 2 dx dx This second order ODE can be solved by either of the two methods of reduction of order. dy Let p dx Method 1: The ODE becomes 1.4 – Reduction of Order ENGI 3424 Page 1-25 Example 1.4.2 (continued) Method 2: The ODE becomes Note that linear ODEs never generate singular solutions, but non-linear ODEs sometimes do generate singular solutions. ENGI 3424 1.4 – Reduction of Order Example 1.4.3 Solve y" = 2 y y' We need to quote some standard integrals: dx 1 x arctan C , 2 x a a a dx 1 C and 2 x x 2 dx 1 x arctanh C 2 x a a a 2 Page 1-26 ENGI 3424 Example 1.4.3 (continued) 1.4 – Reduction of Order Page 1-27 ENGI 3424 1.5 1.5 – First Order ODEs - Numerical Methods Page 1-28 Numerical Methods for First Order First Degree ODEs Euler’s Method dy f x, y and y x0 y0 , dx a simple method for finding the value of y at other values of x is to follow a sequence of tangent lines along the unknown family of solution curves y = y(x). At every point in the x-y plane the slope of the tangent line is known: f (x, y). Given an initial value problem ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-29 Example 1.5.1 Given that dy x y x 2 and y(0) = 1, estimate the value of y at x = 0.4 . dx We shall use Euler’s method with a step size of h = 0.1 . f (x, y) = xy + x2 . Euler’s method is well-suited to evaluation in a spreadsheet [see "www.engr.mun.ca/~ggeorge/3424/demos/ex151Euler.xls"] We require the value of y4 . Through techniques beyond the scope of this course - or using Maple software [see "www.engr.mun.ca/~ggeorge/3424/demos/ex151.mws"] - the exact solution to this initial value problem can be shown to be z 2 2 2 2 2 e t dt . y e x /2 1 erf x x , where erf z 2 0 2 The correct value of y(0.4) is 1.105 318 953 ... The Euler method has produced an error of more than 2.7% in the value of y. ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-30 Runge-Kutta (RK4) Method Many improvements on Euler’s original method have been proposed over the past two centuries, based on combinations of values of the slope of the tangent at several points in the neighbourhood of xn , yn . Among the most widely accepted is the RK4 method, whose algorithm for the solution of the initial value problem y f x, y , at x = x + nh is: y x0 y0 0 k1 f xn , yn f xn 12 h, yn 12 h k k2 f xn 12 h, yn 12 h k1 k3 2 k4 f xn h, yn h k3 yn 1 yn h k1 2k2 2k3 k4 6 For the same choice of step size h the RK4 method is much more accurate, but at the price of many more calculations. This algorithm is ideally suited for implementation in a spreadsheet [see "www.engr.mun.ca/~ggeorge/3424/demos/ex152RK4.xls"]. Example 1.5.2 Given that dy x y x 2 and y(0) = 1, use the RK4 method to estimate the value of y dx at x = 0.4 . This is just the initial value problem of Example 1.5.1. To illustrate the power of the RK4 method compared to the original Euler method, let us use a single step: h = 0.4 and n = 1 ENGI 3424 1.5 – First Order ODEs - Numerical Methods Page 1-31 Example 1.5.2 (continued) The exact value is 1.105 318 953 ... The RK4 value is correct to five significant figures. The RK4 method has produced a negligible error of less than 0.01% in the value of y, despite using only one step instead of four steps. There are more examples in the problem sets. Also see the tutorial examples for partial fractions and ordinary differential equations on the web site for this course. Some of the examples in the non-examinable appendix do provide additional practice in separation of variables or linear ODEs. END OF CHAPTER 1 1.6 – Exact First Order ODEs ENGI 3424 Appendix to Chapter 1 1.6 Page 1-32 [not examinable] Exact First Order ODEs [requires partial differentiation, Chapter 4] Method: The solution to the first order ordinary differential equation M(x, y) dx + N(x, y) dy = 0 can be written in the implicit form u(x, y) = c , (where c is a constant) u u du dx dy 0 . x y If M(x, y) and N(x, y) can be written as the first partial derivatives of some function u with respect to x and y respectively, then Clairaut’s theorem, 2u 2u y x x y leads to the test for an exact ODE: M N y x from which either u M dx (and use uy = N to find the arbitrary function of integration f (y) ) or u N dy (and use ux = M to find the arbitrary function of integration g(x) ) Note that these anti-derivatives are partial: In u M dx , treat y as though it were constant during the integration. In u N dy , treat x as though it were constant during the integration. After suitable rearrangement, any separable first order ODE is also exact, (but not all exact ODEs are separable). 1.6 – Exact First Order ODEs ENGI 3424 Example 1.6.1 dy Find the general solution of y e x x . dx Rewrite as y e x x dx e x dy 0 N M The test for an exact ODE is positive: M N ex y x x2 u M dx y e x dx y e f y 2 where f (y) is an arbitrary function of integration. But x x u ex f y y N(x, y) = ex f'(y) = 0 f (y) = c1 Therefore x2 u ye c1 c2 2 x The general solution is x2 y A e x 2 Check: x2 y 0 x e x A e x 2 y' + y = x e−x (y' + y) ex = x Page 1-33 1.6 – Exact First Order ODEs ENGI 3424 Example 1.6.1 (alternative method) dy Find the general solution of y e x x . dx Rewrite as y e x x dx e x dy 0 N M The test for an exact ODE is positive: M N ex y x u N ex u N dy e x dy y e x g x y where g(x) is an arbitrary function of integration. u y ex g x x But M = y ex − x g x g'(x) = −x x2 c1 2 u y ex x2 c1 c2 2 x2 y A e x 2 Page 1-34 1.6 – Exact First Order ODEs ENGI 3424 Example 1.6.2 Solve xy dy 1. dx 1 dx y dy 0 x N M separable. But M N 0 y x Therefore the ODE is also exact. u M dx ln x uy = 0 + f '(y) But N = −y f y f '(y) = −y y2 c1 2 u x, y ln x f y y 2 2 A ln x Check: 2y dy 1 2 0 dx x xy y' = 1 y2 c1 c2 2 Page 1-35 ENGI 3424 1.6 – Exact First Order ODEs Page 1-36 A separable first order ODE is also exact (after suitable rearrangement). f (x) g(y) dx + h(x) k(y) dy = 0 f x k y dx dy 0 h x g y M N M N 0 y x Therefore exact ! However, the converse is false: an exact first order ODE is not necessarily separable. A single counter-example is sufficient to establish this. Example 1.6.1: (y' + y) ex = x is exact, but not separable. 1.6 – Exact First Order ODEs ENGI 3424 Page 1-37 Example 1.6.3 Find the equation of the curve that passes through the point (1, 2) and whose slope at any point (x, y) is 2y / x . Solution by the method of separation of variables: dy 2y dx x This ODE is separable. dy dx 2 y x ln y 2 ln x C ln y ln A x 2 y = A x2 (unless y 0 , which is a solution) A e C (family of parabolae; y 0 is included in this family). But (1, 2) is on the curve 2 = A (1)2 Therefore y = 2 x2 Solution starting with the recognition of an exact ODE: dy 2y dx x 2 y dx x dy 0 which is not exact. y 2y x x 2 1 dx dy 0 is exact: x y 2 1 0 y x x y However, 1.6 – Exact First Order ODEs ENGI 3424 Page 1-38 Example 1.6.3 (continued) u But M dx 2 dx 2 ln x f y x uy = 0 + f '(y) N 1 y f y 1 y f (y) = − ln y + c1 u(x, y) = 2 ln x − ln y + c1 = c2 ln y = ln x2 + C = ln (A x2) y = A x2 (as before). In general, if an exact ODE is seen to be separable, (or separable after suitable rearrangement), then a solution using the method of separation of variables is usually much faster. 1.6 – Exact First Order ODEs ENGI 3424 Example 1.6.4 Find the complete solution of 3x2y4 dx + 4x3y3 dy = 0 , y = 2 when x = ½. P = 3x2y4 and Q = 4x3y3 are both of the type f (x) g(y). Therefore the ODE is separable. 4 y3 3x 2 dy dx dy dx 4 3 4 3 y x y x 4 ln y = C − 3 ln x ln y4 = C + ln x−3 = ln (A x−3) y4 = A x−3 or x3y4 = A OR Py = 12x2y3 = Qx Therefore the ODE is exact. Exact method: Seek u(x, y) such that u u 3x 2 y 4 and 4 x3 y 3 x y 3 4 u = x y + c1 = c2 The [implicit] general solution is x3y4 = A But (0.5, 2) lies on the curve 12 2 4 3 A A 2 Complete solution: x3y4 = 2 Page 1-39 1.6 – Exact First Order ODEs ENGI 3424 Page 1-40 Example 1.6.5 Solve (2xy + 2x) dx + (x2 + 1) dy = 0 P = 2xy + 2x = 2x(y + 1) and Q = x2 + 1 are both of the type f (x) g(y). Therefore the ODE is separable. dy y 1 2x dx x 1 2 A c1 ln 2 x 1 Therefore the general solution is ln y 1 ln x 2 1 1 (x2 + 1)(y + 1) = A OR Py = 2x = Qx Therefore the ODE is exact. Exact method: Seek u(x, y) such that u 2 x y 1 and x u x2 1 y u = (x2 + 1)(y + 1) = A If one cannot spot the functional form for u(x, y), then u M dx 2x y 1 dx y 1 2x dx y 1 x uy = x2 + f '(y) But N = x2 + 1 u = x2(y + 1) + y + c1 = c2 Let A = c2 − c1 + 1 , then (x2 + 1)(y + 1) = A f '(y) = 1 f (y) = y + c1 2 f y 1.6 – Exact First Order ODEs ENGI 3424 Page 1-41 Example 1.6.6 Solve cos x y y sin x y dx 2cos x y y sin x y dy 0 cos (x − y) cannot be expressed in the form f (x) g(y). This ODE is not separable. P = cos (x − y) + y sin (x − y) Py = +1 sin (x − y) + 1 sin (x − y) − y cos (x − y) Q = −2 cos (x − y) − y sin (x − y) Qx = +2 sin (x − y) − y cos (x − y) = Py Therefore the ODE is exact. Seek u(x, y) such that u cos x y y sin x y and x u 2 cos x y y sin x y y u = sin (x − y) − y cos (x − y) = A Occasionally another form of “exact ODE” arises, when one can spot the form d f x, y g x , whose solution is f x, y g x dx . dx Example 1.6.7 Solve 2 x y 2 2 xy dy cos x dx This ODE is neither separable nor linear. However 2 x y 2 2 xy d 2 x x y 2 cos x dx y2 sin x C x x x x 2 x y 2 sin x C dy d 2 x x y2 dx dx 1.7 – Integrating Factor ENGI 3424 1.7 Page 1-42 Integrating Factor Before introducing the general method, let us examine a specific example. Example 1.7.1 Convert the first order ordinary differential equation 2y dx + x dy = 0 into exact form and solve it, (without direct use of the method of separation of variables). [Note, this ODE is different from Example 1.6.3.] The ODE is separable and we can therefore rearrange it quickly into an exact form: 2 1 dx dy 0 x y However, let us seek a more systematic way of converting a non-exact form into an exact form. Let I(x, y) be an integrating factor, such that {(the ODE) I(x, y)} is exact: 2 y I dx x I dy 0 N M My = 2I + 2y Iy Nx = I + x Ix We need a simplifying assumption (in order to avoid dealing with partial differential equations). Suppose that I = I (x), then Iy = 0 and Ix = I' (x) My = Nx 2I + 0 = I + x I' (x) 1.7 – Integrating Factor ENGI 3424 Page 1-43 Example 1.7.1 (continued) x dI I dx dI I dx x ln I = ln x + C = ln (Ax) I (x) = Ax Multiplying the original ODE by I (x), we obtain the exact ODE (different from the separable-and-exact form) 2y Ax dx + A x2 dy = 0 A is an arbitrary constant of integration. Any non-zero choice for A allows us to divide the new ODE by that choice, to leave us with the equivalent exact ODE 2xy dx + x2 dy = 0 Therefore, upon integrating to find the integrating factor I (x), we can safely ignore the arbitrary constant of integration. If we notice that 2 x y 2 xy M x and 2 x y x2 N y then we can immediately conclude that u = x2y = c so that the general solution of the original ODE is c y 2 x 1.7 – Integrating Factor ENGI 3424 Page 1-44 Example 1.7.1 (continued) If we fail to spot the form for the potential function u, then we are faced with one of the two longer methods: Either u M dx 2xy dx y 2x dx yx 2 f y 2 x y f y x2 f y y But N = x2 f '(y) = 0 f (y) = c1 uy u = x2y + c1 = c2 y A x2 u N dy x x2y = A or 2 dy x 2 1 dy x 2 y g x 2 ux x y g x 2 xy g x x But M = 2xy g'(x) = 0 g(x) = c1 u = x2y + c1 = c2 y x2y = A A x2 The functional form for the integrating factor for an ODE is not unique. In example 1.7.1, I(x, y) = Ax2n+1yn is also an integrating factor, for any value of n and for any non-zero value of A. Proof: ODE 2y dx + x dy = 0 becomes A 2 x 2n1 y n1 dx x 2n2 y n dy 0 M N M 2 n 1 x 2n1 y n y N M and 2n 2 x 2n1 y n the transformed ODE is exact. x y 1.7 – Integrating Factor ENGI 3424 Example 1.7.1 (continued) One can show that the corresponding potential function is u x, y x y 2 n1 c1 c2 n 1 u x, y ln x 2 y c1 c2 n 1 n 1 both of which lead to x2 y A y A x2 Checking our solution: x2 y A 2 xy x 2 dy 0 dx 2 xy dx x 2 dy 0 Dividing by x : 2 y dx x dy 0 x 0 which is the original ODE. Page 1-45 1.7 – Integrating Factor ENGI 3424 Page 1-46 Integrating Factor – General Method: Occasionally it is possible to transform a non-exact first order ODE into exact form. Suppose that P dx + Q dy = 0 is not exact, but that IP dx + IQ dy = 0 is exact, where I (x, y) is an integrating factor. Then, using the product rule, M I P M I P P I y y y N I Q Q I x x x and N I Q From the exactness condition M N y x P I I Q Q P I x y x y If we assume that the integrating factor is a function of x alone, then P dI Q Q 0 I dx x y 1 dI 1 P Q I dx Q y x This assumption is valid only if 1 P Q Rx is a function of x only. Q y x If so, then the integrating factor is I x e R x dx [Note that the arbitrary constant of integration can be omitted safely.] Then R x dx u M dx e P x, y dx , etc. 1.7 – Integrating Factor ENGI 3424 Page 1-47 If we assume that the integrating factor is a function of y alone, then P dI Q 1 dI 1 Q P 0 P I dy y x I dy P x y This assumption is valid only if 1 Q P R y a function of y only. P x y If so, then the integrating factor is I y e u N dy e R y dy Q x, y dy , R y dy and etc. Example 1.7.2 Solve the first order ordinary differential equation 3x 2 y 6 xy 1 2 y 2 dx 3x 2 y dy 0 P Q The ODE is not separable. Py = 3x2 + 6x + y Qx = 6x + 0 ≠ Py Therefore the ODE is not exact. Py − Qx = 3x2 + y Py Qx 3x 2 y 1 R x Q 3x 2 y R x dx 1 dx I x e e ex [may ignore arbitrary constant of integration] Therefore an exact form of the ODE is 3x 2 y 6 xy M 1 2 y 2 e x dx 3x 2 y e x dy 0 N 1.7 – Integrating Factor ENGI 3424 Page 1-48 Example 1.7.2 (continued) My = (3x2 + 6x + y) ex Nx = (6x + 0 + 3x2 + y) ex = My Therefore the ODE is, indeed, exact. If one cannot spot the potential function u(x, y) = (3x2y + ½y2) ex , then the next fastest path to a solution is u x N dy e 3x y 2 1 2 y2 g x [Note that an anti-differentiation of M with respect to x would involve an integration by parts.] u x e x 3x 2 y 12 y 2 6 xy 0 g x But M 3x 2 y 12 y 2 6 xy e x g x 0 General solution: g x c1 e x 3x 2 y 12 y 2 A 1.7 – Integrating Factor ENGI 3424 Example 1.7.3 [also Example 1.1.4] A block is sliding down a slope of angle α, as shown, under the influence of its weight, the normal reaction force and the dynamic friction (which consists of two components, a surface term that is proportional to the normal reaction force and an air resistance term that is proportional to the speed). The block starts sliding from rest at A. Find the distance s(t) travelled down the slope after any time t (until the block reaches B). AP = s(t) AB = L W = mg N = W cos α Friction = surface + air F = μN + kv v t ds dt Starts at rest from A v(0) = s(0) = 0 Forces down-slope: dv m W sin F mg sin mg cos kv dt dv k a bv , where a g sin cos and b dt m The separation of variables method was followed in Example 1.1.4. Rewritten as dv bv a , it is obvious that this ODE is also linear. dt Page 1-49 1.7 – Integrating Factor ENGI 3424 Example 1.7.3 (continued) Integrating factor method: dv a bv dt (bv − a) dt + dv = 0 This ODE is not exact. Assume that the integrating factor is a function of t only: I = I (t). P = bv − a Q = 1 Pv = b Qt = 0 " Py Qx " Q Pv Qt b0 b R t Q 1 R dt b1 dt bt I t ebt The ODE becomes the exact form (bv − a) ebt dt + ebt dv = 0 M = (bv − a) ebt , N = ebt We want a function u(t, v) such that u u bv a ebt and ebt t v One can easily spot that such a function is a a u v ebt A v Ae bt b b But v(0) = 0 a 0 A b Page 1-50 1.7 – Integrating Factor ENGI 3424 Page 1-51 Example 1.7.3 (continued) Therefore v t v ds a 1 ebt dt b s But a 1 ebt b a 1 bt t e C2 b b s(0) = 0 0 a 1 0 C2 b b Therefore s or s a bt e bt 1 2 b mg sin cos m kt / m e 1 t k k The terminal speed v∞ then follows as in Example 1.1.4. 1.8 – Linear ODE Derivation ENGI 3424 1.8 Page 1-52 Derivation of the General Solution of First Order Linear ODEs The general form of a first order linear ordinary differential equation is dy P x y R x dx Rearranging the ODE into standard form, (P(x) y R(x)) dx + 1 dy = 0 Written in the standard exact form with an integrating factor in place, the ODE becomes I (x) (P(x) y R(x)) dx + I (x) dy = 0 Compare this with the exact ODE du = M(x, y) dx + N(x, y) dy = 0 The exactness condition I x P x dI I Let h x M N y x dI dx P dx P dx , then ln I (x) = h(x) and the integrating factor is I x e h x , where h x P x dx . The ODE becomes the exact form eh (Py R) dx + eh dy = 0 M = eh (Py R) , N = eh u and h' = P . h h h M dx e hy R dx y he dx e R dx u y eh eh R dx f y 1.8 – Linear ODE Derivation ENGI 3424 But Page 1-53 u eh 0 f y y f '(y) = 0 N = eh u y eh y eh e R dx c h 1 c2 e R dx C h Therefore the general solution of y x e h x e h x dy P x y R x is dx R x dx C , where h x A note on the arbitrary constant of integration in h x Let m P x dx A h x A P x dx P dx : and B e A then em ehe A B eh y e m e m 1 h em ehe A e B R dx C 1 h C e B eh R dx C e h e h R dx B B Therefore we may set the arbitrary constant in h x P dx to any value we wish, including zero, without affecting the general solution of the ODE at all. ENGI 3424 First Order ODEs Page 1-54 Review for the solution of first order first degree ODEs: P dx + Q dy = 0 1. Is the ODE separable? If so, use separation of variables. If not, then 2. Can the ODE be re-written in the form y' + P(x) y = R(x) ? If so, it is linear. h P dx and y eh e R dx C h Only the separable and linear types are examinable in ENGI 3424. Else 3. Is Py = Qx ? If so, then the ODE is exact. u u P and Q. Seek u such that x y The solution is u = c. Else 4. Is Py Qx Q a function of x only? Py Qx R x dx If so, the integrating factor is I x e , where R x . Q Then solve the exact ODE I P dx + I Q dy = 0 . Else, 5. Is Qx Py P a function of y only? Q Py R y dy If so, the integrating factor is I y e , where R y x . P Then solve the exact ODE I P dx + I Q dy = 0 . A first order ODE that does not fall into one of the five classes above is beyond the scope of this course.