Transcript Dynamical systems 1
Dynamical Systems 1
Introduction
Ing. Jaroslav J íra, CSc.
Definition
Dynamical system
is a system that changes over time according to a set of fixed rules that determine how one state of the system moves to another state.
Dynamical system
is a phase space together with a transformation of that space A dynamical system has two parts a) a
state vector
, which describes exactly the state of some real or hypothetical system b) a
function
, which tells us, given the current state, what the state of the system will be in the next instant of time
A state vector
can be described by
x
(
t
)
[
x
1
(
t
),
x
2
(
t
),......,
x n
(
t
)]
A function
can be described by a single function or by a set of functions
f
1
(
x
1
,
x
2
,....,
x n
),
f
2
(
x
1
,
x
2
,....,
x n
),....,
f n
(
x
1
,
x
2
,....,
x n
)
Entire system can be then described by a set of differential equations of motion – equations .
dx
1
dt dx
2
dt
x
1
x
2
f
1 (
x
1 ,
x
2 ,....,
x n
)
f
2 (
x
1 ,
x
2 ,....,
x n
) .
dx n dt
x
n
f n
(
x
1 ,
x
2 ,....,
x n
)
Classification of Dynamical Systems
Linear Autonomous Conservative Discrete One-dimensional Nonlinear Nonautonomous Nonconservative Continous Multidimensional
Linear system
– a function describing the system behavior must satisfy two basic properties • additivity
f
(
x
y
)
f
(
x
)
f
(
y
) • homogeneity
f
(
x
)
f
(
x
)
For example f(x) = 3x; f(y) = 3y; • additivity • homogeneity f(x+y) = 3(x+y) = 3x + 3y = f(x) + f(y) 5 * f(x) = 5* 3x = 15x = f(5x)
Nonlinear system
is described by a nonlinear function. It does not satisfy previous basic properties For example f(x) = x 2 ; f(y) = y 2 ;
f
(
x
y
) (
x
y
) 2
x
2 2
xy
y
2
f
( 5
x
) ( 5
x
) 2 25
x
2 5
f
(
x
) 5
x
2
f
(
x
)
f
(
y
)
x
2
y
2
Autonomous system
is a system of ordinary differential equations, which do not depend on the independent variable. If the independent variable is time, we call it
time-invariant system
.
Condition: If the input signal input,
x(t + x(t)
produces an output
δ)
, results in a time-shifted output
y(t + y(t) δ)
then any time shifted Example: we have two systems System A:
System A:
Start with a delay of the input System B:
y
(
t
) 10
x
(
t
) Now we delay the output by δ Clearly
nonautonomous
.
, therefore the system is not time-invariant or is
System B:
Start with a delay of the input Now delay the output by δ Clearly therefore the system is time-invariant or
autonomous
.
Conservative system
- the total mechanical energy remains constant, there are no dissipations present, e.g. simple harmonic oscillator
Nonconservative (dissipative) system
– the total mechanical energy changes due to dissipations like friction or damping, e.g. damped harmonic oscillator
Discrete system
– is described be a difference equation or set of equations. In case of a single equation we are also talking about one-dimensional map . We denote time by
k
, and the system is typically specified by the equations
x
( 0 )
x
(
k
1 )
x
0
x
(
k
)
f f
(
x
(
k k
(
x
0 ) )) The system can be solved by iteration calculation. Typical example is annual progress of a bank account. If the initial deposit is 100000 crowns and annual interest is 3%, then we can describe the system by
x
( 0 )
100000
x
(
k
1 )
1 .
03
x
(
k
)
x
(
k
)
1 .
03
k
* 100000
Continous system
– is described by a differential equation or a set of equations.
x
( 0 )
x
´
f
x
(
x
) 0 For example, vertical throw is described by initial conditions h(0), v(0) and equations
h
(
t
)´
v
(
t
)
v
(
t
)´
g
where
h
is height and
v
is velocity of a body.
Definition from the Mathematica: When the reals are acting, the system is called a continuous dynamical system, and when the integers are acting, the system is called a discrete dynamical system.
One-dimensional system
is described by a single function like
x
(
k
1 )
ax
(
k
)
b x
´(
t
)
ax
(
t
)
b
where a , b are constants.
Multidimensional system
x
x
( ´(
k t
) is described by a vector of functions like 1 )
A
x
(
A
x
(
t
)
k
)
B
B
where
x
is a vector with
n
components,
A
is
n x n
matrix and
B
is a constant vector
Repetition From the Matrix Algebra
Matrix A Matrix B Vector C
A
a a
11 21
a
31
a
12
a
22
a
32
a a
13
a
23 33
B
b b b
11 21 31
b
12
b
22
b
32
b
13
b
23
b
33
C
c c
1
c
2 3
A.B
a a
11 31
b b
11
a
21
b
11 11
a
12
b
21
a
22
b
21
a
32
b
21
a
13
b
31
a
23
b
31
a
33
b
31
A.
C
a a
11 31
c a
21
c
1
c
1 1
a
22
c
2
a
12
c
2
a
32
c
2
a a
13 33
c c
3
a
23
c
3 3
a
11
b
12
a a
21 31
b b
12 12
a
12
b
22
a
22
b
22
a
32
b
22
a
13
b
32
a
23
b
32
a
33
b
32
a
11
b
13
a a
21 31
b b
13 13
a
12
b
23
a
22
b
23
a
32
b
23
a a
13 33
b b
33
a
23
b
33 33
Identity matrix
(unit matrix), we use symbol
E
or
I
E
1 0 0 0 1 0 0 0 1
Determinant
D
d
11
d
12
d
21
d
22 det(
D
)
d
11
d
22
d
21
d
12
A
a
11
a
21
a
31
a
12
a
22
a
32
a
13
a
23
a
33
a a
11
a
21 31
a
12
a
22
a
32 det(
A
)
a
11
a
22
a
33
a
12
a
23
a
31
a
13
a
21
a
32
a
11
a
23
a
32
a
12
a
21
a
33
a
13
a
22
a
31
Inversion matrix
– 2x2
A
a c b d
A
1
a c b d
1 1 det(
A
)
a c
d b
ad
1
cb
a c
d b
Inversion matrix
– 3x3
Eigenvalues
and
Eigenvectors
The eigenvectors of a square matrix are the non-zero vectors which, after being multiplied by the matrix, remain proportional to the original vector (i.e. change only in magnitude, not in direction). For each eigenvector, the corresponding eigenvalue λ is the factor by which the eigenvector changes when multiplied by the matrix.
A
u
u
For the eigenvalue calculation we use the formula det(
A
E
) 0
For the eigenvector calculation we use the formula: (
A
E
)
u
0 Two-dimensional example:
a
11
a
21
a
22
a
12
u u
2 1 0 If we are successful in finding eigenvalues, we can say, that we found a diagonal matrix , which is similar to the original matrix. The diagonal matrix has the same properties like the original one for the purpose of solving dynamical system stability. We write the diagonal matrix in the form: 1
0 0 0 0
2
0 0 0 0 ...
0 0 0 0
n
What are advantages of diagonal matrix?
1. Multidimensional discrete system.
The typical formula is:
x
(
k
1 )
A
x
(
k
) To obtain k-th element:
x
(
k
)
A
k
x
( 0 ) Raising matrices to the power is quite difficult, but in case of diagonal matrix we simply have:
A
k
1
0 0 0
k
0
2
k
0 0 0 0 ...
0 0 0 0
n k
2. Multidimensional continous system.
The typical differential equation:
d
x
A
x
(
t
)
dt
Solution of the equation:
x
(
t
)
x
0 exp(
A
t
) Using matrices as an argument for the exponential function is much more difficult than raising them to the power, but in case of diagonal matrix we can write:
exp(
A
t
)
e
0 0 0
1
t
0
e
2
t
0 0 0 0 ...
0
e
0 0 0
n t
Example for eigenvalue and eigenvector calculation Initial matrix
A
4 1 2 5 Characteristic equation Eigenvalues det(
A
E
) det 4 1 5 2 0 ( 4 )( 5 ) 1 6 ; 2 3 2 2 9 18 0 Eigenvector calculation 4 1 1 5 2 1
u u
2 1
u
1 2
u
1
u
2 2
u
2 0 0 1 2
u
1 1 1 2 1
u u
2 1 0 4 1 2
u
1
u
1 2
u
2 2
u
2
u
2 1 2 2 5 2
u u
1 2 0 0 1 1 2 2
u u
2 1 0 Any vector that satisfies condition u 1 =u 2 is an eigenvector for the λ=6 Any vector that satisfies condition u 1 =-2u 2 is an eigenvector for the λ=3
Automatic eigenvalue and eigenvector calculation in the Mathematica
Trace
of a matrix is a sum of the elements on the main diagonal
Tr
(
A
)
a
11
a
22 ....
a nn
Jacobian matrix
is the matrix of all first-order partial derivatives of a vector or scalar-valued function with respect to another vector. This matrix is frequently being marked as
J
,
D
f or
A.
.
dx
1
dt
1 .
dx
2
dt
2
f
1 (
x
1 ,
x
2 ,....,
x n
)
f
2 (
x
1 ,
x
2 ,....,
x n
)
dx n dt
n
f n
(
x
1 ,
x
2 ,....,
x n
)
J
f f x x
...
f n
x
1 1 1 2 1
f
1
x f
2 2
x
2 ...
f n
x
2 ...
...
...
f
1
f x n
2
x n
...
f n
x n
Phase Portraits
A
phase space
is a space in which all possible states of a system are represented, with each possible state of the system corresponding to one unique point in the phase space.
The phase space of a two-dimensional system is called a
phase plane
, which occurs in classical mechanics for a single particle moving in one dimension, and where the two variables are position and velocity.
For mechanical systems, the phase space usually consists of all possible values of phase diagram .
position and velocity variables. A plot of position and velocity variables as a function of time is sometimes called a A
phase portrait
curves corresponding to different initial conditions in the same phase plane.
is a plot of single phase curve or multiple phase
A phase portrait of a simple harmonic oscillator
Differential equation
x
2
x
0
where x is displacement, v velocity, and ω A is amplitude is angular frequency.
is Solution of the equation
v x
A
cos(
t
)
A
sin(
t
) Now we separate sine and cosine functions, raise both equations to the power of two and finally we add them.
x A v
A
cos(
t
) sin(
t
)
x A
2 cos 2 (
t
)
v
A
2 sin 2 (
t
)
x A
2
v
A
2 cos 2 (
t
) sin 2 (
t
) 1 Final equation describes an ellipse
x A
2
v
A
2 1
The following figure shows a phase portrait of a simple harmonic oscillator with ω=10 s -1 and initial conditions x(0)=1 m; v(0)=0 m/s
x A
2
v
A
2 1
x
1 2
v
10 2 1
Creating a phase portrait of a damped oscillator in Matlab
y
2 2
y
0
y
2
y
2
y y
1
y
2
y y
1
y
2
y
2 2
y
1 2
y
2 2
y
2 2
y
1
y
1 ( 0 )
y
2 ( 0 )
y
( 0 ) 1 ( 0 ) 0 function [t,y] = oscil(delta) tspan=[0,7]; init=[1;0]; omega=10; [t,y]=ode45(@f,tspan,init); plot(y(:,1),y(:,2)); %Creation of graph description.
xlabel('displacement [m]') ylabel('velocity [m/s]') title('A damped harmonic oscillator'); axis([-1 1 -10 10]); function yprime=f(t,y) yprime=zeros(2,1); yprime(1)=y(2); yprime(2)=-2*delta*y(2)-omega^2*y(1); end clc end
Oscillator with critical damping ω= 10s -1 ; δ= 10s -1 x(0)=1m; v(0)=0 m/s Overdamped oscillator ω= 10s -1 ; δ= 20s -1 x(0)=1m; v(0)=0 m/s
Underdamped oscillator ω= 10s -1 ; δ= 1s -1 x(0)=1m; v(0)=0 m/s Simple harmonic oscillator initial amplitudes are 1,2, …,10 m
Creating a phase portrait of an oscillator in Mathematica
Stability and Fixed Points
A
fixed point
is a special point of the dynamical system which does not change in time. It is also called an equilibrium, steady-state, or singular point of the system.
If a system is defined by an equation dx/dt = f(x), then the fixed point found by examining of condition x
~
can be f(x
~
)=0 . We need not know analytic solution of x(t).
For discrete time systems we examine condition x
~
= f(x
~
) An
attractor
is a set towards which a dynamical system evolves over time. It can be a point, a curve or more complicated structure A
stable
to the x
~
fixed point: for all starting values x 0 as t →∞.
near the x
~
the system converges A
marginally stable
system stays near x
~
(neutral) fixed point: for all starting values x 0 but does not converge to x
~
.
near x
~
, the An
unstable
fixed point: for starting values x 0 far away from x
~
very near x
~
the system moves A
perturbation
is a small change in a physical system, most often in a physical system at equilibrium that is disturbed from the outside.
Phase portraits of basic three types of fixed points STABLE MARGINALLY STABLE UNSTABLE
Example 1 – bacteria in a jar
A jar is filled with a nutritive solution and some bacteria. Let b (for birth) be relative rate at which the bacteria reproduce and p (for perish) be relative rate at which they die. Then the population is growing at the rate r = b−p . If there are x bacteria in the jar, then the rate at which the number of bacteria is increasing is (b − p)x , that is, dx/dt = rx. Solution of this equation fox x(0)=x 0 is
x
(
t
)
x
0
e rt
This model is not realistic, because bacteria population goes to the ∞ for r>0. Actually, as the number of bacteria rises, they crowd each other, produce more toxic waste products etc. Instead of constant relative perish rate p we will assume relative perish rate dependent on their number px . Now the number of bacteria increases by bx and their number decreases by px 2 . New differential equation will be
dx
bx dt
px
2
Differential equation, initial number of bacteria x(0)=x 0 Analytic solution provided by Mathematica To be able to find a fixed point, we have to set the right-hand side of the differential equation to zero.
dx
bx
px
2
dt b x
(
b
p x
2
p x
)
0 0
There are two possible solutions, i.e. we have two fixed points : ~ 1 0 2
b p
First fixed point x
~ 1
= 0; There are no bacteria, so none can be born, none can die, but after small contamination of the jar (perturbation), but smaller than b/p, we can see, that the number of bacteria will increase by dx/dt = bx-px 2 >0 and will never return to the zero state.
Conclusion: this fixed point is unstable . Second point x
~
2 = b/p; At this population level, bacteria are being born at a rate bx
~
=b(b/p) = b 2 /p and are dying at a rate px
~
2 = p(b/p) 2 = b 2 /p, so birth and death rates are exactly in balance. If the number of bacteria would be slightly increased, then dx/dt = bx-px 2 <0 and would return to equilibrium. If the number of bacteria would be slightly decreased, then dx/dt = bx-px 2 >0 and would return to equilibrium. Small perturbations away from x
~
= b/p will self-correct back to b/p.
Conclusion: this fixed point is stable and is also an attractor of this system.
1.0
x
0.8
0.6
0.4
0.2
0.0
0 Graphic solution from Mathematica Input parameters: b=0.2, p=0.5
Initial conditions: x 0 = 0.9 for blue lines x 0 = 0.01 for red lines Number of bacteria in time Phase portrait dx 0.10
dt 10 20 30 40
t
0.05
0.00
0.05
b/p 0.2
0.4
0.6
0.8
1.0
x
0.10
Example 2 – predator and prey
Now we have a biological system containing two species – predators (wolves) and prey (rabbits).
Population of rabbits in time is r(t) and population of wolves is w(t) . Rabbits, left on their own, will reproduce with velocity dr/dt= ar , where a>0 Wolves, without rabbits, will starve and their population will decline with velocity dw/dt= -bw , where b>0 When brought into the same environment, wolves will catch and eat rabbits. Loss to the rabbit population will be proportional to number of wolves w rabbits r by a constant g and number of (aggressivity of predators). Gain to the wolf population will be also proportional to r and w , this time by a constant h (effectivity of transformation of prey meat into the predator biomass). Here are differential equations describing the closed system
dr
ar
grw dt dw
bw
hrw dt
Here is time dependence and phase diagram for both populations a=0.3; b=0.1; g=0.002; h=0.001, initial number of rabbits r 0 =100, wolves w 0 =25 Number of populations over time Phase portrait An attractor of this system drawn on the phase diagram is a limit cycle .
With higher rabbit natality and higher wolf mortality together with higher wolf aggressivity the changes are quicker a=0.75; b=0.2; g=0.03; h=0.01
Number of populations over time Phase portrait
With extremely low rabbit natality and low wolf mortality togehter with high wolf aggressivity both civilizations will vanish a=0.01; b=0.05; g=0.05; h=0.05
Number of populations over time Phase portrait
Source codes from Matlab for both types of graphs function [t, x, y] = predator a=0.2; b=0.1; g=0.002; h=0.001; tend=200; x0 = [100; 25]; [t, xvec] = ode45(@f, [0, tend], x0); x = xvec(:, 1); y = xvec(:, 2); % Plot of the solution p=plot(t,x,t,y); xlabel('time'); ylabel('number'); hleg = legend('Rabbits','Wolves'); function xdot = f(t, x) xdot= [ a*x(1) - g*x(1)*x(2); ...
-b*x(2) + h*x(1)*x(2)]; end end function [t, x, y] = predatorparam a=0.2; b=0.1; g=0.002; h=0.001; tend=200; x0 = [100; 25]; [t, xvec] = ode45(@f, [0, tend], x0); x = xvec(:, 1); y = xvec(:, 2); % Plot of the solution p=plot(x,y); xlabel('Rabbits'); ylabel('Wolves'); function xdot = f(t, x) xdot= [ a*x(1) - g*x(1)*x(2); ...
-b*x(2) + h*x(1)*x(2)]; end end