Professional Documents
Culture Documents
Final Exam
Useful Tips
• Meet and discuss how to approach the problems with your study group
members BEFORE you begin answering.
• Meet and discuss your answers AFTER you complete the exam.
• Make sure to upload your exams in a timely manner as instructed
below. The 48-hour exam is only to provide ample time to complete it,
keeping in mind that these are difficult times for students in more than
one way. Please do not procrastinate the exam or its upload until the
last minute.
Exam Instructions
• This is a take-home exam which needs to be completed in a 48-hour
period. You may use the course resources on CCLE site and your labs
on CoCalc as needed (but not elsewhere on the internet).
• You can type your answers. You can also digitally write on tablets etc.
• If you have a question about the exam at any point during the exam
period, post a question publicly on Campuswire. If it is a private matter,
email Dr. V directly. Questions about content or your own progress, will
not be answered. Also, please do not post any screenshots of your
answers on CampusWire.
• Please make sure to select the pages for the corresponding questions
during submission on Gradescope without fail. Thank you!
Statement of Academic Integrity
“As a student and member of the University community, you
are here to get an education and are, therefore, expected to
demonstrate integrity in your academic endeavors. All
students must uphold University of California Standards of
Student Conduct as administered by the Office of the Dean of
Students. Students are subject to disciplinary action for
several types of misconduct, including but not limited to:
cheating, multiple submissions, plagiarism, prohibited
collaboration, facilitating academic dishonesty, or knowingly
furnishing false information. In this exam, you are allowed to
use the class resources posted on CCLE and collaborate with
only your pre-assigned study group members. Violations of
the Student Conduct Code may result in serious
consequences such as suspension or dismissal. For more
information about academic integrity, please visit
www.deanofstudents.ucla.edu."
ENTER YOUR FULL NAME TO ACKNOWLEDGE THAT YOU HAVE READ THE ABOVE
STATEMENT AND WERE NEITHER GIVEN NOR PROVIDED UNAUTHORIZED HELP ON
THIS EXAM.
1.1. Some species of insects have populations that follow a delayed version of logistic growth
differential equation like the one given below:
𝑁(𝑡 − 𝜏) 𝑁(𝑡)𝑛
𝑁 ′ (𝑡) = 𝑟𝑁(𝑡 − 𝜏) (1 − )−𝛽( )
𝑘 1 + 𝑁(𝑡)𝑛
a) (10 points) With 𝜏 = 1.5, what happens to the insect population at 𝑡 = 200 time units. Simulate
the model in CoCalc using the code given below. Show your simulated time series graph in your
answer. No need to provide your code in this answer! Hint: For importing graphs from CoCalc, see
APPENDIX I.
%auto
def dde_solve(dde, statevar, delayedvars, history, tmax,
timestep):
# Check validity of delays.
if min(delayedvars.values()) < 0:
raise ValueError("This function will not work with
negative delays. "
"Consider consulting a fortune teller instead.")
if any(val<timestep for val in delayedvars.values()):
raise ValueError("Time step should not be larger than
delay.")
delayedvars = delayedvars.items()
dde = dde.subs({v: statevar for v, delay in delayedvars
if delay == 0})
delayedvars = [(v, delay) for v, delay in delayedvars if
delay != 0]
allvars = [str(statevar)] + [str(v) for v, delay in
delayedvars]
delays = [delay for v, delay in delayedvars]
n=10
tau = 1.5
max_time = 200
tstep = 0.1
t = srange(0,max_time,tstep)
b) (3 points) As you must know, a delay differential equation can produce stable oscillations when
the delay, 𝜏, of the negative feedback, and the steepness of this feedback are high enough. Now,
reason which model parameter would you modify to increase the steepness of the negative feedback
in this model. Hint: You may use the code above which you used to simulate the model in CoCalc
and tweak the different model parameter values to see if they cause oscillations.
c) (3 points) Suppose you figured out the steepness parameter in (b), show a simulated time series
graph of oscillations in your answer and indicate what value was used for the steepness parameter.
Hint: For importing graphs from CoCalc, see APPENDIX I.
1.2. (9 points) Romeo and Juliet’s love are always distorted by external factors. This time, Romeo’s
attraction goes awry when Juliet’s nurse gets involved. Since the nurse is involved, it makes sense
to model the characters’ happiness rather than their attraction to each other. With that, we have the
following assumptions.
– Juliet loves her nurse and wants to be exactly as happy as the nurse herself is. So 𝐽′ = 𝑠(𝑁 − 𝐽).
– The nurse is similarly attached to Juliet and her happiness grows in proportion to Juliet’s.
However, she is a bit of a worrywart, and her happiness causes itself to decline. She is also worried
about Juliet’s developing relationship with Romeo, so whenever their emotions are in sync, her
happiness drops precipitously. Thus, 𝑁 ′ = 𝑟𝐽 − 𝑁 − 𝑅𝐽.
– Finally, Romeo just wants his life to be simple. When Juliet and the nurse have different emotions,
he finds it hard to deal with them, but he does not actually care whether they are happy or not. Also,
his happiness causes itself to decline, just as in the case of the nurse. So 𝑅 ′ = 𝐽𝑁 − 𝑏𝑅.
a) (6 points) Simulate this model using the parameter values s = 10, b = 8/3, and r = 28, with the
initial conditions J(0) = 0.1, N(0) = −6, and R(0) = 0.01. Using a step size of 0.01, plot a time series
and 3D trajectory. Show the plots in your answer sheet. Hint: Refer to your Lab 3. No need to
provide your code. See APPENDIX I for copying graphs from CoCalc into your answer sheets.
b) (3 points) Pick an initial point close to the original one and plot a trajectory and time series as
in the previous part. Overlay the plots for the two initial conditions. What do you observe?
2. [35 points] Discrete-Time Linear Systems
2.1. In a pond ecosystem, green algae produce energy from sunlight via photosynthesis, fish eat the
algae and consume some of that energy, and bacteria decompose the dead algae and fish to
obtain more of that energy. A discrete-time model can be set up to track the energy through such
an ecosystem as given below, where 𝐴 is the amount of energy in the algae, 𝐹 is the amount of
energy in the fish, and 𝐵 is the amount of energy in the bacteria.
𝐴𝑁+1 1.01 0 0 𝐴𝑁
( 𝐹𝑁+1 ) = [0.09 0.57 0 ] ( 𝐹𝑁 )
𝐵𝑁+1 0.03 0.07 0.36 𝐵𝑁
a) The above model was based on the following assumptions. Starting with these assumptions,
make a flow diagram (5 points) and arrive at the system of equations which result in the above
matrix model (5 points).
• For each joule of energy in the algae, the algae will produce an additional 0.25 joules each
day. (In short, ignoring other factors, the amount of energy in algae will increase by 25% per
day.)
• Each day, 12% of the energy in the algae is used up by the algae and leaves the ecosystem, an
additional 9% of it ends up in the fish who eat the algae, and an additional 3% of it ends up in
the bacteria who eat the dead algae.
• Each day, 36% of the energy in the fish is used up and leaves the ecosystem, and another 7%
of it goes to the bacteria.
• Each day, 64% of the energy in the bacteria is used up and leaves the ecosystem.
𝐴0 1 𝐴30
b) (12 points) Using an initial condition, ( 𝐹0 ) = (5), simulate the model to find ( 𝐹30 ).
𝐵0 8 𝐵30
Provide the time series graph in your answer and briefly explain in your own words, what is
happening to the energy flow in this food chain.
Hint: You may use the code below to simulate the model in CoCalc. (No need to re-insert this
code in your answer sheet). See APPENDIX I to get the graphs into your answer sheet.
-------------------------- Code for the model ----------------------------------------------------------------
c) (3 points) Find and list the eigenvalues for this model. Hint: You may use the code below in
CoCalc.
show("Eigenvalues:")
show(M.eigenvalues())
d) (2 points) What is the principal eigenvector corresponding to the dominant eigenvalue? Hint:
You may use the code below in CoCalc.
max(M.eigenvectors_right())
e) (4 points) Suppose the amount of energy in the algae is 10 joules, how much energy will be in
the fish and bacteria? Hint: You may refer to your lab 8 on Mangrove model for the approach to
be used.
f) (4 points) If you were to use diagonalization to obtain the same solution as the simulations
𝐴30
above for ( 𝐹30 ), provide the corresponding mathematical expression and briefly describe what
𝐵30
each term in that notation refers to. Indicate the size of each matrix.
3. Analysis of Multivariable Nonlinear System Dynamics
3.1. [60 points] The following is a model of the nonlinear interactions between wolves (𝑊)
and their prey, the elk (𝐸) in Yellowstone National Park.
𝑾′ = 𝟐𝑬𝑾 − 𝟒𝑾 − 𝑾𝟐
𝑬′ = 𝟏𝟒𝑬 − 𝑬𝟐 − 𝑬𝑾
a) Find and classify all the equilibria of this model. If an equilibrium does not make
practical sense, discard from stability analysis.
Note: The clarity of the question precludes further student inquiries such “should I use
eigenvalues, or should I use linear approximation or should I find the Jacobian matrix or
should I find the stability of ALL the equilibrium points or why is there more than one
equilibrium or can we get negative values as equilibrium”. If you have any other question,
please ask on CampusWire.
Note: The clarity of the question precludes further student inquiries such as “should I draw
time series graphs, or how many trajectories should I draw or should I show all the
variables or should I draw all the trajectories on the same graph”. If you have any other
question, please ask on CampusWire.
Rubric:
1
𝑉′ = (−𝑊 + 𝑉(1 − 𝑉)(𝑉 − 0.1) + 𝜇)
0.008
𝑊 ′ = 𝑉 − 0.5𝑊
Where 𝑉 and 𝑊 describe some biological variable of neurons. Note that when 𝜇 = 0 (no
experimental input), the equilibrium is at (𝑉 ∗ , 𝑊 ∗ ) = (0,0), which represents a stable
resting state. When 𝜇 = 0.3 (with experimental input), the equilibrium is at (𝑉 ∗ , 𝑊 ∗ ) =
(0.1, 0.2).
Use your knowledge of eigenvalues of the linear approximation at the two equilibria given
for this nonlinear model and show that a change in 𝜇 as above can produce the qualitative
switch from the stable equilibrium to oscillatory behavior in the model neuron. Briefly
explain what type of bifurcation this could be.
Note: The rubric below should give you sufficient hint for the expected steps in your
answer. No need for any simulations.
Rubric:
I. Getting your simulated graphs from CoCalc into your answer sheet
To get the graph into your answer document, you can: