Worksheet 8 Sample Solutions

Similar documents
Understand the existence and uniqueness theorems and what they tell you about solutions to initial value problems.

Even-Numbered Homework Solutions

Module 4: Numerical Methods for ODE. Michael Bader. Winter 2007/2008

Section 9.3 Phase Plane Portraits (for Planar Systems)

MathQuest: Differential Equations

7 Planar systems of linear ODE

Def. (a, b) is a critical point of the autonomous system. 1 Proper node (stable or unstable) 2 Improper node (stable or unstable)

Examples include: (a) the Lorenz system for climate and weather modeling (b) the Hodgkin-Huxley system for neuron modeling

Numerical Methods for the Solution of Differential Equations

Copyright (c) 2006 Warren Weckesser

Math 216 First Midterm 19 October, 2017

MA 527 first midterm review problems Hopefully final version as of October 2nd

Part II Problems and Solutions

Final 09/14/2017. Notes and electronic aids are not allowed. You must be seated in your assigned row for your exam to be valid.

dy dt = ty, y(0) = 3. (1)

Math 3301 Homework Set Points ( ) ( ) I ll leave it to you to verify that the eigenvalues and eigenvectors for this matrix are, ( ) ( ) ( ) ( )

4 Second-Order Systems

Practical Course Scientific Computing and Visualization

Scientific Computing: An Introductory Survey

Streamline calculations. Lecture note 2

Chapter 5. Formulation of FEM for Unsteady Problems

CS 450 Numerical Analysis. Chapter 9: Initial Value Problems for Ordinary Differential Equations

Math 215/255 Final Exam (Dec 2005)

Solution: In standard form (i.e. y + P (t)y = Q(t)) we have y t y = cos(t)

Math 266: Phase Plane Portrait

ENGI 9420 Lecture Notes 4 - Stability Analysis Page Stability Analysis for Non-linear Ordinary Differential Equations

Math 312 Lecture Notes Linear Two-dimensional Systems of Differential Equations

Ordinary Differential Equations II

Chapter 6 Nonlinear Systems and Phenomena. Friday, November 2, 12

Find the general solution of the system y = Ay, where

Ordinary Differential Equations II

Kinematics of fluid motion

Math 331 Homework Assignment Chapter 7 Page 1 of 9

Solutions to Math 53 Math 53 Practice Final

Woods Hole Methods of Computational Neuroscience. Differential Equations and Linear Algebra. Lecture Notes

MATH 24 EXAM 3 SOLUTIONS

Numerical Methods - Initial Value Problems for ODEs

Math 273 (51) - Final

APPM 2360: Final Exam 10:30am 1:00pm, May 6, 2015.

MTH 452/552 Homework 3

First Midterm Exam Name: Practice Problems September 19, x = ax + sin x.

Autonomous systems. Ordinary differential equations which do not contain the independent variable explicitly are said to be autonomous.

Differential Equations

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 9

Lecture 17: Ordinary Differential Equation II. First Order (continued)

Computational Techniques Prof. Dr. Niket Kaisare Department of Chemical Engineering Indian Institute of Technology, Madras

Numerical Solutions to Partial Differential Equations

Chapter 5 Exercises. (a) Determine the best possible Lipschitz constant for this function over 2 u <. u (t) = log(u(t)), u(0) = 2.

154 Chapter 9 Hints, Answers, and Solutions The particular trajectories are highlighted in the phase portraits below.

Math 266: Ordinary Differential Equations

Problem set 7 Math 207A, Fall 2011 Solutions

FINAL EXAM MATH303 Theory of Ordinary Differential Equations. Spring dx dt = x + 3y dy dt = x y.

AIMS Exercise Set # 1

Systems of Linear ODEs

Modeling and Simulation with ODE for MSE

Old Math 330 Exams. David M. McClendon. Department of Mathematics Ferris State University

COSC 3361 Numerical Analysis I Ordinary Differential Equations (II) - Multistep methods

