30
COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

  • View
    218

  • Download
    2

Embed Size (px)

Citation preview

Page 1: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

COMPUTER MODELS IN BIOLOGY

Bernie Roitberg and Greg Baker

Page 2: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

Page 3: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

Page 4: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

• Complex fitness landscapes

Page 5: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

• Complex fitness landscapes

• Individual-based problems

Page 6: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

• Complex fitness landscapes

• Individual-based problems

• Stochastic problems

Page 7: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

Page 8: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

THE EULER EXACT r EQUATION

1= e- rx

x=0

3

! lxmx

Page 9: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

HOW TO SOLVE THE EULER

• Start with lnR0/G ≈ r

Page 10: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

HOW TO SOLVE THE EULER

• Start with lnR0/G ≈ r • Insert ESTIMATE into the Euler

equation. This will yield an underestimate or overestimate

Page 11: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

HOW TO SOLVE THE EULER

• Start with lnR0/G ≈ r • Inserted ESTIMATE into the Euler

equation. This will yield an underestimate or overestimate

• Try successive values that approximate lnR0/G until exact value is discovered

Page 12: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

SOME GUESSES

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

1 2

Guess r

Value

0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1 2

Guess r

Value0

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6

1.8

1 2

Guess r

Value

Page 13: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

Page 14: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

THE CONCEPT

• For small changes in x (e.g. time) the difference quotient y/x approximates the derivative dy/dx i.e. dy/dx = x 0 y/x

• Thus, if dy/dx = f(y) then y/x≈ f(y) for small

changes in x • Therefore y ≈ f(y) x

Page 15: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

THE GENERAL RULE

• For all numerical integration techniques:

y(x + x) = yx + y

Page 16: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

EULER SOLVES THE EXPONENTIAL

dn/dt = rNN/t ≈ rN

N ≈ rN t

N(t+t) = Nt + NRepeat until total time is reached.

Page 17: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

NUMERICAL EXAMPLE

• N 0+t = N0 + (N0 r T) t = 0.1• N.1 = 100 + (100 * 1.099 * 0.1) = 110.99• N.2 = 110.99 + (110.99 * 1.099 * 0.1) =123.19• N.3 = 123.19 + (123.19 * 1.099 * 0.1) =136.73.• …...• N1.0 = 283.69• Analytical solution = 300.11

Page 18: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

COMPARE EULER AND ANALYTICAL SOLUTION

0

50

100

150

200

250

300

350

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

T

N

0

50

100

150

200

250

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

T

N

0

100

200

300

400

500

600

700

800

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

T

N

Page 19: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

INSIGHTS

• The bigger the time step the greater is the error

• Errors are cumulative

• Reducing time step size to reduce error can be very expensive

Page 20: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

RUNGE-KUTTA

t

N

Page 21: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

RUNGE-KUTTA

• ∆yt = f(yt) ∆ t

• yt+ ∆ t = yt + ∆ yt

• ∆ y t+ ∆ t = f(yt+ ∆ t )

• y t+ ∆ t = yt + ((∆yt + ∆ y t+ ∆ t )/2)

Page 22: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

COMPARE EULER AND RUNGE-KUTTA

0

1000

2000

3000

4000

5000

6000

7000

8000

9000

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

t

N

Page 23: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

• Complex fitness landscapes

Page 24: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

COMPLEX FITNESS LANDSCAPES

• Employing backwards induction to solve the optimal when state dependent

• Numerical solutions for even more complex surfaces– Random search

– Constrained random search (GA’s)

Page 25: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

TABLE OF SOLUTIONS

Oxygen

Energy

0.1 0.2 0.3 0.4 0.4

0.1 A A A R R

0.2 A R R R D

0.3 R R D D D

0.4 R R D D D

0.5 D D D D D

Page 26: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

• Complex fitness landscapes

• Individual-based problems

Page 27: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

INDIVIDUAL BASED PROBLEMS

• Simulate a population of individuals that “know” the theory but may differ according to state

Page 28: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

WHERE NUMERICAL SOLUTIONS ARE USEFUL

• Problems without direct solutions

• Complex differential equations

• Complex fitness landscapes

• Individual-based problems

• Stochastic problems

Page 29: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

STOCHASTIC PROBLEMS

• Two issues:

– Generating a probability distribution

– Drawing from a distribution

Page 30: COMPUTER MODELS IN BIOLOGY Bernie Roitberg and Greg Baker

FINAL PROBLEM

• What do you do with all those data?