NetLogo 5th IISM

28
Programming Mathematical Models …with NetLogo n Carlos García Vázquez / Fernando Sancho Caparrini 5ª Escuela Internacional de Verano de Matemáticas (5ª EIVM) 5 th International Summer School of Mathematics (5 th ISSM)

Transcript of NetLogo 5th IISM

Page 1: NetLogo 5th IISM

Programming Mathematical

Models…with NetLogo

Juan Carlos García Vázquez / Fernando Sancho Caparrini

5ª Escuela Internacional de Verano de Matemáticas (5ª EIVM)5th International Summer School of Mathematics (5th ISSM)

Page 2: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What we will see today…

Modeling + Experimentation in MathematicsProblem + Tool

Complex System + Computational ModelCellular Automata + Multiagent System

(NetLogo)

Page 3: NetLogo 5th IISM

On Problem Modeling

Page 4: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Discovering the World

Page 5: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Discovering the World

ScientificMethod

Page 6: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Discovering the World

ScientificMethod

• Observation• Hypotheses Formulation• Experimentation• Theses (or refutation)

Page 7: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling the World

Real World

Models

Page 8: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What is a Model

A model is an abstract representation of some concrete aspects of “reality”. It consists of:• The elements that characterize the aspects of the modeled reality, and• The relations between these elements

• Mathematical Theories

• Numerical Models

• Computational Models

Mathematical Modeling

Page 9: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling ProcessPhenome

non

FormalizationModel

Interpretation

Implementation

Evaluation

Page 10: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling Process: NetLogoPhenome

non

FormalizationModel

Implementation

Evaluation

NetLogo

Interpretation

Page 11: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Modeling Process: NetLogoPhenome

non

FormalizationModel

Implementation

Evaluation

NetLogo

Interpretation

This is what

we do in Mathemati

cs!!!

Page 12: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Selecting a Problem…• One hard… really hard• In the limit of standard Mathematics• One we can find everywhere• Pure and Applied… at a time• Where we can make experiments and provide

hypotheses

Page 13: NetLogo 5th IISM

Complex Systems

Page 14: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What is a Complex System?

Science of Complex Systems tries to describe different systems (biological, mathematical, social, physical,…) emphisizing their decomposition in simple elements and the interactions between them, and in the emergence of behaviours that are not a priori predictable by using the current tolos (mathematical, theoretical, etc.).

Page 15: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

What is a Complex System?

They are everywhere…

… think and say…

Page 16: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

1D All the cells work on a parallel and

synchronized way

Page 17: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

1D All the cells work on a parallel and

synchronized way Some Questions:• Can you enumerate 1D

CA?• How many 1D CA can

you build?• Can you think in

methods to create variants of 1D CA?

Page 18: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

2D

All the cells work on a parallel and

synchronized way

Page 19: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Cellular Automata: A “Simple” Complex System

2DSome Questions:• Can you enumerate 2D

CA?• How many 2D CA can

you build?• Can you think in

methods to create variants of 2D CA?

Page 20: NetLogo 5th IISM

NetLogo: A Modeling Tool

Page 21: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

3 Types of AgentsAgent

• Artificial and autonomous Individual.• Endowed with rules governing their behavior and their ability to make decisions.• Interact between them and with the environment.

Environment

Agent

Links

Interactions

Page 22: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

3 Types of Agents

Patches

Turtles

Links

Interactions

Agent

• Artificial and autonomous Individual.• Endowed with rules governing their behavior and their ability to make decisions.• Interact between them and with the environment.

Page 23: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches World• Rectangular 2D World tessellated by patches• Associated coordinate system• Several topologies

Page 24: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches World• Rectangular 2D World tessellated by patches• Associated coordinating system• Several topologies

Page 25: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches WorldWorld Settings View Settings

Page 26: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Patches World

Properties:• (pxcor, pycor)• pcolor• plabel, plabel-color

InspectPatch

Page 27: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Let’s Go!!

We will use patches to model a specific (and very interesting) type of 2D Cellular Automata:• The behavior of every cell depends on:• The cell is alive or not, and• How many neighbors are alive

•… and then we will play with a concrete case called Game of Life

J. Conway

Page 28: NetLogo 5th IISM

5ª Escuela Internacional de Verano de Matemáticas / 5th International Summer School of Mathematics (5th EIVM)

Conways’ Game of Life

• A live cell stays alive if it has 2 or 3 live neighbors, otherwise it died

• A dead cell comes to life if it has exactly 3 live neighbors, otherwise it stays dead