Lecture 4: Numerical solution of ordinary differential equations

Ordinary Differential Equations

Ordinary Differential Equations

8.1 Bifurcations of Equilibria

Fourth Order RK-Method

V (r,t) = i ˆ u( x, y,z,t) + ˆ j v( x, y,z,t) + k ˆ w( x, y, z,t)

Question: Total. Points:

Nonlinear Autonomous Systems of Differential

MTH 464: Computational Linear Algebra

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Math 216 Final Exam 14 December, 2012

Math 207 Honors Calculus III Final Exam Solutions

Chapter 4: First-order differential equations. Similarity and Transport Phenomena in Fluid Dynamics Christophe Ancey

Math 4B Notes. Written by Victoria Kala SH 6432u Office Hours: T 12:45 1:45pm Last updated 7/24/2016

Dynamical Systems & Scientic Computing: Homework Assignments

Linearization of Differential Equation Models

Chapter 10. Solids and Fluids

Numerical Methods for Differential Equations

Nonlinear dynamics & chaos BECS

+ i. cos(t) + 2 sin(t) + c 2.

Applied Numerical Analysis

Chapter 9b: Numerical Methods for Calculus and Differential Equations. Initial-Value Problems Euler Method Time-Step Independence MATLAB ODE Solvers

Math Ordinary Differential Equations

Third In-Class Exam Solutions Math 246, Professor David Levermore Thursday, 3 December 2009 (1) [6] Given that 2 is an eigenvalue of the matrix

ODE, part 2. Dynamical systems, differential equations

NUMERICAL SOLUTION OF ODE IVPs. Overview

Chapter 1, Section 1.2, Example 9 (page 13) and Exercise 29 (page 15). Use the Uniqueness Tool. Select the option ẋ = x

Matrix Theory and Differential Equations Practice For the Final in BE1022 Thursday 14th December 2006 at 8.00am

Problem set 6 Math 207A, Fall 2011 Solutions. 1. A two-dimensional gradient system has the form

Ordinary Differential Equations

MATH 4B Differential Equations, Fall 2016 Final Exam Study Guide

Integration of Differential Equations

Solutions for homework 11

ODE Runge-Kutta methods

AM205: Assignment 3 (due 5 PM, October 20)

Ordinary Differential Equations

MB4018 Differential equations

Ordinary differential equations - Initial value problems

Calculus C (ordinary differential equations)

Initial value problems for ordinary differential equations

First In-Class Exam Solutions Math 246, Professor David Levermore Thursday, 20 September 2018

Initial-Value Problems for ODEs. Introduction to Linear Multistep Methods

Department of Mathematics IIT Guwahati

Transcription:

Technische Universität München WS 2016/17 Lehrstuhl für Informatik V Scientific Computing Univ.-Prof. Dr. M. Bader 19.12.2016/21.12.2016 M.Sc. S. Seckler, M.Sc. D. Jarema Worksheet 8 Sample Solutions Ordinary Differential Equations: Numerical Methods (H) Exercise 1: Charged Particle Simulation Consider a spherical particle which carries a constant electric charge q > 0 and is suspended in water. The particle shall move at a velocity v(t) R 3. The force F R 3 acting on the particle due to an external electric field E(t) R 3 and a magnetic field B(t) R 3 is given by the Lorentz force: F lorentz (t) := q(e(t) + v(t) B(t)) (1) with the operator is defined as the cross-product a b := a 2 b 3 a 3 b 2 a 3 b 1 a 1 b 3 a 1 b 2 a 2 b 1 (2) for vectors a, b R 3. Due to the viscous resistance of the fluid, the drag force acts onto the particle as well: F drag (t) := 6πηrv(t) (3) where η > 0 is the fluid viscosity and r > 0 the radius of the particle. A system of ordinary differential equations evolves for the particle velocity v(t) as follows: dv = 1 ( ) Florentz + F m drag (4) where m denotes the mass of the particle. (a) Write down the specific differential equation for a magnetic field B(t) := (0, 0, 2t), an electric field E(t) := (1, 0, 0), a mass, viscosity and electric charge q = m = η = 1 as well as a radius r = 1 6π. You may further assume that the particle is initially at rest, i.e. v(t = 0) = 0. (b) Formulate the explicit Euler method for the equations derived in (a) and solve the first three time steps by hand using a time step τ = 1 2. 1

