Lecture 17: Ordinary Differential Equation II. First Order (continued) 1. Key points Maple commands dsolve dsolve[interactive] dsolve(numeric) 2. Linear first order ODE: y' = q(x) - p(x) y In general, a linear first order ODE can be expressed as (1) which can be analytically solved. Introducing a new function u(x), (2) The original ODE leads to (3) Hence, we have We learned how to solve this kind of ODE in the previous lecture. The general solution is given by (4)
(5) where C is a constant of integral. The solution for the original ODE is given by (6) Example A particle of mass m in a fluid is subject to an external forcing. The drag force on the particle is. The particle is initially at rest. Then, the equation of motion is This is a linear first order ODE with and. Its general solution is. Completing the integral, we obtain (7) The initial condition v(0)=0 indicates C=0. Check the answer with Maple command dsolve([m v+b v = a t),v(0)=0]) (8) which agrees with (7). Homogeneous vs. Inhomogeneous ODE If, we have a homogeneous ODE:. A general solution to an
inhomogeneous equation consists of two parts: complementary function and particular solution. A complementary function is a general solution to the corresponding homogeneous equation: (9) A particular solution is (10) Then, the general solution of the inhomogeneous equation is. Note that a constant of integration C appears only in the complementary function. General solutions to higher order linear ODEs have the same structure. 3. Exact differential: y'=-p(x,y) /q(x,y) If the first ODE has a general form (11) with the additional condition, (12) the differential equation (11) is said to be exact and we can solve it. We write (11) in the exact form (13) With the condition (13), there exists a function F(x,y) such that
(14) (15) Then, the exact differential of leads to (16) Hence, th solution is F(x,y)= C where C is a constant of integration. Now, the problem is to find F(x,y). Integrating the equation in (14) (17) where a(y) is an unknown function. To determine a(y), substituting (17) in the equation (15), (18) We used (12) during the calculation. Equation (18) indicates (19) Hence, the solution is
(20) At the boundary and, and thus. Now, the solution of ODE is given in a implicit form (21) Example Solve (22) or equivalently This equation is not exact. However, if divided by (23) it becomes exact. (a factor that makes the equation exact is called an integrating factor). (24) Comparing (13) with (24), we have and. Equation (20) leads to a solution
(25) which is simplified to (26) Hence, the general solution is. Using Maple, (27) 4. Numerical solutions Many ODEs cannot be solved analytically. Then, we resort to numerical methods. Here only a simple numerical algorithm is introduced. Maple and other mathematical packages use more advanced algorithms and thus their results are more accurate. Euler method: Consider an ODE Suppose that we know the value of at a point, that is we know. We want to know the value at next point, that is. Using Taylor expansion,. If is small, we can ignore and higher orders. Using the ODE, we can replace with. Hence, (28) (29) Using this step successively, we can reach after steps. The accuracy depends on how small is. In principle, the smaller is, the more accurate id the result. However, we need a large number of steps. In addition, if is too small, bit-off error and round-off error become significant. The Euler method is simple but practically not accurate enough for many applications. Runge-Kutta methods are more accurate and yet computationally still simple. There are many other accurate methods. In Maple, specify numeric option in dsolve command.
Example 1 Solve numerically. (This ODE can be solve analytically.) Using Maple interactive ODE solver. (30) (31) (32) (33)
Example 2 Consider a simple LR circuit. The current in the circuit follows the following ODE: where is voltage. The voltage varies as. Solve it both analytically and numerically. Using the parameter value,,, and compare numerical solution with the analytically one (34)
(35) (36) (37) (38) Homework: Due 11/6, 11am 17.1 Consider a simple circuit with resistance and inductance L. The voltage V(t)
and current J(t) are related through the ODE: (39) Assuming and, find. Solve it also numerically with parameter values,,, and. 17.2 Bernoulli's equation,. is a nonlinear ODE except when n=0 or n=1. However, it is possible to convert the equation to a linear one. Introducing a new function,, show that the equation for u is a linear ODE. 17.3 Find analytical and numerical solutions of the following ODE and compare them for an initial condition..