# MA 432  Tue/Thur 11.45 am - 1 pm

Class-room: 1218 SAS Hall

Instructor: Mette S Olufsen
Office: SAS 3216
Office Hours: By appointment via email.
Phone Number: 515-2678

## NOTES

1.    Syllabus
3.    Compartment models (Notes)
4.    Euler example in matlab
5.    Improved Euler method (Trapezoidal rule) in matlab
6.    Euler example using Matlabs ODE solvers
7.    Notes on Euler's method and RK methods
8     Notes on ordinary differential equations
9.    Text for chemostat model: Part 1, Part 2, Part 3, Problems
10.    Phase plane analysis: Part1, Part2 (chemostat), Part 3
11.   Text for chemostat part 2
12.    Matlab code 2 ODEs
13.    Population dynamics: Part 1, Problems
14.    Disease models: SIR models, Problems, References
15:    Base code SIR model
http://www4.ncsu.edu/%7Emsolufse/CVmodels.pdf
16.    Curve fitting

18.    Introduction to cardiovascular models (steady state) (pdf)

19.    Cardiovascular models (steady state): notes and exercises
20.    Cardiovascular models (time-varying) (pdf) code (zip)
21.    Time varying cardiovascular model: paper

X.    Measurement of blood pressure
Data
X.    Matlab code (zip-file)
X.    Powerpoint version 2
X.    Data from lab
X.    Powerpoint version 3

X.    Powerpoint version 4 (powerpoint, pdf)

## HOMEWORK

Homework 1 (Due Thursday 1/16)
1: From the modeling powerpoint presentation - do problems on slides 9, 12, 14, 16, 21
2: In notes on compartment models complete problems 1.8 (2-4)
3: Complete problem on cleaning the great lakes. For (c) set up the equations but you don't need to solve them.

Homework 2 (Due Thursday 1/23)
1:  For the differential equation y' = y(1-y) with initial conditions y(0)=0.1. Let 0 < t <= 5.
A:    Use Euler's method, the improved Euler method, the 2nd and 4th order Runge Kutta method. Compare results with those obtained using ode45.
B:    Plot the absolute error and use plots to discuss the order of accuracy of the methods.
2:  Solve the system of equations x' = y / 60 - 3 x /40 and y' = 3 x/40 - y/ 20, with initial conditions x(0)=1 and y(0)=0.
Let 0 < t <= 100.
A:    Plot x(t) and y(t).
B:    Plot the absolute error as you reduce the step size h, discuss what happens to the error when you reduce h.

3: Use Matlab's build in ODE solver ode45 to solve the same system of equations

Homework 3 (Due Tuesday 2/4)
1: Use matlab to solve the chemostat model (see notes in 7 - above) with
dN/dt = alpha1 C N / (1+C) - N
dC/dt = - C N / (1+C) - C + alpha 2
using appropriate parameter values and initial conditions.
Show that the solution reaches the steady state value that we predicted in class.

2: Do problems 8 and 10 in text for chemostat problems.

3: For the chemostat model with
dN/dt = alpha1 C N / (1+C) - N
dC/dt = - C N / (1+C) - C + alpha 2
In class we found nullclines for this model
N-nullclines dN/dt = 0 are given by N = 0 and C = 1/(1-alpha1)
C-nullclines dC/dt = 0 are given by N = (alpha2 - C) (1+C)/C
Use analysis discussed in Note on "Phase plane analysis" given in 10 (above)
to compute direction field along each of the 3 nullclines. Also for the two fixpoints, calculate the Jacobian
needed to determine the stability of the fixpoints. Determine conditions for alpha1 and alpha2.

You may use pplane8 to illustrate your solutions or you can use the online version, which can be found at: http://math.rice.edu/~dfield/dfpp.html.

4:  Interpret what happens to the solution if we start the nutrient level N at zero versus at some small value epsilon. Support your solution with
phaseportrait and your solution from matlab where you can plot N(t) and C(t).

Homework 4 (Due Thursday 2/13)
1:  Population dynamics problems: 2, 7,12, 13
2:  In Matlab try to reproduce the graph shown in Fig 6.3
3:  SIR models problems: 25, 26 (Discuss the table and verify at least 3 results in the table), 30

Homework 5 (Due Thursday 2/27)

