Question: We now provide you with code for simulating the model above ( see below ) . This consists of two functions, which you can inspect

We now provide you with code for simulating the model above
(
see below
)
.
This consists of two functions, which you can inspect below. All can be seen in the live docs. Read them to help answer the remainder of question
5
,
which is situated below the code.
parameterise
_
basic
_
model
solve
We also provide a variable data, that provides noisy data on the predator and prey populations taken by a biologist...
data
[
:
,
1
]
contains the timepoints
(
measured in years
)
over which the data was taken
data
[
:
,
2
]
represents the estimated prey population
(
measured in hundreds, i
.
e
.
data
[
2
,
2
]
=
3
means
3
0
0
estimated animals at timepoint
2
)
over these timepoints
data
[
:
,
3
]
represents the predator population over these timepoints, measured in tens.
1
0
0
1
\
times
3
Matrix
{
Float
6
4
}
:
0
.
0
0
.
8
2
5
3
7
1
0
.
8
2
0
2
1
9
0
.
0
1
1
.
2
5
1
2
6
0
.
8
8
0
4
7
5
0
.
0
2
1
.
0
7
4
4
7
1
.
1
9
5
1
9
0
.
0
3
1
.
1
4
5
9
5
1
.
3
6
7
0
2
0
.
0
4
0
.
7
4
0
6
9
0
.
8
2
0
1
9
3
0
.
0
5
0
.
8
0
3
2
8
5
0
.
8
0
2
0
9
4
0
.
0
6
1
.
0
4
2
3
4
0
.
9
9
6
4
2
7
9
.
9
5
0
.
9
6
0
2
5
1
2
.
8
9
8
1
5
9
.
9
6
0
.
9
5
8
6
6
7
2
.
5
7
9
8
5
9
.
9
7
1
.
1
4
8
9
9
2
.
7
8
0
7
1
9
.
9
8
1
.
0
9
6
2
1
3
.
0
8
0
5
2
9
.
9
9
0
.
6
3
5
5
4
5
2
.
7
9
6
2
3
1
0
.
0
0
.
8
5
7
1
5
9
2
.
3
8
9
3
7
.
solve
(
f::Function, tspan, x
0
::Vector
)
Numerically solves the ODE x
(
t
)
=
f
(
x
(
t
)
,
t
)
on the timespan whose start
/
end points are enclosed in tspan. Recall that x
denotes the time derivative of x
(
t
)
,
i
.
e
.
dx
/
dt
.
Example
solve
(
f
,
(
0
,
1
0
)
,
[
1
,
0
]
)
solves between t
=
0
and t
=
1
0
,
using initial conditions x
0
=
[
1
,
0
]
.
e
)
How would the basic model change if we instead measured predators and prey in units of a single animal?
Hint: take
=
1
0
0
and
=
1
0
.
Can you rewrite the differential equation in terms of these two variables instead, using the chain rule?
f
)
Build a function simulation
(
p
)
.
It must take in a vector of
4
parameters
(
e
.
g
.
simulation
(
[
1
,
2
,
3
,
4
]
)
.
It must output a
1
0
0
1
\
times
2
matrix holding the solution of the differential equation: i
.
e
.
the populations of prey
(
1
st column
)
and predators
(
2
nd column
)
over the timepoints range
(
0
,
1
0
,
step
=
0
.
0
1
)
.
The initial conditions can be
[
1
,
1
]
.
g

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!