Sunteți pe pagina 1din 22

Assignment dierence and dierential equations 2009-2010: group 3

Gijs Immerman, Kevin Mann, Kenneth Plat and Sven Schmit 17th of December 2009

Contents
1 Problem 1 1.1 1.a . . 1.2 1.b . . 1.3 1.c . . 1.4 1.d . . 1.5 1.e . . 2 Problem 2 2.1 2.a . . 2.2 2.b . . 2.3 2.c . . 2.4 2.d . . 3 Problem 3 3.1 3.a . . 3.2 3.b . . 3.3 3.c . . 3.4 3.d . . 3.5 3.e . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

3 3 3 6 11 11 12 12 12 15 16 16 16 16 17 18 18 21 21

4 Appendix 4.1 Additional Matlab programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Problem 1
y(n + 1) = f (y(n)) := y(n)(1 y(n))

Consider the 1-parameter family of nonlinear dierence equations:


(1)

1.1

1.a

Write a program that plots, for given values of (0, 4) and x [2, 2], the solution of (1) with initial value y(0) = x, versus n. The following program, written in Matlab, makes those plots:
function [ z ] = diffdiffproblem1_a( a, x, n ) %DIFFDIFFPROBLEM1_A Plots for given values of alpha and x the solution of % (1) with initial value y(0) = x, versus n. if (a > 0) && (a < 4) && (x >= -2) && (x <= 2) y = zeros(n+1,1); y(1) = x; for i = 2:1:n+1 y(i) = a * y(i-1) * ( 1 - y(i-1)); end plot(0:n,y,'.b'); end end

The program has input parameters , y(0) and n. If and y(0) are within their given bounds, the program creates a (n + 1) 1 matrix y , where y 0. The rst element of y , y1 is set equal to input parameter y(0), then every other element of y , yi will be set to satisfy yi = yi1 (1 yi1 ) for i = 2, . . . , n + 1. Finally the program will plot y against n, which is what was asked for.
1.2 1.b