(c) Write a python script to study the influence of the time step τ on your solution. Simplify the magnetic field to B(t) := (0, 0, 1) and compute the error for τ = 2 n, n 1: e(t) := (v analytic x (t) v euler x (t)) 2 + (vy analytic (t) v euler y (t)) 2 where v euler and v analytic are numerical and analytical solutions. The analytical solution of the simplified system is given by v x (t) = 1 2 + 1 2 e t (sin(t) cos(t)) v y (t) = 1 2 + 1 2 e t (sin(t) + cos(t)) Consider the time interval t [0, 10] in your studies. What do you observe? (d) Formulate the second-order Adams-Moulton method for the equations derived in (a) and solve the first time step for τ = 1 2. Solution: (a) We can first write down the differential equation for the particle velocity for every velocity component: dv x (t) dv y (t) dv z (t) = 1 ( ) q(e x (t) + v y (t)b z (t) v z (t)b y (t)) 6πηrv x (t) m = 1 ( ) q(e y (t) + v z (t)b x (t) v x (t)b z (t)) 6πηrv y (t) m = 1 ( ) q(e z (t) + v x (t)b y (t) v y (t)b x (t)) 6πηrv z (t) m Inserting all quantities according to the description of this exercise, the system reduces to: dv x (t) = v x (t) + 2t v y (t) + 1 dv y (t) = 2t v x (t) v y (t) dv z (t) = v z (t) Since the particle has zero velocity at the beginning, the third velocity component will always remain zero. Hence, it is enough to consider the two-dimensional system (5) (6) from now. dv x (t) dv y (t) = v x (t) + 2t v y (t) + 1 = 2t v x (t) v y (t) (7) 2

(b) The explicit Euler method for the equations (7) is given by: v x (t + τ) v x (t) τ v y (t + τ) v y (t) τ This results in the update rule: = v x (t) + 2t v y (t) + 1 = 2t v x (t) v y (t) (8) v x (t + τ) = (1 τ)v x (t) + 2τtv y (t) + τ v y (t + τ) = (1 τ)v y (t) 2τtv x (t) (9) For τ = 1 2, we obtain: v x (t + 1 2 ) = 1 2 v x(t) + tv y (t) + 1 2 v y (t + 1 2 ) = 1 2 v y(t) tv x (t) (10) Starting with v x (t = 0) = 0, v y (t = 0) = 0, we finally obtain: v x ( 1 2 ) = 1 2, v y( 1 2 ) = 0 v x (1) = 3 4, v y(1) = 1 4 (11) v x ( 3 2 ) = 5 8, v y( 3 2 ) = 7 8 (c) See ws8 ex1.py. Halving the time step yields a reduction of the error by a factor of two. For our problem, the explicit Euler method hence shows an error of order O(τ). (d) The Adams-Moulton method is given by the following update rule: y(t + τ) = y(t) + τ ( f (t, y(t)) + f (t + τ, y(t + τ))) (12) 2 Applying this discretization scheme to equation (7) results in v x (t + τ) = v x (t) + τ 2 ( vx (t) + 2tv y (t) + 1 v x (t + τ) + 2(t + τ)v y (t + τ) + 1 ) v y (t + τ) = v y (t) + τ ( 2tvx (t) v y (t) 2(t + τ)v x (t + τ) v y (t + τ) ) 2 or in matrix-vector form: 1 + τ 2 τ(t + τ) τ(t + τ) 1 + τ 2 ( ( ) 1 τ ) v x (t) + τtv y (t) + τ vx (t + τ) 2 = v y (t + τ) ( τtv x (t) + 1 τ ) v y (t) 2 (13) (14) 3

