Class 14: Can we predict the future?

Computing for Molecular Biology 2

Andrés Aravena, PhD

30 April 2021

Dynamic Systems

The missing parts

We have seen the main ideas about dynamical systems

We can simulate systems with time advancing step-by-step
(time is an integer number)

Later, if we have time, we will see other tools that work when time is continuous
(i.e. when time is a real number)

What we have seen so far

  • Dynamic systems allow us to model complex things
    • decomposition in parts
    • describe the interactions
  • Simulating dynamical systems shows us
    • what will happen
    • what happened before

Pierre-Simon Laplace (1749–1827)

French mathematician and astronomer

Laplace said

“An intelligence knowing all the forces acting in nature at a given instant, as well as the momentary positions of all things in the universe, would be able to comprehend in one single formula the motions of the largest bodies as well as the lightest atoms in the world; to it nothing would be uncertain, the future as well as the past would be present to its eyes.”

If we know the current state…

“An intelligence knowing all the forces acting in nature at a given instant, as well as the momentary positions of all things in the universe, would be able to comprehend in one single formula the motions of the largest bodies as well as the lightest atoms in the world; to it nothing would be uncertain, the future as well as the past would be present to its eyes.”

…and we know the system…

“An intelligence knowing all the forces acting in nature at a given instant, as well as the momentary positions of all things in the universe, would be able to comprehend in one single formula the motions of the largest bodies as well as the lightest atoms in the world; to it nothing would be uncertain, the future as well as the past would be present to its eyes.”

…then we can know the future and the past

“An intelligence knowing all the forces acting in nature at a given instant, as well as the momentary positions of all things in the universe, would be able to comprehend in one single formula the motions of the largest bodies as well as the lightest atoms in the world; to it nothing would be uncertain, the future as well as the past would be present to its eyes.”

Let’s say it again

“all the forces acting in nature at a given instant, as well as the momentary positions of all things in the universe”

If we know the current state …

“would be able to comprehend in one single formula the motions of the largest bodies as well as the lightest atoms in the world

And we know the system…

“nothing would be uncertain, the future as well as the past would be present”

Then we can know exactly what is in the future

These are deterministic systems

All the future is determined by the initial state and the system rules

Can we really predict the future?

Sometimes we can predict

Sometimes models are too simple and they miss important parts

If the system is realistic, we can predict

We need to measure initial values and rates

But all measurements have a margin of error

What if we don’t know the exact value?

In real life we cannot measure exact values

We can only measure within a margin of error

For example, when we measure 2.0 mol of Hydrogen, it may be 1.95 or 2.05 or any value in between

Inaccurate measurement of H_ini

Small initial errors give small final errors

Effect of error on r1_rate evaluation

Small changes in the initial state produce small changes in final state

Even if we make errors, their effect is not very important

Another system: Quadratic map

  • A population that reproduces and dies
  • Death happens in pairs (two incoming arrows)
  • They die of overcrowding
  • This is a model of a population with limited space

Another system: Quadratic map

To study this system, we will assume that death rate and birth rate depend on a single value A

  • Death rate is A/2
  • Birth rate is A-1
  • If we know A, we know birth and dead rate

Formulas are easy to find

d_x[i] <- (A-1) * x[i-1] - 2 * A/2 * x[i-1]*x[i-1]
x[i]   <- x[i-1] + d_x[i]

in other words

x[i] <- x[i-1] + (A-1)*x[i-1] - 2*A/2*x[i-1]*x[i-1]

so finally

x[i] <- A * x[i-1] * (1 - x[i-1])

and the program is also easy to write

quad_map <- function(N, A, x_ini) {
  x <- rep(NA, N)
  x[1] <- x_ini
  for(i in 2:N) {
    x[i] <- A * x[i-1] * (1 - x[i-1])
  }
  return(x)
}

We simulate for different initial conditions

x_ini <- c(0.4, 0.45, 0.5, 0.55, 0.6)
ans <- data.frame(V1=quad_map(N=100, x_ini=x_ini[1], A=2))
plot(ans$V1, ylim=c(0,1), ylab="x", type="b")
for(i in 2:length(x_ini)) {
    ans[[i]] <- quad_map(N=100, x_ini=x_ini[i], A=2)
    points(ans[[i]], pch=i, type="b")
}

The final state is always the same

This is called attractor

Behavior depends on A. Here A=3

Now there are two final states.
This is a periodic attractor

Behavior depends on A. Here A=3.5

Now we have four final states.
Also a periodic attractor

Behavior depends on A. Here A=3.8

We do not see a pattern here

Behavior depends on A. Here A=3.95

Similar initial states, very different results

Small changes in x_ini, big changes in result

Initial values:

x_ini
[1] 0.40 0.45 0.50 0.55 0.60

Final values:

ans[100,]
            V1        V2        V3        V4        V5
100 0.07712169 0.7034133 0.8541633 0.7034133 0.4900459

We cannot predict

well, not always

This is called “Butterfly Effect”

The fly of a butterfly in Istanbul can produce an hurricane in Mexico

Small changes have big consequences

But we can still say something

We cannot make exact predictions

But we can still say what is normal

What is the most probable behavior

We can identify patterns using the tools of …. (sound of drums)

Probabilities