User:Jaffa3027/Sandbox

Our goal is to calculate a general measure for an finance account, it is similar for a fund price NAV (Net Asset Value) Balance equation $$A = L + C - D + I - E$$

where A = Assets L = Liability C = Capital D = Drawing I = Revenue E = Expense

and we defined $$D = A -L$$ (Equity), $$U = C - D$$ (Net drawing) and $$ R = I -U$$ (Result)

$$D = U + R$$

Differance

$$d = u + r$$

In countinues case we have

$$z = x y = d$$

$$|z| = x y $$

$$z' = x' y + x y' = u + r$$

$$\frac{z'}{|z|} = \frac{x' y}{|z|} + \frac{x y'}{|z|} = \frac{u}{|z|} + \frac{r}{|z|}$$

$$x' y = r$$ → $$ \frac {x'}{x} = \frac {r}{z}$$→ $$ x = x_{0} e^{\sum \frac{r}{z}}$$

$$ x y'= u$$ ,→ $$ \frac {y'}{y} = \frac {u}{z}$$ → $$ y = y_{0} e^{\sum \frac{u}{z}}$$

$$x_{0}=100$$ → $$y_{0}=\frac{z_{0}}{100}$$

Now

$$ z = z_{0} e^{\sum \frac{r}{z}} e^{\sum \frac{u}{z}}$$

To handle sampled data we have work with difference

$$z_{i} = x_{i} y_{i}$$

and

$$|z_{i}| = x_{i} y_{i}$$

$$\Delta z_{i} = \Delta (x_{i} y_{i})=x_{i} y_{i} -  x_{i-1} y_{i-1} = z_{i} -z_{i-1}$$

Now

(A) $$z_{i} -z_{i-1} = x_{i} y_{i} + x_{i} y_{i-1} -x_{i} y_{i-1} -  x_{i-1} y_{i-1} = x_{i} (y_{i}  + y_{i-1}) -(x_{i}  -  x_{i-1} )y_{i-1} $$

or

(B)$$z_{i} -z_{i-1} = x_{i} y_{i} + x_{i-1} y_{i} -x_{i-1} y_{i} -  x_{i-1} y_{i-1} =(x_{i}  + x_{i-1}) y_{i} -x_{i-1} (y_{i} -  y_{i-1})$$,

We have

$$x_{i-1}(y_{i}-y_{i-1})=u_{i}$$

$$\frac{x_{i-1}(y_{i}-y_{i-1})}{|z_{i-1}|}=\frac{u_{i}}{|z_{i-1}|}$$, $$\frac{y_{i}-y_{i-1}}{y_{i-1}}=\frac{u_{i}}{|z_{i-1}|}$$

and we get

(1) $$y_{i}=y_{i-1}(1 +\frac{u_{i}}{|z_{i-1}|})$$

and start with $$y_{0}=\frac{z_{0}}{100}$$

$$ x_{i} = \frac{z_{i}}{y_{i}}$$

$$(x_{i} + x_{i-1}) y_{i} = r_{i}$$

$$\frac{(x_{i} + x_{i-1}) y_{i}}{|z_{i}|} = \frac{r_{i}}{|z_{i}|}$$,$$\frac{(x_{i}  + x_{i-1}) }{x_{i}} = \frac{r_{i}}{|z_{i}|}$$

(2) $$x_{i} = x_{i-1}\frac{1}{1-\frac{r_i}{|z_{i}|}}=x_{i-1}(1+\frac{\frac{r_i}{|z_{i}|}}{1-\frac{r_i}{|z_{i}|}})$$

and

$$ y_{i} = \frac{z_{i}}{x_{i}}$$

So if $$u_{i}>=0$$ the we use (1) else (2)

If $$x<=0$$ and $$y<=0$$ the we set $$x_{i}=100$$

$$x_{i}(y_{i}-y_{i-1})=u_{i}$$

$$\frac{x_{i}(y_{i}-y_{i-1})}{|z_{i}|}=\frac{u_{i}}{|z_{i}|}$$, $$\frac{y_{i}-y_{i-1}}{y_{i}}=\frac{u_{i}}{|z_{i}|}$$

$$y_{i} = y_{i-1}\frac{1}{1-\frac{u_i}{|z_{i}|}}=y_{i-1}(1+\frac{\frac{u_i}{|z_{i}|}}{1-\frac{u_i}{|z_{i}|}})\approx y_{i-1}(1+\frac{u_i}{|z_{i}|})$$