Due to the implicit nature of the Adams-Moulton method, we need to solve this linear system of equations in each time step. For the first time step, we can insert τ = 1 2, t = 0 and v x (t = 0) = v y (t = 0) = 0 into equation (14): 5 4 1 4 1 4 v x( 1 2 ) 1 = 5 v y ( 1 2 ) 2 (15) 0 4 Solving this system of equations yields v x ( 1 2 ) = 5 13, v y( 1 2 ) = 1 13. Remark: The second-order Adams-Moulton method is just the trapezoidal rule from the last exercise. In terms of solving partial differential equations, the arising time stepping method is also known as Crank-Nicolson scheme. (I) Exercise 2: Runge-Kutta Methods and Direction Fields Consider the direction field of a one-dimensional ODE dp = f (t, p(t)) as given in Figure 1. Figure 1: Direction field for Exercise 2 task (a), the initial value p 0 = 0.125 is marked by a point. To compute approximate solutions p n p(t n ) at times t n = n τ, the following second-order 4

Runge-Kutta scheme is given to compute the population size p n+1 of the next time step: p n+1 = p n + τ f (t n, p n ) p n+1 = 1 2 (p n + τ f (t n+1, p n+1 ) + p n+1 ) (16) (a) With initial condition p 0 = p(0) = 0.125, perform the first four steps of this scheme (to compute p 1, p 2, p 3, p 4 ) by drawing the approximate solutions into the direction field in Figure 1 (graphical solution only). The step size shall be τ = 2, as illustrated by the four intervals drawn into the direction field. Mark from which arrows you obtain the directions of the numerical steps you are allowed to add an arrow to the direction field, if no arrow is plotted at the precise required position. (b) Consider the direction field in Figure 2. Perform the first three steps of the explicit Euler Figure 2: Direction field for Exercise 2 task (b). scheme by drawing the approximate solution in this direction field. Start at y(t = 0) = 1 and use a time step τ = 3. What do you observe? What happens for τ = 2 and τ = 1.5? Solution: (a) The drawing is shown in Figure 3. We further introduce a point p n+1 := p n + τ f (t n+1, p n+1 ). Using this new point, we can write the update rule as: p n+1 = p n + τ f (t n, p n ) p n+1 = p n + τ f (t n+1, p n+1 ) p n+1 = 1 2 ( p n+1 + p n+1 ) (17) From this, we can understand how the drawing works: 5

Figure 3: Solution of Exercise 2 task (a). 1. Determine the gradient at the point (t n, p n (t n )); for t 0 = 0, this point is given by (0, 0.125). The gradient is given by the respective vector in the plot. If there s no arrow, you need to draw it yourself considering the neighborhood of the respective point. 2. Walk along this vector until you reach the time t n+1 = t n + τ. The point at this position corresponds to (t n+1, p n+1 = p n + τ f (t n, p n )). 3. In order to determine p n+1, we need the gradient at (t n+1, p n+1 ). This gradient corresponds to the vector of the direction field at the position (t n+1, p n+1 ). We draw a straight line parallel to this vector through p n. The point of this straight line at t n+1 = t n + τ corresponds to p n+1. 4. Finally, we obtain p n+1 from averaging the values p n+1 and p n+1. (b) The explicit Euler method corresponds to the very first step of the Runge-Kutta method from (a), i.e. p n+1 corresponds to the explicit Euler solution. You can hence just carry out steps 1 and 2 from (a) and use p n+1 = p n+1. The solutions are sketched in Figure 4. The blue crosses correspond to the time step τ = 1.5, the red crosses represent the explicit Euler method for τ = 2 and the green crosses illustrate the behavior of the explicit Euler method for τ = 3. We can observe that the method is unstable for τ = 3. In this case, we diverge from the critical point with each time step in an oscillatory manner. 6