Choose 4 dierent values for : 1 = 0.4, 2 = 1.4, 3 = 3.2 and 4 = 3.49. In a single gure, 2 plot the line y = x and the graphs of f and f , for each value of . Use these gures to nd approximate values for all periodic solutions of period 2 and to estimate slopes of the tangents in order to examine the stability of these solutions. Write down your ndings and compare them to the theory. After writing a program in Matlab that makes these plots we nd the following gures (see appendix for the program): In gure (1) we notice that f intersects the x = y line twice, hence there are two xed points 2 (0 and 1.5) for = 0.4. The f0.4 graph intersects the x = y line at the same points, which is obvious since every equilibrium solution is also a solution with period two, however there are no 2 periodic solutions with minimal period two (which requires the f0.4 graph to intersect the x = y line at a point where the f0.4 graph does not intersect the x = y line). To check whether a xed point is (asymptotically) stable we look at the absolute value of the slope of the function f0.4 (or 2 f0.4 ) at the xed point, and then apply the theorem `if the slope is between 1 and 1 at a xed point, then that xed point is asymptotically stable and if the slope is less than 1 or greater than 1 it is unstable'. In (1) we see that for the xed point x = 1.5 the slope is about 1.5, so we can conclude that this is an unstable xed point. For the xed point x = 0 the slope is about 1/2, hence, x = 0 is an asymptotically stable point.
3

Figure 1: 1 = 0.4

Figure 2: 2 = 1.4

Figure 3: 3 = 3.2

Figure 4: 4 = 3.49

Figure (2), with = 1.4, is almost identical to gure (1). Again we notice that the graphs 2 of f1.4 and f1.4 have the same intersection with the x = y line. So again we have only two xed point and no periodic solution of minimal period two. The xed points are around x = 0 and x = 0.275. Here we notice that the slope of f at x = 0 is about 7/5, hence x = 0 is unstable. For the point x = 0.275 the tangent is around 3/4; we can conclude that this point is asymptotically stable. In gure (3) we observe that f has two intersections with the x = y line, namely x = 0 2 and x = 0.675. But the graph f3.2 has two additional intersections with the x = y line. This means that f3.2 has two periodic solutions of period two (with identical orbits). This periodic solution is about y {1/2, 4/5, 1/2, . . .}. Now for stability we rst look at the solution x = 0, which has a slope of about 2, hence the zero solution is unstable. The other equilibrium solution is at around x = 0.675, the slope is about 1, hence it is really dicult to say whether this equilibrium solution is stable or not, however after zooming in on the point (using Matlab) we nd that f3.2 (0.675) is a bit steeper than the x = y line, hence the solution is in fact unstable. The slopes around the periodic solutions, x = 0.5 and x = 0.8 are very close to zero, hence the periodic solutions are asymptotically stable. Figure (4) corresponds to = 3.49. In this gure you can see also that f3.49 has 2 xed points namely x = 0 and x = 0.7 and periodic solutions of minimal period 2 with x = 0.425 and x = 0.85. Looking at the slopes corresponding to the equilibrium solutions, we estimate for x = 0 a slope of 2.5 and for x = 0.7 a slope of about 1. Hence the null solution is unstable, but it is hard to tell whether x = 0.7 is stable or not. However, after further inspection using the zoom-function of Matlab, we nd that the slope is less than 1 and therefore also this solution is unstable. For the periodic solutions we nd the same negative slope of about 1, and again zooming in teaches us that these slopes are less than 1, hence the periodic solutions of minimal period two are unstable. In the lecture notes some characteristics of the logistic function as in (1) have been discussed. Firstly, the null solution is asymptotically stable for 0 < < 1 and unstable for > 1, this is in agreement with the conclusions we have drawn using the plots. Lastly, computing periodic solutions of (1) yields that for > 3, there are two periodic solutions with minimal period two, +1 (+1)(3) . This implies that for = 3.2 we should nd periodic solutions given by x = 2 with orbit {0.51, 0.80} and for = 3.49 periodic solutions with orbit {0.43, 0.86}. In the lecture notes it noted that 2-periodic solutions found for > 3 are asymptotically stable for is the < 1 + 6. Since 1 + 6 3.45, this is in agreement with our ndings.
1.3 1.c

For each of the 4 values of , choose an initial value x1 (0, 1), not coinciding with an equilibrium point of (1), and a value x2 outside the basin of attraction of the attractor, and plot the corresponding solutions. Using the program built for problem 1.a, we made gures 5, 6, 7, 8, 9, 10, 11 and 12. In gure 5 we nd that the sequence quickly converges to the null solution, which is obvious since x1 is in the basin of attraction of the null solution. x2 however, plotted in 6, goes to , just like in gures 8, 10 and 12. This is due to x2 not being an element of the basin of attraction of any xed point, nor being a xed point itself. 2 Figure 7 shows that y converges to the equilibrium solution 7 (see problem 1.d for more details)). In gure 9 the sequence converges to the two-periodic solution and nally in gure 11 we nd that the sequence converges to a four-periodic solution.

Figure 5: = 0.4 and x1 = 0.4

Figure 6: = 0.4 and x2 = 1.6

Figure 7: = 1.4 and x1 = 0.4

Figure 8: = 1.4 and x2 = 1.6

Figure 9: = 3.2 and x1 = 0.4

Figure 10: = 3.2 and x2 = 1.6

Figure 11: = 3.49 and x1 = 0.4

Figure 12: = 3.49 and x2 = 1.6

10

1.4

1.d

Linearize equation (1) for = 2 at the asymptotically stable equilibrium point. Provide a simple expression for the general term yi (n) of the solution yi of the linearized equation, with initial value xi (chosen in part c)), for i = 1 and i = 2. Check the initial value in each case. 2 7 First we derive the xed points by solving x = 5 x(1 x). We nd that x = 7 or x = 0 2 are the xed points. Since x = 0 is not stable we use x = 7 The rst derivative of y = 7 x 7 x2 5 5 2 is equal to y = 7 14 x. For x = 2 we get f ( 7 ) = 3 . The linear approximation gives us 5 5 7 5 3 x1 = 2 + 5 (x1 2 ), where x1 2 . Hence, the linear dierence equation is given by: 7 7 7
4 3 + y(n) (2) 35 5 To nd a simple expression for the general term yi (n) of the solution of (2) for (1 i 2) 3 corresponding to initial values x1 = 5 and x2 = 8 of the linearized equation, we rst nd a 5 y(n + 1) =

general solution of the homogenous part of the linearized dierence equation:


y(n + 1) y(n + 1) 3 y(n) 5 y(n) = = = 3 y(n) 5 0 3 5
n

Then we add a particular solution for the linearized equation, we choose the equilibrium 3 n solution y 2 , as that is the most easy one to work with, to nd y(n) = 5 c + 2 . Solving c 7 7 for x1 and x2 yields:
y1 (n) = 4 35 66 35 3 5 3 5
n

+
n

2 7 2 7

(3) (4)

y2 (n) =
1.5 1.e

Using the expressions found in d), discuss the asymptotic behaviour of y1 and y2 and compare it to the behaviour of the solution of the original, nonlinear equation with the same initial value. Explain the discrepancies that you observe in terms of basins of attraction. Sequences (3) and (4) both converge towards 2 as n . In fact, since 3 is smaller than 7 5 1, any sequence will converge to 2 when n (See (5)). The basin of attraction of = 1.4, 7 2 y 7 in the nonlinear equation is (0, 1). The discrepancies in the basin of attraction, which, in this linearized equation is (, ), obviously have to do with the fact that we linearized the dierence equation around 2 , treating all initial values as if they are in close neighbourhood of 7 2 7.
2 y(n) = (y0 ) 7 3 5
n

2 7

(5)

11

2
2.1

Problem 2
2.a

Write a program that produces, for given real numbers 0 < min < max 4, initial value x0 (0, 1), number of preiterates n0 and total number of iterates nmax , in an (, y)-coordinate system, a bifurcation diagram of (1), on the interval (min , max). The following program makes those bifurcation diagrams: 1 2
function [ ] = diffdiffproblem2_a( amin, amax, x0, n0, nmax ) %DIFFDIFFPROBLEM2_A Plots bifurcation diagram of (1) if (amin > 0) && (amax <= 4) && (amin < amax) && (x0 > 0) && (x0 < 1) && (n0 >= 0) && (nmax >= 1) a = amin : 0.01 : amax; w = zeros(nmax-n0+1,length(a)); for i = 1:length(a); w(:,i) = diffdiff_logistic(a(i),x0,n0,nmax); end hold on for j = 1:nmax-n0+1; plot(a,w(j,:),'b.'); end end end hold off;

The program uses min , max , x0 , n0 and nmax as input parameters. If these are within their bounds, the program will create an array of alphas ranging from min to max with step size 0.01. Then, a zero matrix w with dimensions (nmax n0 + 1) (# of entries in the array of alphas) is created. In the next step the entries of w are changed. For each column i (and hence, a given value of ) a row is calculated by the logistic function, which returns a vector [y(n0 ), y(n0 + 1), , y(nmax )] corresponding to the value of (see appendix). Finally the program plots the column entries of w against the array of alphas.
2.2 2.b

Produce bifurcation diagrams with min < 1 , max > 4 and dierent values of x and n0 . Compare the diagrams and explain the dierences. Name the types of bifurcations that you observe. Figures 13, 14, 15 and 16 show bifurcation diagrams with dierent values of x and n0 . 3 We can see all four diagrams have the same shape. At = 1 a transcritical bifurcation occurs, this means at the parameter value = 1 a transfer of stability from one solution (here y 0) to another one takes place. When the number of preiterates is small, say n0 10, for a given
1 Note that we do not count preiterates as iterates, hence it is perfectly possible to 2 Note that the logistic function programs can be found in the appendix 3 We used a = 0.3, a = 3.6 and n = 500 in all bifurcation diagrams.
min max max
have

n0 = 10 and nmax = 1.

12

Figure 13: n0 = 1 and y0 = 0.2

Figure 14: n0 = 10 and y0 = 0.5

13

Figure 15: n0 = 100 and y0 = 0.75

Figure 16: n0 = 1000 and y0 = 0.95

14

the range of values of y(n) is still quite large (when the number of preiterates is large, as y(n) converges, the range of values of y(n) at a given is smaller), hence, in gure 13 (and less obviously in 14) it not yet clear at = 1 a transcritical bifurcation occurs. Furthermore, in all four gures a period-doubling bifurcation occurs at = 3: an asymptotically stable equilibrium

solution gives way to two asymptotically stable 2-periodic solutions. Again, when the number of preiterates is large, this can be seen quite easily. Whilst the gures in which the number of preiterates is small show more `noise' from values of y(n) with n small. Also at 3.5 (to be precise = 1 + 6) a period-doubling bifurcation occurs. Here two asymptotically stable 2-periodic solutions give way to four asymptotically 4-periodic solutions (with identical orbits).
2.3 2.c

