Practice 5¶
Question 1¶
Create a 2 by 3 numpy array containing the following data:
Use slice notation to create one-dimensional arrays containing:
The first row
The last column
Calculate:
A 3 element array containing the sum of each of the three columns
A 2 element array containing the sum of each of the two rows
Question 2¶
A particle follows a trajectory given by the following equations between \(t=0\)s and \(t = 10\)s:
Use
np.arange
to create an arrayt
containing 100 evenly spaced time points from 0 to 10.Calculate arrays
x
andy
containing the x and y co-ordinatesplot the x and y co-ordinates against time on the same graph.
On a separate graph, plot x against y.
Question 3¶
The logistic equation describes the growth of a population where the growth rate is limited by resources.
\(r\) and \(K\), both greater than zero, are parameters of the model.
Adapt the ‘Population Growth’ code in the notes to simulate the growth of a population undergoing logistic growth. Experiment with different values of \(r\) and \(K\). What do the two parameters represent?