Figure 4: Solution of Exercise 2 task (a). the method is close to the stability regime for τ = 2. The solution oscillates around the critical point. It neither converges nor diverges further away from the solution. the method is stable and converges towards the critical point for τ = 1.5. The numerical solution oscillates around the critical point. However, the amplitude of the oscillations is reduced with each time step. Remark: The vector field that was used corresponds to the ODE dy = y. The explicit Euler method reads y n+1 = y n + τ( y n ) = (1 τ)y n in this case. Since 1 τ represents the eigenvalue of this iterative scheme, we observe for τ > 0: 0 for 1 τ < 1 τ (0, 2) n y n ± for 1 τ > 1 τ (2, ) n y n ±y 0 for 1 τ = 1 τ = 2 y n n (18) (I) Exercise 3: One-step and Multistep Numerical Methods Consider the direction field of a one-dimensional differential equation dp/ = f (t, p), where f (t, p) = (1 p(t))/2 (Verhust model - saturation), as given in Figure 5. (a) To compute approximate solutions p n p(t n ) at times t n = nτ, the following multistep 7

3.0 2.5 2.0 p(t) 1.5 1.0 0.5 0.0 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 t Figure 5: Direction field for dp/ = (1 p(t))/2. numerical scheme is given: p 0 = p(0) = 1/2 (initial condition) (19) p 1 = p 0 + τ f (t 0, p 0 ) (20) p n+2 = 5p n 4p n+1 + τ(2 f (t n, p n ) + 4 f (t n+1, p n+1 )) (21) Compute the first four steps of this scheme (p 1, p 2, p 3, p 4 ) with time step size τ = 1, and draw the numerical solution (points connected by lines) on Figure 5. If a point is outside the plot domain, you do not have to visualize it. (b) Consider the one-step Midpoint method: p 0 = p(0) = 3.0 (initial condition) (22) ( p n+1 = p n + τ f t n + 1 2 τ, p n + τ ) 2 f (t n, p n ). (23) Perform the first four steps of this scheme (to compute p 1, p 2, p 3, p 4 ) by drawing the approximate solutions into the direction field in Figure 5 (graphical solution only). The 8

step size shall be τ = 1, as illustrated by the four intervals drawn into the direction field. Mark from which arrows you obtain the directions of the numerical steps you are allowed to add an arrow to the direction field, if no arrow is plotted at the precise required position. (c) What can you conclude about the numerical stability of the methods from a) and b) for τ = 1? (d) List two advantages and two disadvantages of multistep methods in comparison to one-step methods. Solution: (a) Computation of the first four steps: The first step is computed from the explicit Euler scheme f (p 0 ) = f (1/2) = 1/4, p 1 = p 0 + τ f (p 0 ) = 1/2 + 1/4 = 3/4. For the next time steps we apply the multistep method. The second step: f (p 1 ) = f (3/4) = 1/8, p 2 = 5p 0 4p 1 + τ(2 f (p 0 ) + 4 f (p 1 )) = 5/2 3 + 1/2 + 1/2 = 1/2. The third step: f (p 2 ) = f (1/2) = 1/4, p 3 = 5p 1 4p 2 + τ(2 f (p 1 ) + 4 f (p 2 )) = 15/4 2 + 1/4 + 1 = 3. Finally, the fourth step: f (p 3 ) = f (3) = 1.0, p 4 = 5p 2 4p 3 + τ(2 f (p 2 ) + 4 f (p 3 )) = 5/2 12 + 1/2 4 = 13. (b) For the graphical solution of the method see Figure 6. (c) Multistep method. From the evaluation we see that the magnitude of p from the stationary solution p s = 1 is growing (the fifth step already gives p 5 = 93), that means that the numerical method is unstable for the time step size τ = 1.0. 9