Use the bifurcation diagrams to determine the periods of the asymptotically stable solutions of the equation for [1 , 4 ].

Figure 17: A bifurcation diagram for [1 , 4 ] Figure 17 shows a bifurcation diagram with [1 , 4 ], x0 = 0.5, nmax = 1000 and to clear the `noise' the number of preiterates is set to n0 = 100. From this diagram we deduce the periods of the asymptotically stable solution for [1 , 4 ]. We have four cases: 2/5 < 1: There is one asymptotically stable solution, namely the null solution (y 0).
1 < < 3: A 1-periodic asymptotically stable solution occurs. 3 < < 1 + 6: A 2-periodic asymptotically stable solution occurs. 1 + 6 < 3.49: A 4-periodic asymptotically stable solution occurs.

Note that these results are in agreement with what we had found in problem 1.b). 15

2.4

2.d

From the bifurcation diagram deduce approximate values for the elements of f (x) when = 4 . Again, we use gure 17 to deduce approximate values for the elements of f (x) when = 4 = 3.49. With the aid of the data cursor in MATLAB, we can look up approximate values of y(n) at = 3.49. In accordance with our nding in problem 2c), we should nd four elements since 3.49 (1 + 6, 3.49]. These elements are 0.389, 0.494, 0.829 and 0.972. We conclude f3.49 (x) = {0.389, 0.494, 0.829, 0.972}. Hence, for x (0, 1) there exist subsequences of (1) converging to either one of the elements of f3.49 (x).

3
3.1

Problem 3
3.a

Consider the 1-th parameter family of equations:


y(n + 1) = y(n) 1 y(n)
3.2 3.b
2

(6)

Compute all real equilibrium solutions of (6) and prove that, at a certain parameter value 0 , (6) undergoes a pitchfork bifurcation. To nd all real equilibrium solutions we rst dene function f : R R by f (x) = x(1x2 ), and then solve x = f (x) (note that f is a polynomial and therefore a C function):
x = f (x) = x(1 x2 ) = x x3

Now the rst solution is evident, namely x = 0. Suppose x = 0, then we have:


x = 1 x
2

x x3 x2 1 1

= = =

x2

Hence we nd real valued solutions: x = 1 or x = 1 for [0, 1) / To prove there is a pitchfork bifurcation at some 0 , we look at the stability of the equilibrium solutions. First we calculate the derivative of f :
d f (x) = 3x2 dx

Plugging in our equilibrium solutions we nd:


d f (0) = dx d Note that dx f (0) < 1 for 1 < < 1. Applying theorem 1.2.5, we nd that y 0 is an asymptotically stable solution of (6) for 1 < < 1. Furthermore: d f dx 1 = 3 1 = 3 2

16

d Hence dx f ( 1 ) < 1 for 1 < < 2. Again applying theorem 1.2.5 yields y 1 are asymptotically stable solutions of (6) for 1 < < 2. To show there is a pitchfork bifurcation at 0 = 1 we rst note that for 0 < < 1 we have a unique asymptotically stable equilibrium solution, and for 1 < < 2 we have two asymptotically stable equilibrium solutions. Furthermore for > 1 we have 1 > 0 and 1 < 0. Hence there must be a pitchfork bifurcation at 0 = 1 (See gure 18).

Figure 18: Pitchfork bifurcation at 0


3.3 3.c

Adapt your program in 2.a) in such a way that it can produce bifurcation diagrams of (6), showing either one or both sides of the pitchfork at the same time. Explain the dierence between a pitchfork bifurcation and a period doubling bifurcation. The following program produces bifurcation diagrams of (6):
function [ ] = diffdiffproblem3_c( amin, amax, x0, y0, n0, nmax ) %DIFFDIFFPROBLEM2_A Plots bifurcation diagram of (6) % Recommended values: 0.4, 1.1 if (amin < amax) && (n0 >= 0) && (nmax >= 0) a = amin : 0.01 : amax; w = zeros(nmax-n0+1,length(a)); v = zeros(nmax-n0+1,length(a)); for i = 1:length(a); w(:,i) = diffdiff_logisticsquare(a(i),x0,n0,nmax); v(:,i) = diffdiff_logisticsquare(a(i),y0,n0,nmax); end

17

end end

clf hold on; for j = 1:nmax-n0+1; plot(a,w(j,:),'r.'); plot(a,v(j,:),'b.'); end hold off;

This program is quite similar to the one just in problem 2.a), hence we will only point out the dierences. First, since we want to be able to plot two sides of the pitchfork at the same time, we have to be able to use two dierent initial values. With only one initial value it is not possible to show both sides of the pitchfork as by denition of a pitchfork bifurcation, a sequence can only converge to one side of the pitchfork (see below). Second, some other constraints about whether the program should run are dierent, but they are all rather trivial. Since we have two initial values, we also need two matrices (v and w), corresponding to the initial values. Since we consider a dierent 1-parameter family of equations, we use another function to nd the correct sequences, however this function is almost identical to the one used in problem 2.a) (see appendix). Finally, we plot two, instead of one, bifurcation diagram. The dierence between a pitchfork bifurcation and a period doubling bifurcation: A pitchfork bifurcation happens where one asymptotically stable equilibrium splits into two asymptotically stable equilibriums, but both of these equilibriums still have the same period as the `unique' asymptotically stable equilibrium. However a period doubling bifurcation means that an (periodic) asymptotically stable solution with period p becomes an asymptotically stable solution with period 2p.
3.4 3.d

