L – Modeling and Simulating Social Systems with MATLAB

Slides:



Advertisements
Similar presentations
Introduction to Monte Carlo Markov chain (MCMC) methods
Advertisements

Modeling of Complex Social Systems MATH 800 Fall 2011.
Lect.3 Modeling in The Time Domain Basil Hamed
A Modified Discrete SIR Model Jennifer Switkes. Epidemiology  Epidemiology studies the causes, distribution, and control of disease in populations.
Åbo Akademi University & TUCS, Turku, Finland Ion PETRE Andrzej MIZERA COPASI Complex Pathway Simulator.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
Mech300 Numerical Methods, Hong Kong University of Science and Technology. 1 Part Seven Ordinary Differential Equations.
Developing Simulations and Demonstrations Using Microsoft Visual C++ Mike O’Leary Shiva Azadegan Towson University Supported by the National Science Foundation.
Unit 2: Engineering Design Process
Engineering Problem Solving Kuncicky – MatLab Programming G. Polya – How to Solve it.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Curve Fitting.
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
CSE 3802 / ECE 3431 Numerical Methods in Scientific Computation
A Course in Scientific Simulation Mike O’Leary Shiva Azadegan Towson University Supported by the National Science Foundation under grant DUE
Modeling frameworks Today, compare:Deterministic Compartmental Models (DCM) Stochastic Pairwise Models (SPM) for (I, SI, SIR, SIS) Rest of the week: Focus.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
Ch 1.3: Classification of Differential Equations
L – Modelling and Simulating Social Systems with MATLAB © ETH Zürich | Lesson 3 – Dynamical Systems Anders Johansson and Wenjian.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 7 - Chapter 25.
Recap Cubic Spline Interpolation Multidimensional Interpolation Curve Fitting Linear Regression Polynomial Regression The Polyval Function The Interactive.
Predicting the Future To Predict the Future, “all we have to have is a knowledge of how things are and an understanding of the rules that govern the changes.
University of Colorado Boulder ASEN 5070 Statistical Orbit determination I Fall 2012 Professor George H. Born Professor Jeffrey S. Parker Lecture 9: Least.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
Numerical Analysis -Applications to SIR epidemic model and Computational Finance - with MATLAB Jaepil LEE.
L – Modeling and Simulating Social Systems with MATLAB Lecture 2 – Statistics and plotting © ETH Zürich | Giovanni Luca Ciampaglia,
Numerical Analysis Yu Jieun.
© ETH Zürich | L – Modeling and Simulating Social Systems with MATLAB Lecture 3 – Dynamical Systems © ETH Zürich | Giovanni Luca.
Chapter 2 Motion in One Dimension. Kinematics Describes motion while ignoring the external agents that might have caused or modified the motion (Dynamics.
Advanced Computer Graphics Rigid Body Simulation
Differential Equations A Universal Language
EEE 431 Computational Methods in Electrodynamics
Introduction.
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Part 7 - Chapter 25.
Describing Motion with Equations
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Copyright © 2010 Pearson Education South Asia Pte Ltd
Ordinary Differential Equations
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
L – Modeling and Simulating Social Systems with MATLAB
Nodal Methods for Core Neutron Diffusion Calculations
L – Modeling and Simulating Social Systems with MATLAB
Numerical Solution of Ordinary Differential Equation
Introduction.
A Computational Analysis of the Lotka-Volterra Equations Delon Roberts, Dr. Monika Neda Department of Mathematical Sciences, UNLV INTRODUCTION The Lotka-Volterra.
Introduction to science
Chapter 1 - General Principles
Ch 1.3: Classification of Differential Equations
Ch 1.3: Classification of Differential Equations
Autonomous Cyber-Physical Systems: Dynamical Systems
Introduction.
Digital Control Systems (DCS)
MATH 175: NUMERICAL ANALYSIS II
Introduction.
Part 7 - Chapter 25.
Predicting the Future To Predict the Future, “all we have to have is a knowledge of how things are and an understanding of the rules that govern the changes.
The Simple Linear Regression Model: Specification and Estimation
Introduction.
Predicting the Future To Predict the Future, “all we have to have is a knowledge of how things are and an understanding of the rules that govern the changes.
Foundations of Technology The Engineering Design Process
Statistical Data Analysis
Foundations of Technology The Engineering Design Process
General Principles 4/10/2019.
Introduction.
1.1 Dynamical Systems MODELING CHANGE
Scientific Laws & Theories
Presentation transcript:

851-0585-04L – Modeling and Simulating Social Systems with MATLAB 14.05.2018 851-0585-04L – Modeling and Simulating Social Systems with MATLAB Lecture 3 – Dynamical Systems Karsten Donnay and Stefano Balietti Chair of Sociology, in particular of Modeling and Simulation © ETH Zürich | © ETH Zürich |

Schedule of the course Introduction to MATLAB 14.05.2018 Schedule of the course Introduction to MATLAB 26.09. 03.10. 10.10. 17.10. 24.10. 31.10. 07.11. 14.11. 21.11. 28.11. 05.12. 12.12. 19.12. Introduction to social-science modeling and simulations Working on projects (seminar thesis) Handing in seminar thesis and giving a presentation

Schedule of the course Introduction to MATLAB 14.05.2018 Schedule of the course Introduction to MATLAB 26.09. 03.10. 10.10. 17.10. 24.10. 31.10. 07.11. 14.11. 21.11. 28.11. 05.12. 12.12. 19.12. Create and Submit a Research Plan Introduction to social-science modeling and simulations Working on projects (seminar thesis) Handing in seminar thesis and giving a presentation

Goals of Lecture 3: students will Consolidate knowledge acquired during lecture 2, through brief repetition of the main points and revision of the exercises. Understand fully the importance and the role of a Research Plan and its main standard components. Learn the basic definition of Dynamical Systems and Differential Equations. Implement Dynamical System in MATLAB a series of examples from Physics and Social Science Literature (Pendulum, Lorenz attractor, Lotka-Volterra equations, Epidemics: Kermack-McKendrick model)

Repetition hist(), sort() plot(), loglog(), semilogy(), semilogx() hist(), sort() subplot() vs figure() Log-scale plots reduce the complexity of some functional forms and fit well to draw large range of values The amplitude of the sample matters! law of large numbers – LLN. (Ex.1) Outlier observations can significantly skew the distribution, e.g. mean != median. (Ex. 2) Cov() and corrcoef() can measure correlation among variables. (Ex. 3)

Repetition – Ex. 4 >> loglog(germany(:,2),'LineWidth',3);

14.05.2018 Project Implementation of a model from the Social Science literature in MATLAB During the next two weeks: Form a group of two or three persons Choose a topic among the project suggestions (available on line) or propose your own idea Fill in the Research Plan (available on line) and send it to sbalietti@ethz.ch AND kdonnay@ethz.ch by email Subject line: [MATLAB FS11] name1,name2,name3 E.g. [MATLAB FS11] donnay, balietti

Research Plan Structure 14.05.2018 Research Plan Structure 1-2 (not more!) pages stating: Brief, general introduction to the problem Fundamental questions you want to try to answer Existing literature you will base your model on and possible extensions Research methods you are planning to use Keep track of the changes It will become the first page of your report.

Research Plan Upon submission, the Research Plan can: 14.05.2018 Research Plan Upon submission, the Research Plan can: be accepted be accepted under revision be modified later on only if change is justified (create new version) Talk to us if you are not sure Final deadline for signing-up for a project is: Oct 24th 2011

14.05.2018 Dynamical systems Mathematical description of the time dependence of variables that characterize a given problem/scenario in its state space.

14.05.2018 Dynamical systems A dynamical system is described by a set of linear/non-linear differential equations. Even though an analytical treatment of dynamical systems is usually very complicated, obtaining a numerical solution is (often) straight forward. Differential equation and difference equation are two different tools for operating with Dynamical Systems Derive the future state of the system from the current state

Differential Equations 14.05.2018 Differential Equations A differential equation is a mathematical equation for an unknown function (dependent variable) of one or more (independent) explicative variables that relates the values of the function itself and its derivatives of various orders Ordinary (ODE) : Partial (PDE) : Differential Equations continuously varying quantities (functions) and their rates of (derivatives) is known or postulated.

Numerical Solutions for Differential Equations 14.05.2018 Numerical Solutions for Differential Equations Solving differential equations numerically can be done by a number of schemes. The easiest way is by the 1st order Euler’s Method: x x(t) x(t-Δt) t Δt

A famous example: Pendulum 14.05.2018 A famous example: Pendulum A pendulum is a simple dynamical system: L = length of pendulum (m) ϴ = angle of pendulum g = acceleration due to gravity (m/s2) The motion is described by:

14.05.2018 Pendulum: MATLAB code

14.05.2018 Set time step

14.05.2018 Set constants

Set starting point of pendulum 14.05.2018 Set starting point of pendulum

Time loop: Simulate the pendulum 14.05.2018 Time loop: Simulate the pendulum

Perform 1st order Euler’s method 14.05.2018 Perform 1st order Euler’s method

14.05.2018 Plot pendulum

14.05.2018 Set limits of window

14.05.2018 Make a 10 ms pause

Pendulum: Executing MATLAB code 14.05.2018 Pendulum: Executing MATLAB code

14.05.2018 Lorenz attractor The Lorenz attractor defines a 3-dimensional trajectory by the differential equations: σ, r, b are parameters.

Lorenz attractor: MATLAB code 14.05.2018 Lorenz attractor: MATLAB code

14.05.2018 Set time step

Set number of iterations 14.05.2018 Set number of iterations

14.05.2018 Set initial values

14.05.2018 Set parameters

Solve the Lorenz-attractor equations 14.05.2018 Solve the Lorenz-attractor equations

14.05.2018 Compute gradient

Perform 1st order Euler’s method 14.05.2018 Perform 1st order Euler’s method

14.05.2018 Update time

14.05.2018 Plot the results

14.05.2018 Animation

Food chain

Lotka-Volterra equations 14.05.2018 Lotka-Volterra equations The Lotka-Volterra equations describe the interaction between two species, prey vs. predators, e.g. rabbits vs. foxes. x: number of prey y: number of predators α, β, γ, δ: parameters

Lotka-Volterra equations 14.05.2018 Lotka-Volterra equations The Lotka-Volterra equations describe the interaction between two species, prey vs. predators, e.g. rabbits vs. foxes.

Lotka-Volterra equations 14.05.2018 Lotka-Volterra equations The Lotka-Volterra equations describe the interaction between two species, prey vs. predators, e.g. rabbits vs. foxes.

Epidemics Source: Balcan, et al. 2009

14.05.2018 SIR model A general model for epidemics is the SIR model, which describes the interaction between Susceptible, Infected and Removed (immune) persons, for a given disease.

Kermack-McKendrick model 14.05.2018 Kermack-McKendrick model Spread of diseases like the plague and cholera? A popular SIR model is the Kermack-McKendrick model. The model assumes: A constant population size. A zero incubation period. The duration of infectivity is as long as the duration of the clinical disease.

Kermack-McKendrick model 14.05.2018 Kermack-McKendrick model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate S β transmission R I γ recovery

Kermack-McKendrick model 14.05.2018 Kermack-McKendrick model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate

Kermack-McKendrick model 14.05.2018 Kermack-McKendrick model The Kermack-McKendrick model is specified as: S: Susceptible persons I: Infected persons R: Removed (immune) persons β: Infection rate γ: Immunity rate

14.05.2018 Exercise 1 Implement and simulate the Kermack- McKendrick model in MATLAB. Use the starting values: S=I=500, R=0, β=0.0001, γ =0.01

14.05.2018 Exercise 2 A key parameter for the Kermack-McKendrick model is the epidemiological threshold, βS/γ. Plot the time evolution of the model and investigate the influence of the epidemiological threshold, in particular the cases: βS/γ < 1 βS/γ > 1 Starting values: S=I=500, R=0, β=0.0001

14.05.2018 Exercise 3 - optional Implement the Lotka-Volterra model and investigate the influence of the timestep, dt. How small must the timestep be in order for the 1st order Euler‘s method to give reasonable accuracy? Check in the MATLAB help how the functions ode23, ode45 etc, can be used for solving differential equations.

14.05.2018 References Matlab and Art: http://vlab.ethz.ch/ROM/DBGT/MATLAB_and_art.html Kermack, W.O. and McKendrick, A.G. "A Contribution to the Mathematical Theory of Epidemics." Proc. Roy. Soc. Lond. A 115, 700-721, 1927. "Lotka-Volterra Equations”.http://mathworld.wolfram.com/Lotka- VolterraEquations.html http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations "Lorenz Attractor”. http://mathworld.wolfram.com/LorenzAttractor.html