Figure 6: Direction field for dp/ = (1 p(t))/2. The multistep method numerical solution is plotted in blue. The midpoint one-step method numerical solution is plotted in green, the arrows from which we obtain the direction of numerical steps are drawn in red. Midpoint method. Now, the numerical solution approaches the critical value p s = 1 during the first four steps. The method might be stable. But we cannot be sure about that just from the first four steps for the given initial condition. To investigate the numerical stability of this multistep method more rigorous analysis is required. (d) Main advantage of the multistep methods is that they reuse computed right hand side function values from the previous steps. It can be beneficial in cases when a right hand side of an ODE is computationally expensive. Furthermore, with multistep methods it is simple to get higher order numerical schemes. The disadvantage of the multistep methods is that they are very often numerically unstable. Another disadvantage is that for the first time steps one need not only the initial value, but values in the consecutive time steps to be specified. 10

(H*) Exercise 4: Particle in Rotating Tube A small spherical particle is located in a very long rotating tube full of liquid, which does not move relative to the tubes walls. We are interested in the particle motion along the tube axis x, see Figure 7. Therefore, the x 0 Figure 7: A rotating tube with liquid and particle inside. rotating reference frame is used to derive the equation of the particle motion. In this reference frame, we consider two dominating forces acting on the particle along x axis: the Stokes drag force and the buoyancy type force. The model is approximated by the following ODE d 2 x = (1 γ) x λdx 2, (24) where γ = ρ l /ρ p > 0 is the ratio of densities (ρ l, ρ p liquid and particle densities) and λ 0 is the friction coefficient. (a) Transform the second order ODE (24) into a system of first-order ODEs. (b) The matrix-vector form of the linear system of ODEs is given by Find the critical point of the system. ( ) dy 0 1 = y. (25) 1 γ λ 11

Spiral sink δ= det(a) Spiral source τ 2 = 4δ Sink node Source node Center 0 τ= tr(a) Saddle Saddle Figure 8: Type and stability of a critical point in two dimensions. (c) Study how the type of the fixed point depends on γ, when λ = 1. Name all possible types of critical points and γ ranges at which these types occur. For the critical point classification you may use Figure 8. (d) Sketch the direction field of the system of ODEs with fixed γ = 1/4 and λ = 1. Use eigenvalues and eigenvectors to determine the direction field. Solution: (a) To obtain the first order linear system of ODEs we denote y 0 = x and y 1 = u as vector y components. The resulting system takes the form dy 0 dy 1 = y 1, = (1 γ)y 0 λy 1. (b) We have a linear homogeneous system of ODEs. Therefore, it has a critical point given by y c = (0, 0). Indeed, y c satisfies the critical point equation ( ) 0 1 y 1 γ λ c = 0 12

Spiral sink δ= det(a) Spiral source τ 2 = 4δ Sink node Source node Center τ= -1 0 τ= tr(a) Saddle Saddle Figure 9: Type and stability of a critical point in two dimensions. Remark: when γ = 1, our linear system matrix is singular and we have a line of critical points given by y c = (x, 0). (c) The trace of our linear system matrix τ = tr(a) = 1 and the determinant δ = det(a) = γ 1. The density ratio γ 0, therefore, the determinant δ 1. In Figure 9 the vertical line with fixed τ = 1 shows that the critical point can be a spiral sink, sink node, or a saddle. The critical point is a saddle when δ < 0 or γ < 1. As a result the particle will move away from the center of rotation when its density is large than the liquid density. Remark: when γ = 1 we obtain a line of stable critical points. In this case, the particle has the same density as the liquid and in the long time run can be positioned at any x. The critical point is a sink node when δ > 0 and δ < τ 2 /4 = 1/4. Then 1 < γ < 5/4 corresponds to a sink node and the particle will approaches the center of rotation without oscillations. Remark: when γ = 5/4 we have a degenerate node. Finally, when γ > 5/4 the critical point is a spiral sink. Therefore, the particle will move to the center of rotation with oscillations. (d) With given parameters the matrix A takes the form ( ) 0 1 A =. 3 4 1 Eigenvalues and corresponding eigenvectors are e 1 = 1/2, v 1 = (2, 1) and e 2 = 3/2, 13

