Max Projection
Remix this to get started with Julia
Here we try to calculate the "Max Projection" using the following assumotions
The peak day is day 56
The gradient (of daily growth) at the peak is -0.0031
The value of daily growth at peak is exactly 1.000000000000000000000000
The gradient is fixed at peak and remains constant for the next 24 days
After 24 days, the gradient is halved
The number of cases on peak day is 511
const peakday = 56.0
const gradient = -0.0031
const dailygrowth_atpeak = 1.0
function growth_rate(d)
if d <= peakday + 24.0
return dailygrowth_atpeak + (d - peakday) * gradient
else
return growth_rate(peakday + 24.0) + (d - (peakday + 24)) * (gradient/2.0)
end
end
The Max Projection on peakday is 511
The Max Projection on day d is the growth rate on that day times the Max Projection of the day before
function max_projection(d)
if d <= peakday
return 511.0
end
if d > peakday
return growth_rate(d) * max_projection(d-1.0)
end
end
Create a floating point array starting at 56 and ending at 105
days = Float64.(collect(56:105))
Applying the function max_projection to a vector of floating point values then rounding it
maxpro = round.( max_projection.(days) )
Finally we obtain our array of "day,max projection value"
[ (days[k],maxpro[k]) for k=1:105-56+1 ]