



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Department of Mathematics Fall 2008 MATH 4364, Section 24266 MW 5:30-7:00PM A. Caboussat
Turn in programs, outputs, figures and results. You may use the codes provided with the book. Write a short report to present your results.
1.a) By setting f (y, t) = Cy(1 − y/B), this problem admits one unique solution since:
|f (y, t) = f (x, t)| 6 |C| |y − x|
y + x B
∣ 6 |C| |1 + 2B| |y^ −^ x|^.
1.b) An equilibrium solution means:
0 = Cy(t)
y(t) B
⇒ y(t) = 0 or y(t) = B.
Two possible equilibrium solutions exist: either the population disappear or it increases to its maximum size. The behavior will depend on the initial conditions and coefficients. 1.c) The behavior of the four methods is represented in Figures 1 and 2. In all cases, we obtain (with this set of parameters) a stationary solution y(t) = B.
(a) When we decrease N , some schemes will provide a stable solution (like the Euler implicit scheme that is unconditionally stable), while some scheme will provide an unstable solution (the explicit schemes). Figure 3 shows the numerical behavior of our four schemes. We remark that the implicit Euler is stable, as well as the RK4 scheme, which has not reached its stability threshold. The other two schemes provide unstable solutions. When using an explicit scheme, one must be aware of this effect and be careful when taking large time steps. (b) When you replace C = 1 by C = − 0 .1, the growth rate of the population is negative, meaning that the number of bacteria will decrease to zero, the other stationary solution, instead of the value B. Figure 4 illustrates this situation.
1.d) The exact solution y(t) is
y(t) = y 0 eCt^
y 0 B
ect^ − 1
It is a Bernoulli differential equation, which solution can be computed explicitly by computing a particular solution and a general solution to the ODE. The errors for the four schemes are given in Table 1. The corresponding log-log plot of the errors is illustrated in Figure 5. It confirms that explicit and implicit Euler methods are both first order methods, while RK4 is of order 4 and Adams-Bashforth is of order 3. 1.e) When C = 1, B = 100, y 0 = 58, T = 0.1 and N = 100, 200 , 400 , 800 , 1600 , 3200 , 6400, the Euler explicit scheme and the Adams-Bashforth schemes show a different behavior for very small h. Both convergence order are correct (as before), but we see that rounding errors rapidly spoil the convergence order for the Adams-Bashforth scheme (this depends on your machine precision). Generally speaking, the rounding errors increase when the step h is very small (compared to machine precision) and continues to decrease.
(^00 5 10 15 20 25 30 35 40 45 )
20
40
60
80
100
(^00 5 10 15 20 25 30 35 40 45 )
20
40
60
80
100
(^00 5 10 15 20 25 30 35 40 45 )
20
40
60
80
100
(^00 5 10 15 20 25 30 35 40 45 )
20
40
60
80
100
Figure 1: Results for C = 1, B = 100, y 0 = 58, T = 50, N = 100. Upper left: Explicit Euler, upper right: Implicit Euler, lower left: RK4, lower right:Adams Bashforth 3 step.
(^00 5 10 15 20 25 30 35 40 45 )
20
40
60
80
100
Explicit Euler Implicit Euler RK4 Adams 3 steps
Figure 2: Results for C = 1, B = 100, y 0 = 58, T = 50, N = 100. Common plot.
1.f ) The predator-prey problem does not admit an equilibrium solution in this case; in fact, the behavior of the system is periodical and never reaches a stationary solution.
1.g) Consider the case C 1 = C 2 = 1, bx = by = 0, dx = dy = 1 and initial conditions x 0 = y 0 = 2. We let T = 10 and N = 2000, such that h = T /N. The approximation of y(t) and x(t) by using the Euler explicit and Runge-Kutta explicit of order 4 schemes are given in Figure 6.
1.h) One example of a small Matlab code to draw the trajectory on the phase plane can be as follows:
for i=1:1:N- m = (y(i)-y(i+1))/(x(i)-x(i+1)); %calculate slope b = y(i) - m*x(i); %calculate intercept
(^10100 101 ) −
10 −
10 −
10 −
10 −
10 −
10 −
100
N
Error
Explicit Euler Implicit Euler RK4 Adams 3 steps slope 1 slope 3 slope 4
Figure 5: Log-Log plot of the errors of the different schemes as function of N.
(^00 1 2 3 4 5 6 7 8 9 )
1
2
y x
(^00 1 2 3 4 5 6 7 8 9 )
1
2
y x
Figure 6: Results for the predator-prey model. Left: Explicit Euler, right: RK4.
of order 4), for different values of h. When h is increasing, the explicit Euler scheme does not explode, but the error made by the scheme brings the trajectory of y and x to be identically zero. The smoothing effect (or diffusion effect is less important for RK4, but still exists since the peak of the trajectory gets lower. In both cases, the scheme explodes when h is very large. This behavior is characteristic of explicit schemes.
1.j) (a) When C 1 = C 2 = 1, bx = by = 0, dx = dy = 1, x 0 = y 0 = 1, the solutions y and x remain identically 1, which is a stationary solution in that case. If we modify slightly x 0 , the previous behavior is recovered. The point 1 is called an unstable attractor. (b) When C 1 = C 2 = 1, bx = by = 0, dx = dy = 1, x 0 = y 0 = 0, the solutions y and x remain identically 0, which is also a stationary solution. In this case, if we modify slightly x 0 , the solution converges quickly to the constant solution 0. The point 0 is called stable attractor. (c) When C 1 = C 2 = 1, bx = 0, by = 1, dx = dy = 1, x 0 = y 0 = 2 or C 1 = C 2 = 1, bx = by = 1, dx = dy = 1, x 0 = y 0 = 2, the additional term makes one population or the other disappear or explode.
(^00 1 2 3 4 5 6 7 8 9 )
1
2
3
y x
(^00 1 2 3 4 5 6 7 8 9 )
1
2
3
y x
(^00 1 2 3 4 5 6 7 8 9 )
1
2
3
y x
(^00 1 2 3 4 5 6 7 8 9 )
1
2
3
y x
(^00 1 2 3 4 5 6 7 8 9 )
2
4
6
8
10
12
x 10^12 y x
(^00 1 2 3 4 5 6 7 8 9 )
2
4
6
8
10
12
x 10^12 y x
Figure 7: Results for the predator-prey model. Left: Explicit Euler, right: RK4. First line: h = 0.01, second line: h = 0.5, third line: h = 2.
(^1) y (^1) y (^1) y x Figure 9: Results for the predator-prey model. Left: Explicit Euler, right: RK4. First row x 0 = y 0 = 0, second row x 00 .1 and y 0 = 0. we obtain a solution ~x = (5. 0000 , 9. 0000 , 12. 0000 , 14. 0000 , 15. 0000 , 15. 0000 , 14. 0000 , 12. 0000 , 9. 0000 , 5 .0000)T^ ,
- 00 1 2 3 4 5 6 7 8 9 x - 00 1 2 3 4 5 6 7 8 9 x