ΠΑΝΕΠΙΣΤΗΜΙΟ ΙΩΑΝΝΙΝΩΝ ΑΝΟΙΚΤΑ ΑΚΑΔΗΜΑΪΚΑ ΜΑΘΗΜΑΤΑ Ηλεκτρονικοί Υπολογιστές IV Εισαγωγή στα δυναμικά συστήματα Διδάσκων: Επίκουρος Καθηγητής Αθανάσιος Σταυρακούδης
Άδειες Χρήσης Το παρόν εκπαιδευτικό υλικό υπόκειται σε άδειες χρήσης Creative Commons. Για εκπαιδευτικό υλικό, όπως εικόνες, που υπόκειται σε άλλου τύπου άδειας χρήσης, η άδεια χρήσης αναφέρεται ρητώς.
Dynamics in Economics A very short introduction to difference and differential equations Athanassios Stavrakoudis http://stavrakoudis.econ.uoi.gr
Bibliography Ronald Shone An Introduction to Economic Dynamics Cambridge, 2001 2 / 41
Dynamic model fixed point algebra model : x t+1 = α + βx t 3 / 41
Dynamic model fixed point algebra model : x t+1 = α + βx t equilibrium : x t+1 = x t 4 / 41
Dynamic model fixed point algebra model : x t+1 equilibrium : x t+1 = α + βx t = x t let x : x t+1 = x t 5 / 41
Dynamic model fixed point algebra model : x t+1 equilibrium : x t+1 = α + βx t = x t let x : xt+1 thus : x = x t = α + βx 6 / 41
Dynamic model fixed point algebra model : x t+1 = α + βx t equilibrium : x t+1 = x t let x : xt+1 = x t thus : x = α + βx fixed point : x = α 1 β 7 / 41
Dynamic model fixed point algebra model : x t+1 = α + βx t equilibrium : x t+1 = x t let x : xt+1 = x t thus : x = α + βx fixed point : x = α 1 β if : α = 3, β = 0.4 8 / 41
Dynamic model fixed point algebra model : x t+1 = α + βx t equilibrium : x t+1 = x t let x : xt+1 = x t thus : x = α + βx fixed point : x = α 1 β if : α = 3, β = 0.4 then : x = 3 1 0.4 = 3 0.6 = 5 9 / 41
Dynamic model fixed point graph x t+1 = 3 + 0.4 x t 8 7 6 5 x(t+1) 4 3 2 1 x(t+1)=3+0.4*x(t) 0 0 1 2 3 4 5 6 x(t+1)=x(t) 7 8 x(t) 10 / 41
Code for the graph 1 c l e a r ; 2 set ( gca, f o n t s i z e, 24) 3 4 a l p h a = 3 ; 5 beta = 0. 4 ; 6 x s t a r = a l p h a / (1 beta ) ; 7 N = 8 ; 8 t = 0 :N; 9 x = a l p h a + beta t ; 10 11 p l ot ( t, x, b, l i n e w i d t h, 8, t, t, r, l i n e w i d t h, 4 ) ; 12 box o f f ; 13 legend ( x ( t +1)=3+0.4 x ( t ), x ( t+1)=x ( t ), L o c a t i o n, SouthEast ) ; 14 x l a b e l ( x ( t ) ) ; 15 y l a b e l ( x ( t +1) ) ; 16 g r i d on ; 17 hold on ; 18 p l ot ( x s t a r, x s t a r, s, m a r k e r s i z e, 1 2 ) ; 19 hold o f f ; 20 21 p r i n t depsc2 l a n d s c a p e dynamic1. eps 22 p r i n t djpg dynamic1. j p g 11 / 41
Code to experiment with 1 c l e a r ; 2 3 a l p h a = 3 ; 4 beta = 0. 4 ; 5 x s t a r = a l p h a / (1 beta ) ; 6 N = 8 ; 7 8 x ( 1 ) = 1. 5 ; 9 10 f o r ( t = 1 :N) 11 x ( t +1) = a l p h a + beta x ( t ) ; 12 end 13 14 t = 0 :N; 15 [ t x ] 12 / 41
Dynamic model convergence, x(0)=1.5 x t+1 = 3 + 0.4 x t x 0 = 1.5 6 5 4 x 3 2 1 0 0 2 4 6 8 10 12 t 13 / 41
Dynamic model convergence, x(0)=15 x t+1 = 3 + 0.4 x t x 0 = 15 20 15 x 10 5 0 0 2 4 6 8 10 12 14 t 14 / 41
Sequence convergence 1 a l p h a = 3 ; 2 beta = 0. 4 ; 3 e p s i l o n = 1e 4; 4 Nmax = 100; 5 t = 1 ; 6 x ( t ) = 1. 5 ; 7 x ( t +1) = a l p h a + beta x ( t ) ; 8 d e l t a = abs ( x ( t +1) x ( t ) ) ; 9 10 conv = y e s ; 11 while ( d e l t a >= e p s i l o n ) 12 t = t +1; 13 i f ( t >= Nmax) 14 conv = no ; 15 break ; 16 end 17 x ( t +1) = a l p h a + beta x ( t ) ; 18 d e l t a = abs ( x ( t +1) x ( t ) ) ; 19 end 20 21 x 22 p r i n t f ( c o n v e r g e n c e = %s \n, conv ) ; 15 / 41
Playing with the parameters parameter α 1 α x 2 α x parameter β x = 1 0 < β < 1, converging to x. 2 β = 1, no fixed point α 1 β 3 1 < β < 0, converging to x, but only after oscillation. 4 β = 1, oscillating between two values. 5 β < 1, oscillating around x, but diverging more and more. 16 / 41
Dynamic model β = 1 x t+1 = 3 + 1 x t, x 0 = 1.5 30 25 20 x 15 10 5 0 0 2 4 6 8 10 t 17 / 41
Dynamic model β = 0.6 x t+1 = 3 0.6 x t, x 0 = 1.5 3 2.5 x 2 1.5 1 0 2 4 6 8 10 t 18 / 41
Dynamic model β = 1 x t+1 = 3 1 x t, x 0 = 5 6 5 4 3 2 x 1 0-1 -2-3 0 2 4 6 8 10 t 19 / 41
Dynamic model β = 1.25 x t+1 = 3 1.25 x t, x 0 = 1.5 6 5 4 3 2 x 1 0-1 -2-3 0 2 4 6 8 10 t 20 / 41
Code for parameter playing 1 a l p h a = 3 ; 2 beta = 1. 25; 3 x s t a r = a l p h a / (1 beta ) 4 N = 1 0 ; 5 x = zeros (N, 1 ) ; 6 x ( 1 ) = 1. 5 ; 7 8 f o r ( t = 1 :N) 9 x ( t +1) = a l p h a + beta x ( t ) ; 10 end 11 12 t = ( 0 :N) ; 13 [ t x ] 14 15 p l ot ( t, x, ob, l i n e w i d t h, 8, MarkerSize, 1 2 ) ; 16 17 p r i n t depsc2 l a n d s c a p e dynamics3e. eps 18 p r i n t djpg dynamics3e. j p g 21 / 41
Difference equation of a dynamic model x t+1 = 3 0.6 x t 4 3 2 dx(t+1) 1 0-1 -2 0 1 2 3 4 5 6 7 8 x(t) 22 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t 10 5 0 x(t+1) -5-10 -15-20 x(t+1)=10-0.2*x 2 (t) x(t+1)=x(t) -25-15 -10-5 0 5 10 x(t) 23 / 41
Code for the nonlinear graph 1 a l p h a = 0.2; 2 beta = 0 ; 3 gamma = 1 0 ; 4 x s t a r = roots ( [ a l p h a beta 1 gamma ] ) 5 x = l i n s p a c e ( 13, 8, 4 3 ) ; 6 y = a l p h a x. ˆ 2 + beta x + gamma; 7 y s t a r = a l p h a x s t a r. ˆ 2 + beta x s t a r + gamma; 8 9 p l ot ( x, y, b, l i n e w i d t h, 8, x, x, r, l i n e w i d t h, 4 ) 10 a x i s ([ 5 4 10 6 ] ) ; 11 box o f f ; 12 legend ( x ( t +1)=4 0.64 x ˆ2( t ), x ( t+1)=x ( t ), L o c a t i o n, 13 x l a b e l ( x ( t ) ) ; 14 y l a b e l ( x ( t +1) ) ; 15 g r i d on ; 16 hold on ; 17 p l ot ( x s t a r, y s t a r, s, m a r k e r s i z e, 1 2 ) ; 18 hold o f f ; 24 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 5 6 4 2 x 0-2 -4-6 0 5 10 15 20 t 25 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 5 5.6 5.4 5.2 x 5 4.8 4.6 4.4 0 5 10 15 20 t 26 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 10-9 -9.5 x -10-10.5-11 0 5 10 15 20 t 27 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 10 10 5 x 0-5 -10 0 5 10 15 20 t 28 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 4 10 5 x 0-5 -10 0 5 10 15 20 t 29 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 9 10 5 x 0-5 -10 0 5 10 15 20 t 30 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 9.999 10 5 x 0-5 -10 0 5 10 15 20 t 31 / 41
Non linear dynamic model x t+1 = 10 0.2 x 2 t, x 0 = 10.001-10 -15-20 x -25-30 -35 0 1 2 3 4 5 6 7 t 32 / 41
Non linear dynamic differences x t+1 = 10 0.2 x 2 t x t 15 dx(t+1)=10-0.2*x 2 (t)-x(t) x(t+1)=x(t) 10 5 dx(t+1) 0-5 -10-10 -5 0 5 x(t) 33 / 41
Continuous time Differential equation Example dx dt = f (x) dx dt = 3 5 x + 3 Alternative ẋ = 3 5 x + 3 Differential equations are preferred for continuous time models. Difference equations are preferred for discrete time models. 34 / 41
Fixed point differential equation ẋ = 3 0.6 x 4 3 2 dx(t+1) 1 0-1 -2 0 1 2 3 4 5 6 7 8 x(t) Solve 3 0.6 x = 0 x = 5 Exactly the same solution as x t+1 = 3 0.6 x t 35 / 41
Differential equation solution Remember Maxima? ẋ = 3 3 5 x x(0) = 1 36 / 41
Differential equation solution Remember Maxima? ẋ = 3 3 5 x x(0) = 1 x = 5 4 e 3 t 5 37 / 41
Differential equation solution Remember Maxima? ẋ = 3 3 5 x x(0) = 1 x = 5 4 e 3 t 5 38 / 41
Plot solution differential equation x t = 5 4 e 3 5 t 39 / 41
Take home problems Find the fixed points, establish the stability properties and graph the following systems: x t+1 = 3 + 1 2 x t, x 0 = 1 x t+1 = x 2 t 5 x t + 4, x 0 = 1 ẋ = x 2 + x 2,, x(0) = 1 40 / 41
Σχόλια και ερωτήσεις Σας ευχαριστώ για την προσοχή σας. Είμαι στη διάθεσή σας για σχόλια, απορίες και ερωτήσεις. 41 / 41
Τέλος Ενότητας
Χρηματοδότηση Το παρόν εκπαιδευτικό υλικό έχει αναπτυχθεί στα πλαίσια του εκπαιδευτικού έργου του διδάσκοντα. Το έργο «Ανοικτά Ακαδημαϊκά Μαθήματα στο Πανεπιστήμιο Ιωαννίνων» έχει χρηματοδοτήσει μόνο τη αναδιαμόρφωση του εκπαιδευτικού υλικού. Το έργο υλοποιείται στο πλαίσιο του Επιχειρησιακού Προγράμματος «Εκπαίδευση και Δια Βίου Μάθηση» και συγχρηματοδοτείται από την Ευρωπαϊκή Ένωση (Ευρωπαϊκό Κοινωνικό Ταμείο) και από εθνικούς πόρους.
Σημειώματα
Σημείωμα Ιστορικού Εκδόσεων Έργου Το παρόν έργο αποτελεί την έκδοση 1.0. Έχουν προηγηθεί οι κάτωθι εκδόσεις: Έκδοση 1.0 διαθέσιμη εδώ. http://ecourse.uoi.gr/course/view.php?id=1155.
Σημείωμα Αναφοράς Copyright Πανεπιστήμιο Ιωαννίνων, Διδάσκων: Επίκουρος Καθηγητής Αθανάσιος Σταυρακούδης. «Ηλεκτρονικοί Υπολογιστές IV. Εισαγωγή στα δυναμικά συστήματα». Έκδοση: 1.0. Ιωάννινα 2014. Διαθέσιμο από τη δικτυακή διεύθυνση: http://ecourse.uoi.gr/course/view.php?id=1155.
Σημείωμα Αδειοδότησης Το παρόν υλικό διατίθεται με τους όρους της άδειας χρήσης Creative Commons Αναφορά Δημιουργού - Παρόμοια Διανομή, Διεθνής Έκδοση 4.0 [1] ή μεταγενέστερη. [1] https://creativecommons.org/licenses/by-sa/4.0/.