MA2213 Lecture 10 ODE
Topics Importance p Introduction to the theory p Numerical methods Forward Euler p. 383 Richardson’s extrapolation formula p. 391 Analytic solutions p Existence of solutions p. 372 Direction fields p Systems of equations p. 432 Two point boundary value problems p. 442
Importance “Differential equations are among the most important mathematical tools used in producing models of physical and biological sciences, and engineering.” They can be classified into: Ordinary :have 1 independent variable Partial :have > 1 independent variable wave equationheat equation
Analytic Solutions Integration Integrating Factors Separation of Variables
Existence of Solutions Theorem (page 372) Letand be continuous functions ofand at all pointsin some neighborhood of Then there is a unique function defined on some interval satisfying Example (p. 372) The initial value problem admits the solution
Direction Fields At any point (x,y) on the graph of a solution of the the slope is equation Direction fields illustrate these slopes. Example (page 376) Consider The slope at (x,y) is y (independent of x). [x,y] = meshgrid(-2:0.5:2,-2:0.5:2); dx = ones(9); % Generates a mesh of 1’s dy = y; quiver(x,y,dx,dy); xlabel('x coordinate axis') ylabel(y coordinate axis') title(' direction field v = [1 y]^T ')
Direction Field
Solution Curves The solutions of hold on x = -2:0.01:1;; y1 = exp(x); y2=-exp(x); plot(x,y1,x,y2) hold off are
Direction Field with Two Solution Curves
Forward Euler Method Letbe the solution of the initial value problem Numerical methods will give an approximate solution at a discrete set of nodes For simplicity we choose evenly spaced nodes Taylor’s approximation gives the forward Euler method for approximations
Examples of Forward Euler Method Letbe the solution of the initial value problem For nodes forward Euler method gives approximations so
Error of Forward Euler Method Letbe the solution of the initial value problem For nodes the exact solution is and the numerical approximation equals therefore we have the error
Richardson Extrapolation It can be shown, using an analysis similar to the one on the preceding page, that the numerical solution obtained using the forward Euler method with step size satisfies therefore, the approximation using step size satisfies These two estimates can be combined to give which has a much smaller error than This process can be extended as in slides 36,40 Lect 7.
Systems of Equations The general form of a system of two first-order differential equations is (page 432) This system can be simply represented using vectors
Systems of Equations For the system of two equations in slide 3 and the solution of the initial value problem is
Systems of Equations Y0 = [1;0]; h = 0.001; N = round(1000*2*pi); x0 = 0; Y(:,1) = Y0; x(1) = x0; for n = 1:N x(n+1) = x(n)+h; f = [-Y(2,n);Y(1,n)]; Y(:,n+1) = Y(:,n) + h*f; end figure(1); plot(x,Y(1,:),x,Y(2,:)); grid; title(‘approximate solution’) figure(2); plot(x,Y(1,:)-cos(x),x,Y(2,:)-sin(x)); grid; title(‘error’)
Systems of Equations
Two-Point Boundary Value Problems A second-order linear boundary value problem (p. 442) can be discretized. We choose nodes let to obtain linear equations for
Homework Due Lab 5 (Week 13, November) was proposed as a model for population growth by Peirre Verhulst in Draw its direction fields and solution curves for Y(0) =.5K and Y(0)=1.5K. 1. The logistic equation 4. Write the MATLAB Program on page 445, study pages , and do problem 7 on page 449. (Extrapolated means Richardson extrapolated) 2. Implement the forward Euler method to compute the two solutions above. Use plots and tables to show how Richardson extrapolation decreases the errors. 3. Study the Lotka-Volterra predator-prey model on page 433 and then do problem 9 on page 441. Extra Credit: Use the secant method to compute the smallest x > 0 so that Y(x) = Y(0) where Y is the solution in part (b).