Presentation on theme: "Dynamical Systems 1 Introduction"— Presentation transcript:
1 Dynamical Systems 1 Introduction Ing. Jaroslav Jíra, CSc.
2 DefinitionDynamical 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 spaceA dynamical system has two partsa state vector, which describes exactly the state of some real or hypothetical systema function, which tells us, given the current state, what the state of the system will be in the next instant of time
3 A state vector can be described by A function can be described by a single function or by a set of functionsEntire system can be then described by a set of differential equations – equations of motion
4 Classification of Dynamical Systems LinearNonlinearAutonomousNonautonomousConservativeNonconservativeDiscreteContinousOne-dimensionalMultidimensional
5 For example f(x) = 3x; f(y) = 3y; Linear system – a function describing the system behavior must satisfy two basic propertiesadditivityhomogeneityFor example f(x) = 3x; f(y) = 3y;additivity f(x+y) = 3(x+y) = 3x + 3y = f(x) + f(y)homogeneity 5 * f(x) = 5* 3x = 15x = f(5x)Nonlinear system is described by a nonlinear function. It does not satisfy previous basic propertiesFor example f(x) = x2; f(y) = y2;
6 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 x(t) produces an output y(t) then any time shifted input, x(t + δ), results in a time-shifted output y(t + δ)Example: we have two systemsSystem A: System B:System A:Start with a delay of the inputNow we delay the output by δClearly , therefore the system is not time-invariant or is nonautonomous.
7 System B:Start with a delay of the inputNow 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 oscillatorNonconservative (dissipative) system – the total mechanical energy changes due to dissipations like friction or damping, e.g. damped harmonic oscillator
8 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 equationsThe system can be solved by iteration calculation. Typical example is annual progress of a bank account. If the initial deposit is crowns and annual interest is 3%, then we can describe the system by
9 Continous system – is described by a differential equation or a set of equations. For example, vertical throw is described by initial conditions h(0), v(0) and equationswhere 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.
10 One-dimensional system is described by a single function like where a,b are constants.Multidimensional system is described by a vector of functions likewhere x is a vector with n components, A is n x n matrix and B is a constant vector
11 Repetition From the Matrix Algebra Matrix A Matrix B Vector C
12 Identity matrix (unit matrix), we use symbol E or IDeterminant
14 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.For the eigenvalue calculation we use the formula
15 For the eigenvector calculation we use the formula: Two-dimensional example: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:
16 What are advantages of diagonal matrix? 1. Multidimensional discrete system.The typical formula is:To obtain k-th element:Raising matrices to the power is quite difficult, but in case of diagonal matrix we simply have:
17 2. Multidimensional continous system. The typical differential equation:Solution of the equation: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:
18 Example for eigenvalue and eigenvector calculation Initial matrixCharacteristic equationEigenvaluesEigenvector calculationAny vector that satisfies condition u1=u2 is an eigenvector for the λ=6Any vector that satisfies condition u1=-2u2 is an eigenvector for the λ=3
19 Automatic eigenvalue and eigenvector calculation in the Mathematica
20 Trace of a matrix is a sum of the elements on the main diagonal 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, Df or A.
21 Phase PortraitsA 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 position and velocity variables. A plot of position and velocity variables as a function of time is sometimes called a phase diagram.A phase portrait is a plot of single phase curve or multiple phase curves corresponding to different initial conditions in the same phase plane.
22 A phase portrait of a simple harmonic oscillator Differential equationwhere x is displacement, v is velocity, A is amplitudeand ω is angular frequency.Solution of the equationNow we separate sine and cosine functions, raise both equations to the power of two and finally we add them.Final equation describes an ellipse
23 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
24 Creating a phase portrait of a damped oscillator in Matlab function [t,y] = oscil(delta)tspan=[0,7];init=[1;0];omega=10;plot(y(:,1),y(:,2));%Creation of graph description.xlabel('displacement [m]')ylabel('velocity [m/s]')title('A damped harmonic oscillator');axis([ ]);function yprime=f(t,y)yprime=zeros(2,1);yprime(1)=y(2);yprime(2)=-2*delta*y(2)-omega^2*y(1);endclc
25 Oscillator with critical damping ω= 10s-1; δ= 10s-1 x(0)=1m; v(0)=0 m/sOverdamped oscillatorω= 10s-1; δ= 20s-1x(0)=1m; v(0)=0 m/s
26 Underdamped oscillator ω= 10s-1; δ= 1s-1 x(0)=1m; v(0)=0 m/s Simple harmonic oscillatorinitial amplitudes are 1,2, …,10 m
27 Creating a phase portrait of an oscillator in Mathematica
29 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 x~ can be found by examining of condition 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 structureA stable fixed point: for all starting values x0 near the x~ the system converges to the x~ as t→∞.A marginally stable (neutral) fixed point: for all starting values x0 near x~, the system stays near x~ but does not converge to x~ .An unstable fixed point: for starting values x0 very near x~ the system moves far away from x~A perturbation is a small change in a physical system, most often in a physical system at equilibrium that is disturbed from the outside.
30 Phase portraits of basic three types of fixed points STABLE MARGINALLY STABLE UNSTABLE
31 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)=x0 isThis 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 px2.New differential equation will be
32 Differential equation, initial number of bacteria x(0)=x0Analytic solution provided by MathematicaTo be able to find a fixed point, we have to set the right-hand side of the differential equation to zero.There are two possible solutions,i.e. we have two fixed points:
33 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-px2>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) = b2/p and are dying at a rate px~2 = p(b/p)2 = b2/p, so birth and death rates are exactly in balance.If the number of bacteria would be slightly increased, then dx/dt = bx-px2<0 and would return to equilibrium.If the number of bacteria would be slightly decreased, then dx/dt = bx-px2>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.
34 Graphic solution from Mathematica Input parameters: b=0.2, p=0.5Initial conditions: x0= 0.9 for blue linesx0= 0.01 for red linesNumber of bacteria in timePhase portrait
35 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>0Wolves, without rabbits, will starve and their population will decline with velocity dw/dt= -bw, where b>0When brought into the same environment, wolves will catch and eat rabbits. Loss to the rabbit population will be proportional to number of wolves w and number of rabbits r by a constant g (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
36 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 r0=100, wolves w0=25Number of populations over timePhase portraitAn attractor of this system drawn on the phase diagram is a limit cycle.
37 With higher rabbit natality and higher wolf mortality together with higher wolf aggressivity the changes are quickera=0.75; b=0.2; g=0.03; h=0.01Number of populations over timePhase portrait
38 With extremely low rabbit natality and low wolf mortality togehter with high wolf aggressivity both civilizations will vanisha=0.01; b=0.05; g=0.05; h=0.05Number of populations over timePhase portrait
39 Source codes from Matlab for both types of graphs function [t, x, y] = predatora=0.2;b=0.1;g=0.002;h=0.001;tend=200;x0 = [100; 25];[t, xvec] = [0, tend], x0);x = xvec(:, 1);y = xvec(:, 2);% Plot of the solutionp=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)];endfunction [t, x, y] = predatorparama=0.2;b=0.1;g=0.002;h=0.001;tend=200;x0 = [100; 25];[t, xvec] = [0, tend], x0);x = xvec(:, 1);y = xvec(:, 2);% Plot of the solutionp=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