Produce bifurcation diagrams showing either side of the pitchfork alone, or two sides of the pitchfork simultaneously, for (3, 3). The upper part of the pitchfork, as seen in gure 19, is constructed by using initial values 1 for y0 = 0.4 and x0 = 0.4, as the sequence with 0.4 as initial value will converge to 1 < < 2 as n . Figure 20 shows lower part of the pitchfork. Here we used initial values y0 = 1.1 and x0 = 1.1, since a sequence with such initial value will converge to 1 for 1 < < 2 as n . Finally, if we combine a sequence with initial value y0 = 0.4 with a sequence with initial value x0 = 1.1 we get to see both sides of the pitchfork, as in gure 21.
3.5 3.e

1 Use iteration to compute the solution of (6) with initial value y(0) = 1 + for suitable values of and examine its stability. Compare the result with the bifurcation diagram in the previous part.

18

Figure 19: y0 = 0.4

Figure 20: y0 = 1.1

19

Figure 21: y0 = 0.4, x0 = 1.1

y(n + 1) y(0)

y(n) 1 y(n) 1+ 1 +1

= =

y(1) = +1 1 +1

= =

+1 +1 1

y(2)

+1 ( 1) +1 = +1 +1 = 1 = +1 +1

y(3)

. . = .

. . .