1: Derive sensitivity equations (on paper and input in code SIRSsens) and predict the following:
- classical sensitivities dx/dp (x is the variable, p the parameter)
- absolute sensitivities abs(dx/dp)
- relative sensitivities dx/dp p/x (note you cannot divide by zero, so if x=0 for any t you need to
think about how you get relative sensitivities that makes sense.
2: The next couple of lines in the code involves generating ranked sensitivities.
- Overall what parameter is the solution the most sensitive to?
- Assuming you only have data for S, what parameter is S the most sensitive to?
- Assuming you only have data for I, what parameter is I the most sensitive to?
- Assuming you only have data for R, what parameter is R the most sensitive to?
3: Change initial parameter values and initial conditions, how does that affect the sensitivities?
4: Generate data (SIRSdata) without noise, with a medium level noise, and very noisy
5: Use fminsearch (SIRSopt) to estimate optimal parameter values.
- Find initial parameter values and initial conditions, estimate parameters for all 3 data-sets gene
rated in 1, can you find the correct parameters for all datasets?
Repeat simulations with 2 different parameter sets, that are further away from the optimal values.
- Change the code so in addition to estimating parameters you also estimate initial conditions. Note
for this part of the problem you need to start with values away from the initial values used for
generating the data.

Homework 6 (Due Thursday 3/6)
Use the harelynx data and modify codes from SIR model to estimate parameters for a population model predicting
the competition between hare's and lynx. Use the same model you used in HW4 problem 2.

Homework 7 (Due Tuesday 3/18 - after spring break)
1:  Solve equations displayed on Fig 1.6 for V, P, and Q as a function of parameters (R's, C's, and K's).
The figure can be found in the pdf and notes on CV models.
2:  Solve problems 1.2, 1.3, 1.4, 1.5, and 1.10 from the notes on CV models.
3:  Show that the elastance function is smooth.

## PROJECT

Presentation 1
1: Outline topic
2: Problem formulation with questions
3: Model diagram
4: Discussion of how the model can answer the proposed questions

Presentation 2

1: Outline reduced problem and questions
2: Show data to be used for the model
3: Show updated model diagram
4: Discuss model assumptions
5: Show model equations
6: Show initial computations

Hand in outline for report - all sections should be named, and an introduction should be written.
Discuss briefly what goes in each section.

Presentation 3

XXX Reports and Individual questions due

OLD HW - NOT ASSIGNED YET

Homework 9

Individual solutions to be handed in on paper.
1:  Solve problems 1.14, 1.15, 1.16 from notes on CV models.
2:  Derive the ODEs including equations for Rav, Rmv, and plv for the time-varying CV model.
Use diagram shown in the powerpoint/pdf on cardiovascualr models (version 2).
3: Show that the least squares error J can be coputed as transposed(R) x R, where R is the model residual.
4: Use tables given in the powerpoint/pdf on cardiovascular models (version 2) to calculate initial values for all
model parameters.
Solutions to problems 5 and 6 can be done with 1-2 partners (NOT IN GROUPS OF 6)

5: Complete and run the code DriverBasic.m include graphs for all time-varying quantities.
Hand in the code and the graphs. Graphs should be summarized in a document.
Discuss results of computations, did you get the expected results?
6: Vary some of the model parameters, use results from homework 8 to choose what parameters that should be varied.
You only need to vary 3-4 parameters. Discuss what you observe.

Homework 10

With the new version of the code.
1: Calculate sensitivities and show ranked sensitivities also show 3 (1 high, 1 medium, and 1 low) sensitive
parameters as a function of time.
2: Use the code to find a subset of parameters. What parameters are included in your subset (I don't want numbers
but names of parameters). In DriverBasic_jacobian some parameters were kept fixed. What happens if you leave
these out or change the fixed parameters?
3: With parameters in  your original subset estimate parameters and plot results (use DriverBasic_SS.m) to do so
I want to see graphs not only of the state you estimate but of all states in the model. To use optimized parameters

For all three questions - discuss your results, relate results to those found using the initial parameter values.
In your discussion relate computations to biological observations. Relate results you have worked with to discussion
of the head up tilt model presented in class today.

ALL HOMEWORK REDO'S AND LATE RETURNS DUE TUE 3/13 (AFTER SPRING BREAK)