# Defining Non-Recursive Functions for the Multiplier

Given the following criteria for a recursive function:

  1. b_0 = a
  2. m_0 = 1
  3. b_{n+1} = b_n \cdot r
  4. m_{n+1} = m_n + b_n

The non-recursive function m(n) can be derived as follows:

From 3,

b_n = a \cdot r^n \text{ (geometric sequence)} 

Substitute b_n into 4:

m_{n+1} = m_n + a \cdot r^n 

The sum of the first n terms of a \cdot r^n is:

S_n = a \cdot \frac{1 - r^n}{1 - r}

Hence, the non-recursive function m(n) is:

m(n) = 1 + a \cdot \frac{1 - r^n}{1 - r} 

We now define: 5. t as the time in days 6. t_n as the number of days in an interval n

We now substitute n with t/t_n to derive m(t).

\large{
m(t) = 1 + a \cdot \frac{1 - r^{ \frac{t}{t_n}}}{1 - r} 
}

This function follows a smooth curve between intervals. Next, we will derive a function that still satisfies the original criteria, but increases linearly between intervals.

We will now derive the equation for m(t) that linearly interpolates between intervals.

First, calculate the multiplier at the start of the current interval n, m_n, and the start of the next interval n+1, m_{n+1}:

m_n = 1 + a \cdot \frac{1 - r^n}{1 - r} 
m_{n+1} = 1 + a \cdot \frac{1 - r^{n+1}}{1 - r} 

Linearly interpolate between m_n and m_{n+1} over the interval tn:

m(t) = m_n + \frac{m_{n+1} - m_n}{tn} \cdot (t - n \cdot tn) 
\text{ where } n = \left\lfloor \frac{t}{tn} \right\rfloor 

Substitute m_n and m_{n+1} into the interpolation formula:

\large{
m(t) = \left(1 + a \frac{1 - r^{\lfloor \frac{t}{tn} \rfloor}}{1 - r}\right) + \frac{\left(1 + a \frac{1 - r^{\lfloor \frac{t}{tn} \rfloor + 1}}{1 - r}\right) - \left(1 + a \frac{1 - r^{\lfloor \frac{t}{tn} \rfloor}}{1 - r}\right)}{tn} \cdot \left(t - \lfloor \frac{t}{tn} \rfloor \cdot tn\right)
}

This revised equation ensures that m(t) increases linearly between intervals, starting from the value given by the original exponential decay model at the beginning of each interval.