Sinusoidal and logistic models
IB Math AI · Functions
Sinusoidal models
$$f(t)=a\sin\bigl(b(t-c)\bigr)+d\quad\text{or}\quadf(t)=a\cos\bigl(b(t-c)\bigr)+d$$Read the four constants straight from the context:
$$a=\frac{\max-\min}{2},\qquad d=\frac{\max+\min}{2},\qquad b=\frac{2\pi}{\text{period}}$$and $c$ is a horizontal shift chosen so that the maximum (for $\cos$) or the midline crossing going up (for $\sin$) lands where the data says it does. Set the GDC to radians unless the question is in degrees, in which case $b=\dfrac{360}{\text{period}}$.
Logistic models
$$N(t)=\frac{L}{1+Ce^{-kt}}$$$L$ is the carrying capacity: the horizontal asymptote the population or the number of adopters cannot exceed. At $t=0$, $N(0)=\dfrac{L}{1+C}$, so $C$ is fixed by the starting value. The curve is S-shaped, with its steepest point at $N=\tfrac{L}{2}$, reached when $t=\dfrac{\ln C}{k}$.
Early on, $Ce^{-kt}\gg1$ and the logistic curve is almost indistinguishable from pure exponential growth. That is exactly why unconstrained exponential forecasts are dangerous: they are right at first and catastrophically wrong later.
What to read out: the real data dots deviate from the curve most in the two changeover months (month $3$ and month $9$), where reality changes temperature faster than a smooth sine function. That is exactly the answer to the “comment on the fit” part: the sinusoidal model captures the yearly repetition very well but smooths out the seasonal transitions too much, so it is good for estimating averages, while for predicting a specific month it may be off by more than one degree.
Worked example: fitting a sinusoidal function to monthly mean temperatures
The monthly mean temperature of a city is highest at $29.5$ °C in month $7$ and lowest at $17.0$ °C in month $1$. Let $t$ be the month number, with $t=1$ corresponding to month $1$.
(a) Build a sinusoidal model for the temperature. (b) Find the months whose mean temperature exceeds $27$ °C.
Solution
(a) The four constants:
$$a=\frac{29.5-17.0}{2}=6.25,\qquad d=\frac{29.5+17.0}{2}=23.25,\qquad b=\frac{2\pi}{12}=\frac{\pi}{6}$$The minimum falls at $t=1$. The function $-\cos$ reaches its minimum when the argument is $0$, so choose $c=1$:
$$T(t)=23.25-6.25\cos\!\left(\frac{\pi(t-1)}{6}\right)$$Check: $T(1)=23.25-6.25=17.0$ and $T(7)=23.25+6.25=29.5$, matching both thresholds.
(b) Solve $T(t)>27$:
$$23.25-6.25\cos\theta>27\;\Rightarrow\;\cos\theta<-0.600,\qquad \theta=\frac{\pi(t-1)}{6}$$$$2.2143<\theta<4.0689\;\Rightarrow\;4.229<t-1<7.771\;\Rightarrow\;5.23<t<8.77$$The whole months in the interval are $t=6$, $7$, $8$, that is, months $6$, $7$ and $8$. The model also tells us that the hot spell lasts $8.77-5.23=3.54$ months, that is, less than three and a half months of the year.
Comment. The model predicts month $4$ as $T(4)=23.25$ °C. If the real figure for month $4$ is $24.0$ °C, then the percentage error is $3.1\%$, acceptable for a model that uses only two data points, but large enough that it should not be used in place of real data when available.
Worked example: logistic model and the limits of exponential forecasting
The number of users of an app, in thousands of people, is modeled by $N(t)=\dfrac{4\,500}{1+74e^{-0.62t}}$ where $t$ is the number of years since launch.
(a) Find $N(0)$ and the carrying capacity. (b) Find the time when the number of users reaches half the carrying capacity. (c) Compare with the exponential model $N\approx60e^{0.62t}$ at $t=3$ and $t=10$.
Solution
(a) $N(0)=\dfrac{4\,500}{1+74}=\dfrac{4\,500}{75}=60$ thousand people. As $t\to\infty$, $e^{-0.62t}\to0$, so the carrying capacity is $L=4\,500$ thousand people.
(b) Set $N=2\,250$:
$$1+74e^{-0.62t}=2\;\Rightarrow\;e^{-0.62t}=\frac{1}{74}\;\Rightarrow\;t=\frac{\ln 74}{0.62}=\frac{4.3041}{0.62}=6.94\ \text{years}$$(c)
| $t$ (years) | $3$ | $10$ |
|---|---|---|
| Logistic | $359$ thousand | $3\,911$ thousand |
| Exponential | $385$ thousand | $29\,565$ thousand |
| Difference | $+7\%$ | $+656\%$ |
In year three, the two models differ by $7\%$, within the error of any market measurement, so looking at the first three years of data it is impossible to tell them apart. In year ten, the exponential model gives $29.6$ million users, almost seven times the carrying capacity of $4.5$ million, a meaningless number because the market does not have that many people.
The conclusion worth writing in the solution: the two models coincide in exactly the period where we have data and separate in exactly the period we want to forecast. To choose between them you cannot rely on how well they fit past data; you must rely on an argument about carrying capacity: population, number of smartphones, number of households.
Common mistake
First trap: taking the whole range of oscillation as the amplitude. With temperatures from $17.0$ to $29.5$ degrees, the amplitude is $6.25$, not $12.5$. Get this wrong and the curve oscillates from $10.75$ to $35.75$ degrees and every later question is wrong as well, even if the inequality solving is entirely correct.Second trap: leaving the calculator in the wrong mode. $\cos(0.5)$ in radians is $0.878$; in degrees it is $0.99996$. Both are valid numbers so the calculator says nothing. A way to check yourself: the period you calculate must equal the period the problem describes: $12$ months, $24$ hours, $12.5$ hours.
Third trap: taking $L$ as the initial value of a logistic model. In $N=\frac{4\,500}{1+74e^{-0.62t}}$, the number $4\,500$ is the destination, not the starting point; the starting point is $\frac{4\,500}{75}=60$. And the constant $74$ has no units; it only encodes the gap between those two numbers.