v 2 = (2, 3). The corresponding direction field is shown in Figure 10. 3 v 2 2 v 1 1 u 0 1 2 3 3 2 1 0 1 2 3 x Figure 10: Direction field for the system of ODEs with γ = 1/4 and λ = 1. (H*) Exercise 5: Indoor Air Quality Modeling The quality of indoor air can be characterized by the concentration of volatile organic compounds (VOCs). The sources of VOCs may be located outdoors or within a building. In the simplest indoor air quality model, the concentration of VOC is described by two differential equations: V x t = Qc in Qx k a Ax + k d Ay + q, y t = k ax k d y, (26) where the following notations are used: 14

x VOC concentration within the room, c in = 1 VOC inflow concentration, V = 64 volume of the room, Q = 192 air inflow and outflow, q = 192 rate of VOC sources inside the room, A = 32 area of reacting surface, k a = 4, k d = 2 ad- and desorption coefficients, y adsorbed concentration of VOC on area A. (a) Use the parameter values from the table above and write the final set of equations for unknowns x and y in the matrix-vector form c/ t = A c + b, where c = [x, y] T. (b) Compute the critical points, and the eigenvalues and eigenvectors of the matrix A R 2 2 of the system c/ t = A c + b. Use the eigenvectors and eigenvalues of matrix A to sketch the x, y direction field. (c) In case the inflow air is clean from VOCs (c in = 0) and there are no VOC sources inside the room (q = 0), formulate the Implicit Euler method for the corresponding ODE from task (a) using a time step size τ. Compute the explicit form of the resulting update scheme for x(t + τ), y(t + τ). Hint: you may use the following formula to invert 2 2 matrices: [ ] 1 a b = c d 1 ad bc [ d ] b c a (27) Solution: (a) After constituting the parameters values into (26) set of equation we obtain: 64 x = 384 320x + 64y, t y = 4x 2y. t The matrix-vector form of this set of equations is [ ] x [ ] [ ] t 5 1 x y = + 4 2 y t (b) To compute the critical points we set all time derivatives to zero and solve the following linear system of equations 6 5x + y = 0, 2x y = 0. The solution of this set of equations is x = 2, y = 4. 1 [ ] 6 0 15

5.0 v 2 v 1 4.5 4.0 3.5 3.0 1.0 1.5 2.0 2.5 3.0 Figure 11: Direction field for air quality model set of equations. To find the eigenvalues of matrix A we solve the characteristic equation [ ] 5 λ 1 det = (5 + λ)(2 + λ) 4 = 0. 4 2 λ The roots of the arising differential equation are λ 1 = 1 and λ 2 = 6. The eigenvectors can be computed from the equation: [ ] [ ] 5 λ1,2 1 vx = 0 4 2 λ 1,2 v y From this equation we find the corresponding eigenvectors v 1 = c[1 4] and v 2 = c[1 1]. For the direction field of equation (26) see Figure 11. All arrows tend to the critical point. We thus have a single node as a critical point which in the current case represents a stable equilibrium point. (c) The Implicit Euler method reads: c (n+1) = c (n) + τ f (t (n+1), c (n+1) ) 16

In the current example, we obtain: [ ] c (n+1) = c (n) 5 1 + τ c (n+1) 4 2 We first bring all contributions invoking c (n+1) to the left side: Inverting the matrix on the left side yields: c (n+1) = [ ] 1 + 5τ τ c 4τ 1 + (n+1) = c (n) 2τ [ ] 1 1 + 2τ τ 1 + 7τ + 6τ 2 c 4τ 1 + (n) 5τ 17