Converting Circular formulae to Independent functions

84 Views Asked by At

I have a set of equations which I'm trying to transform from a recursive relationship to a more absolute/relative notation. Ideally this is to transform row-based logic into a set-based one for SQL.

I currently have the following equations where $A_n$, $I_n$, and $S_n$ are given for all $_n$ and $\alpha_0 = 0$: $$\begin{align} \alpha_n &= \omega_{n-1} \\ \beta_n &= \alpha_n + I_n - S_n \\ \delta_n &= A_n \times \beta_n \\ \omega_n &= \beta_n - \delta_n \end{align}$$

Because of the dependency between $\alpha_n$ and the previous $\omega_{n-1}$, it only allows for a row-based calculation which considerably slows down the SQL performance.

I'm looking for a transformation of the above equations to more of a set-based approach, and I've gotten to something along the lines of the following (but can't implement due to the circular dependencies): $$\begin{align} \alpha_n &= \sum_{k=0}^{n-1}\Delta_k \\ \beta_n &= \alpha_n + I_n - S_n \\ \delta_n &= A_n \times \beta_n \\ \Delta_n &= I_n - S_n - \delta_n \\ \omega_n &= \sum_{k=0}^n\Delta_k \end{align}$$

I just need an independent function that can support the other derived values. I think closed-form? Much like how the $n^{th}$ Fibonacci number can be represented with $$F_n=\frac{(1+5^{1/2})^n -(1-5^{1/2})^n}{2^n\sqrt5}$$

First time posting here, I welcome all corrections, Thanks!


Edit:

I broke out the recurrence relation provided by @AlexRavsky in Excel using: $$\begin{align} f_n &= 1 - A_n \\ g_n &= f_n (I_n - S_n) \\ h_n &= \prod_{k=0}^{n-1} f_k \text{, where } h_0 = 1 \\ i_n &= \sum_{m=0}^{n-1}\frac{g_m}{h_m} \text{, where } i_0 = 0 \\ \chi_n &= h_n (X_0 + i_n) \end{align}$$

I couldn't figure out what $X_0$ is by changing what $\chi$ represents as $\chi \in \{\alpha, \beta, \delta, \omega\}$ from my original set of equations in Excel. I hope I didn't mess up on the equations above $(f_n, g_n, h_n, i_n, \text{or } \chi_n)$, still need a bit more information to get this working as they don't match with my expected values.

2

There are 2 best solutions below

8
On BEST ANSWER

As hamam_Abdallah showed, $\alpha_{n+1}=f_n \alpha_n+g_n$, where $f_n=1-A_n$ and $g_n=(1-A_n)(I_n-S_n)$. This is a first-order non-homogeneous recurrence relation with variable coefficients. So, provided all $A_n$ are distinct from $1$, its solution (for $n\ge 1$) is

$$\alpha_n=\left(\prod_{k=0}^{n-1} f_k\right)\left(\alpha_0+\sum_{m=0}^{n-1}\frac{g_m}{\prod_{k=0}^m f_k} \right).$$

I guess that the formulae for $\beta_n$, $\delta_n$, and $\omega_n$ are similar, but for some special cases of $\{A_n\}$, $\{I_n\}$, and $\{S_n\}$ they can be more simple.

2
On

hint

$$\alpha_{n+1}=\omega_n=$$ $$\beta_n-\delta_n=\beta_n(1-A_n)$$

$$=(\alpha_n+I_n-S_n)(1-A_n)$$