Calculus: The Language of Change

Exercise Set 2.2
Shortening the Tme Steps

by Kevra Tanke

Exercise 1

part a

Complete the table below where t = 0, (1/2), 1, (3/2), 2, (5/2), 3, (7/2), 4:

({{t, 0, (1/2), 1, (3/2), 2, (5/2), 3, (7/2), 4}, {S, 10, 000, □, □, □, □, □, □, □, □}, {I, 1, 000, □, □, □, □, □, □, □, □}, {R, 19, 000, □, □, □, □, □, □, □, □}})

Solution of part a

Finding S

From the text we obtain the formula

	(a(S/n)I) * Δt = successful contacts during the Δt period
	
If we calculate cases in half-day steps, the new cases are as above and the number of susceptibles in a half day equals the old susceptibles less the new cases,

	S[(1/2)] = S[0] - (aS[0]/n I[0]) *(1/2)

sNr =10000 - ( .618182 *(10000/30000)*1000)*(1/2)

This quantity  can be used to compute S[1] = S[(1/2)]-new cases during the second half	S[1] = S[(1/2)] - (aS[(1/2)]/n I[(1/2)]) *(1/2)	
	But to compute this formula we need to first find I[(1/2)].

Finding I

To compute the number of infectious people, we use the following formula (text pg 30)

	I[(1/2)] = I[0] +( aS[0]/n I[0] - b*I[0]) *(1/2)

iNr = 1000 + ( .618182 *(10000/30000)*1000-(1/11)*1000)*(1/2)

With this we can compute S[1] and then preceed to compute I[1],

	I[1] = I[(1/2)] +( aS[(1/2)]/n I[(1/2)] - b*I[(1/2)]) *(1/2)
	All that  we are  doing is using the present values of 
          S and I to compute the next value .

iNr =1057.58 + ( .618182 *(9896.97/30000)*1057.58-(1/11)*1057.58)*(1/2)

Finding R

R is the number of individuals removed.  Since everyone in our population has to be in one of the S-I-R categories we can compute R knowing n, S, and I.  We  find R by taking the total population (n) and subtracting the number suseptable (S) and subtracting the number infected (I):

	R = n - S - I

Computing  the table

We can use the following computations to find our values:
Press Enter.

\(sNr = 10000; 
iNr = 1000; 
rNr = 19000; 
n = sNr + iNr + rNr; 

    b = 1/11; 
c\  = \ 6.8; 
a\  = \ b\ c; 
t = 0.0; 


    iPairs\  = \ {{t, iNr}}; 
sPairs\  = \ {{t, sNr}}; 

    rPairs\  = \ {{t, rNr}}; 

Print[\ "Day ", \ t\ ]\ ; 

    Print[\ "S[", t, "] = ", sNr\ ]\ ; 

    Print[\ "I[", t, "] = ", iNr\ ]\ ; 

    Print["R[", t, "] = ", \ rNr\ ]; 

finalTime\  = \ N[4]; 


    Do[
snr\  = \ sNr\  - \ \((a\ sNr/n\ iNr)\)* .5; 

      inr\  = \ iNr\  + \ \((a\ sNr/n\ iNr\  - \ b\ iNr)\)* .5; 

      rnr\  = \ n\  - \ snr\  - \ inr; 
sNr = snr\ ; 
iNr = inr; 

      rNr = rnr; 

Print[\ "Day ", \ t\ ]\ ; 

      Print[\ "S[", t, "] = ", sNr\ ]\ ; 

      Print[\ "I[", t, "] = ", iNr\ ]\ ; 

      Print["R[", t, "] = ", \ rNr\ ]; 


      iPairs\  = \ AppendTo[iPairs, {t, iNr}]; 

      sPairs\  = \ AppendTo[sPairs, {t, sNr}]; 

      \(rPairs\  = \ AppendTo[rPairs, {t, rNr}]; \)

      	, {t,  .5, finalTime, \  .5}]\)

