Summary: I'm trying to model a progression for a daily target count that starts at 5,000 on Day 1 and ends at 7,200 on Day 31. The progression should initially have a higher rate of increase, which decreases around the midpoint of the month, and then maintains a slower, consistent rate of increase.
Details: The expected progression should:
Start at 5,000 on Day 1. Have an increase of about 200 on Day 1. End at 7,200 on Day 31. Have an increase of about 80 on Day 31.
Research: I've come across various mathematical functions that could potentially model this progression, such as polynomial, exponential, and sigmoid functions.
Attempts: I've tried using polynomial functions, but they don't provide the S-shaped curve I'm looking for. I believe a sigmoid function could work but I'm not sure how to implement it or adjust its parameters.
Issue: I can't seem to get the final value around 7,200 with the increments I desire.
import math
def daily_target(d):
a = 5000
b = 7200
m = 15.5
# Adjust c to change the steepness and fit the initial and final increments.
c = 0.3
return a + (b-a) / (1 + math.exp(-c*(d-m)))
Test for day 1 to 31
for i in range(1, 32):
print(f"Day {i}: {daily_target(i):.2f}")
Gives
Day 1: 5028.03
Day 2: 5037.67
Day 3: 5050.55
Day 4: 5067.69
Day 5: 5090.40
Day 6: 5120.30
Day 7: 5159.34
Day 8: 5209.77
Day 9: 5274.02
Day 10: 5354.44
Day 11: 5452.91
Day 12: 5570.30
Day 13: 5705.81
Day 14: 5856.59
Day 15: 6017.65
Day 16: 6182.35
Day 17: 6343.41
Day 18: 6494.19
Day 19: 6629.70
Day 20: 6747.09
Day 21: 6845.56
Day 22: 6925.98
Day 23: 6990.23
Day 24: 7040.66
Day 25: 7079.70
Day 26: 7109.60
Day 27: 7132.31
Day 28: 7149.45
Day 29: 7162.33
Day 30: 7171.97
Day 31: 7179.16
Update;
def rate_of_increase(d):
b = 200
c = (80 - b) / 30 # linear rate of change from day 1 to day 31
a = (2200 - 31*(c*30/2 + b)) / (30**4 / 4)
return a*(d-1)**3 + c*(d-1) + b
def daily_target():
targets = [5000]
for i in range(1, 31):
targets.append(targets[i-1] + rate_of_increase(i))
return targets
Test for day 1 to 31
targets = daily_target()
for i, target in enumerate(targets):
print(f"Day {i+1}: {target:.2f}")
Appears to work at first, but then it bypasses the target 7200 and drops eventually to it.
Day 1: 5000.00
Day 2: 5200.00
Day 3: 5395.99
Day 4: 5587.90
Day 5: 5775.62
Day 6: 5958.94
Day 7: 6137.62
Day 8: 6311.34
Day 9: 6479.71
Day 10: 6642.30
Day 11: 6798.60
Day 12: 6948.03
Day 13: 7089.97
Day 14: 7223.70
Day 15: 7348.49
Day 16: 7463.49
Day 17: 7567.82
Day 18: 7660.54
Day 19: 7740.62
Day 20: 7806.98
Day 21: 7858.50
Day 22: 7893.96
Day 23: 7912.09
Day 24: 7911.56
Day 25: 7890.98
Day 26: 7848.89
Day 27: 7783.77
Day 28: 7694.02
Day 29: 7578.02
Day 30: 7434.03
Day 31: 7260.29
Any feedback on approach would be appreciated.