20

Hence we nd a 2-periodic solution y { +1 , +1 , +1 , }. However, there are some restrictions on for this to hold. We have +1 0 and = 0. This implies < 1 or > 0. To examine the stability of this solution we rst dene f as in 3.b). Recall f is continuous d and dx f (x) = 3x2 . Then we have:
d 2 f ( dx +1 ) = = = = = = f (f (x)) f (x) +1 +1 )) f ( ) +1 +1 f ( ) f ( ) 2 +1 ( 3 f (f ( (( 3( + 1)) (2 + 3)2
2

Now we want to apply theorem 1.2.11 to nd the values of for which we have asymptotically d 2 1 stable periodic solutions. Hence we want to nd values for such that 1 < dx f ( 1 + ) < 1
1 < 1 < 0< 1 < 2 <
d 2 dx f ( +1 ) 2

<1 <1 <1 <1 < 1

(2 + 3) 2 + 3

|2 + 3|

Hence should be between 2 and 1 to have asymptotically stable periodic solution with 1 1 orbit { 1 + , 1 + }. This corresponds to the bifurcation diagrams in gures (19), (20) and (21).

4
4.1

Appendix
Additional Matlab programs

The program used for the plots in problem 1.b:


function [ ] = diffdiffproblem1_b( a ) %DIFFDIFFPROBLEM1_B plots y = x, y = f_a and f^2_a in one figure for a % given value of alpha x = -2:0.01:2; y = x; plot(x,y);

21

hold on f = a .* x .* ( 1 - x); plot(x,f,'r') g = a .* (a .* x .* ( 1 - x)) .* ( 1 - (a .* x .* ( 1 - x))); plot(x,g,'g') hold off end

The program that computes the n0 -th through to the nmax iterate (as a vector) of (1) for a given y0 :
function [ y ] = diffdiff_logistic( a, y0, n0, nmax) %DIFFDIFF_LOGISTIC Calculates y(n) for a given y0 of the difference % equation y(n+1) = ay(n)(1-y(n)) y = zeros(1,nmax-n0+1); y(1) = y0; for i = 1:n0 y(1) = a*y(1) * (1-y(1)); end for i = 2:nmax-n0+1 y(i) = a*y(i-1) * (1-y(i-1)); end

end

The program that computes the n0 -th through to the nmax iterate (as a vector) of (6) for a given y0 :
function [ y ] = diffdiff_logisticsquare(a, y0, n0, nmax) %DIFFDIFF_LOGISTIC Calculates y(n) for a given y0 of the difference % equation y(n+1) = ay(n)(1-(y(n))^2) y = zeros(1,nmax-n0+1); y(1) = y0; for i = 1:n0 y(1) = a*y(1) * (1-y(1)*y(1)); end for i = 2:nmax-n0+1 y(i) = a*y(i-1) * (1-y(i-1)*y(i-1)); end

end

22

S-ar putea să vă placă și