Our table is:
	({{t, 0, (1/2), 1, (3/2), 2, (5/2), 3, (7/2), 4}, {S, 10000, 9896.97, 9789.1299885911458`, 9676.4372554635063`, 9558.87018666104815`, 9436.43193579337413`, 9309.15215109993177`, 9177.08882276833115`, 9040.32988797794168`}, {I, 1000, 1057.58, 1117.34, 1179.24821734623286`, 1243.21309445113525`, 1309.14165920739544`, 1376.91500484595463`, 1446.39128750273808`, 1517.40516377027745`}, {R, 19000, 19045.4545454545467`, 19093.5261707989027`, 19144.3145271902608`, 19197.9167188878179`, 19254.4264049992364`, 19313.9328440541149`, 19376.5198897289288`, 19442.2649482517826`}})

part b

Graph  S, I, and R vs. t.

Solution of part b

Graph S vs. t:

Press enter.

ListPlot[sPairs , PlotJoined -> True]TableForm[sPairs]

Graph T vs. t:

Press enter.

ListPlot[iPairs, PlotJoined -> True]TableForm[iPairs]

Graph R vs. t:

Press enter.

ListPlot[rPairs, PlotJoined -> True]TableForm[rPairs]

Exercise 2

part a

What  does the following quantity measure and in what units?

	(a*S[0]/n*I[0]-b*I[0]) * (1/2)

Solution of part a

Looking at the text on pg 30 we see this form in the equation:

	I[(1/2)] = I[0] +( aS[0]/n I[0] - b*I[0]) *(1/2)

Looking back on pg 27 we see that:

	tomorrow's increase in I (the number of infectious individuals) = a(S/n)I -bI

Taking this quantity times Δt

	(a(S/n)I -bI)*Δt

we obtain the quantity  we are looking for.

Since I is the number of infectious individuals and our time period, Δt, is (1/2)
Then 
	(a(S/n)I -bI)* (1/2)
	
is the number of infectious people per half a day.  

Since our formula gives us the values of S and I:  S[0] and I[0]
we can conclude that  the quantity measures the number of people that will become infected in the first half a day.

part b

Explain why the computation you did to complete the third column of the table in the previous excersise is represented functionally by

		S[(3/2)] = S[1] -( aS[1]/n I[1]) *(1/2)
	
		I[(3/2)] = I[1] +( aS[1]/n I[1] - b*I[1]) *(1/2)

Solution of part b

To find S in the third time period, or (3/2)day, we need to first find how many susceptable people we have in the previous time period, S[1].  Then we take the total number of susceptable people from the previous day, S[1], and subtract the number of people that became infected over the half a day between S[1] and S[(3/2)], ( aS[1]/n I[1]) *(1/2).
This gives us the total number susceptable on day (3/2)
	
		S[(3/2)] = S[1] -( aS[1]/n I[1]) *(1/2).

To find I in a(3/2)day, we need to first find how many infectious people we have in the previous time period, I[1].  Then we take the total number of infectious people from the previous day, I[1], and add the total number of people that were susceptable in the last period but are now infectious, ( aS[1]/n I[1]) *(1/2).  Now we need to subtract all of the individuals that were infected in the last period but are now removed,  b*I[1]*(1/2).
This gives us the formula

		I[(3/2)] = I[1] + aS[1]/n I[1]*(1/2) - b*I[1] *(1/2)
	
which, when combined, is

		I[(3/2)] = I[1] +( aS[1]/n I[1] - b*I[1]) *(1/2).

part c

How many new infections will there be in 1 hour?  Write formulas for S[t+(1/24)] and I[t+(1/24)] in terms of S[t] and I[t], which we assume are known, and where t has one of the values t=(k/24), k=0,1,2. . . ,95.

Solution of part c

We want to find	S[t+(1/24)] using S[t] and I[t] .

Knowing, 	S[t + Δt] = S[t] -( aS[t]/n I[t]) * Δt
	
We are looking for S at every hour.  We know that  there  are 24 hours in a day, so Δt=(1/24).

		S[t + (1/24)] = S[t] -( aS[t]/n I[t]) * (1/24)
	
If t=(k/24), where k= 0,1,2. . . ,95, then

		S[(k/24) + (1/24)] = S[(k/24)] -( aS[(k/24)]/n I[(k/24)]) * (1/24).

We want to find	I[t+(1/24)] using S[t] and I[t] . 

Knowing, 	I[t + Δt] = I[t] +( aS[t]/n I[t]-b*I[t]) * Δt
	
Since we are still using hours for our periods Δt still equals(1/24), Δt=(1/24), and t=(k/24), where k= 0,1,2. . . ,95

	 	I[(k/24) + (1/24)] = I[(k/24)] +( aS[(k/24)]/n I[(k/24)]-b*I[(k/24)]) * (1/24).

part d

How many total computations would you need to compute S[4], I[4], and R[4] in one hour steps?  (Count all additions and multiplications.  t=4 means 4 days.)

Solution of part d

We want to find the number of calculations in S, I, and R

		S[(1/24)] = S[0] -( aS[0]/n I[0]) *(1/24)
The calculations are {-, *, /, *, *}.  Number of calculations equals 5.

	
		I[(1/24)] = I[0] +( aS[0]/n I[0] - b*I[0] )*(1/24)
Assume that ( aS[0]/n I[0]) is known so that we don't have to recalculate this value then the calculations for I = {+, -, *, *}.  Number of calculations equals 4.

	
		R[(1/24)] = n - S[(1/24)] - I[(1/24)]
Assuming that both S[(1/24)] and I[(1/24)] are known and we don't need to calculate them then the calculations for R = {-, -}.  Number of calculations equals 2.

When calculating the next values assume anything that you have calculated in the past is known.  Therefore, there are 11 computations each hour.  The hours in four days equals 
24 * 4 = 96.  So the number of computations  for a four day period :

11 * 96

part e

Explain why the general recursive procedure for computaion of S[t] and I[t] is 
	Start with 	S[0]
			I[0]
For each successive t=Δt, 2Δt, 3Δt, . . ., compute the new function values,
	
		S[t + Δt] = S[t] -( aS[t]/n I[t]) * Δt
	
	 	I[t + Δt] = I[t] +( aS[t]/n I[t]-b*I[t]) * Δt

The computer does not mind doing all the computations required even to find S[400], I[400], and R[400] in one hour steps.  You will use a "Do loop" to write a computer program for this computation.

Solution of part e

Using a recursive formula, we save the computations from the previous formula so that  there  is less computing to do (as we saw in part d).  If we recomputed the values over again each time it would be a waste of our time since we already know the value that we have previously computed.

Exercise 3

Computer Project.