Limited Population Growth

Part 1. Background Information

Complete this formula for the Fundamental Assumption 
        (This is just a text cell for your reference later.) :
        
    dP/dt = ???

Part 2. Steping Out: Rise = Rate x Run

Enter your formulas in text lines below.  You can enter math formulas as you did in Part 1.  Mathematica uses square brackets to indicate subscripts.  You will not be able to enter Delta followed by t, however, so call the time step Delta.  Similarly, enter your formulas for slopes.
Type your formulas as text below:

Part 3. Fruit Flies: A Numerical Example

Enter the constants and starting population and slope:

\(c\  = \ .000098; \ 
M\  = \ 1000; 
p[0] = 111; 

    slope[0] = c*p[0]*\((M - p[0])\); 
Delta\  = 5; \)

Entering the following Mathematica cell will calculate p[1], the population at the next time step, and slope[1], the slope at the next time step.
Enter the cell below:

p[1] = p[0] + slope[0]*Deltaslope[1] = c*p[1]*(M - p[1])

Calculate the populations and slopes at the next two time steps.  Note that you will have to do the calculations in the order:
p[2], slope[2], p[3], slope[3].
Do your calculations below:

Part 4. Fruit Flies: Automating the Process

Enter the starting value of n and the formula for Delta.

n = 20Delta = 100/n

Enter the following cell to execute a loop to calculate the subscripted time values t[0], t[1], t[2],..., t[n].

\(Clear[t]; 
Do[\ \ 
	t[k] = k*Delta\ , 
	{k, 0, n}
]; \)

If you have defined t[k] properly, the sequence of numbers  t[0], t[1], t[2], ...  should go from 0 to 100 days in steps of  Delta.  
Enter the next cell to make sure this is the case.

Table[t[k], {k, 0, n}]

In the recursive formulas:
                        p[k]=p[k-1]+slope[k-1]*Delta ,
                        slope[k]=c*p[k]*(M-p[k]) ,
note that p[k] is defined in terms of p[k-1] and slope[k-1].  Therefore, in order to get started, we must define p[0] and slope[0].

We know strarting values for population and its rate of change,  slope.  They should have been entered earlier.
Enter them again just to make sure:

\(p[0] = 111; 
slope[0] = c*p[0]*\((M - p[0])\); \)

Now the follow Do-loop will calculate p[1], then slope[1], p[2], then slope[2], etc.
Enter the cell below:

\(\(Do[
	\ \ p[k] = p[k - 1] + slope[k - 1]*Delta; 
	\ \ 
      slope[k] = c*p[k]*\((M - p[k])\), 
	{k, 1, n}
]; \)\)

We should now have population values p[k] and slope values slope[k] for every time value, 21 in all.  Lets pair them with the corresponding time and create two lists of data points, one of (t,p) pairs called popData[20] and one of (t,slope) pairs called slopeData[20]: 
Enter the next cell.

popData[20] = Table[{t[k], p[k]}, {k, 0, n}]slopeData[20] = Table[{t[k], slope[k]}, {k, 0, n}]

Now we create a scatter plot of data points for population as a function of time t[k]. 
Enter the next cell.

popGraph[20] = 
      ListPlot[popData[20], Prolog -> {PointSize[0.02], RGBColor[1, 0, 0]} ]

Do the population values vary in the way you expected?
Type your answer below:

Likewise, we create a scatter plot of data points for slope as a function of time t[k]. 
Enter the next cell.

slopeGraph[20] = 
      ListPlot[slopeData[20], 
        Prolog -> {PointSize[0.02], RGBColor[1, 0, 0]} ]

Do the slope values vary in the way you expected?
Type your answer below:

Record the predicted population sizes for days 20 and 100 below.
Type your answer below:

Part 5. Fruit Flies: Increasing the number of steps

In part 4 above, we defined everything in terms of the number n of time intervals.  We used n = 20 throughout, but it is very easy to increase n to more intervals.  All we have to do is gather all the relevant commands from above into one cell where we can simply change n and execute them.  If all goes well, we call generate all the time values t[k],  population values p[k], and slope values slope[k] and plot them all at once.
Enter the following cell for n=40 time steps:

\(n = 40; 
Delta = 100/n; 
Clear[t]; 

    Do[\ \ 
	t[k] = k*Delta\ , 
	{k, 0, n}
]; 

    Do[
	\ \ p[k] = p[k - 1] + slope[k - 1]*Delta; 
	\ \ 
      slope[k] = c*p[k]*\((M - p[k])\), 
	{k, 1, n}
]; 

    popData[n] = Table[{t[k], p[k]}, {k, 0, n}]; 

    slopeData[n] = Table[{t[k], slope[k]}, {k, 0, n}]; 

    popGraph[n] = 
      ListPlot[popData[n], Prolog -> {PointSize[0.02], RGBColor[1, 0, 0]}\ ]
        \)slopeGraph[n] = 
      ListPlot[slopeData[n], Prolog -> {PointSize[0.02], RGBColor[1, 0, 0]} ]

Since n = 40 above, we generated lists popData[40] and slopeData[40] automatically.  Also, we generated the graphs popGraph[40] and slopeGraph[40] automatically.  We can easily show the old popGraph[20] and popGraph[40] in the same graph for comparison.  Then we can and do the same for  slopeGraph[20] and slopeGraph[40].
Enter the following cell to generate the comparison graphs:

Show[popGraph[20] , popGraph[40]]Show[slopeGraph[20], slopeGraph[40]]

By copying and pasting the "automated" cell above that created the graphs for us, and changing the value of n, we call generate plots with an increasing number of time steps and learn how this affects the graphs.
Do the calculations to generate popGraph[n] and slopeGraph[n] for n = 80, 160, and 320 below.

Make comparison plots of popGraphs with different values of n to see how increasing n affects the shape of the graph.
Make your comparison plots below.

Record your obsevations below about the population and slope curves with n = 40, 80, 160, and 320 steps.
Type answers in the text cell below.

Fill in the table below with predicted population sizes for days 20 and 100 .
Fill in the table:

({{Number of Steps, Population at 20 days, Population at 100 days}, {20, □, □}, {40, □, □}, {80, □, □}, {160, □, □}, {320, □, □}})

Part 6. Analysis and Summary

Use the space below to answer the questions in Part 6.
Type your answers below: