Mathematically, Dfyn V2 uses the same formulas as Dfyn V1, but they have been enhanced and augmented in comparison to V1.
To facilitate transitioning between price ranges, streamline liquidity management, and avoid rounding errors, Dfyn V2 introduces the following concepts:
$$ L = \sqrt{xy} $$
The liquidity of a pool is determined by the product of two numbers, which represent the amount of token reserves in the pool. The measure of liquidity, represented by the variable $L$, is the square root of the product of these two numbers ($x$ and $y$). This means that $L$ is the geometric mean of $x$ and $y$, and when $L$ is multiplied by itself, the result is equal to the product of $x$ and $y$ $(k)$. This formula can be written as $L =$ $\sqrt{xy}$ , where x and y are the token reserves and k is their product.
$$ \sqrt{P} = \sqrt{\frac{y}{x}} $$
${y/x}$ is the price of token 0 in terms of 1. Since token prices in a pool are reciprocals of each other, we can use only one of them in calculations (and by convention DfynV2 uses $y/x$).
The price of token 1 in terms of token 0 is simply. $\frac{1}{y/x}=\frac{x}{y}$ Similarly, $\frac{1}{\sqrt{P}} = \frac{1}{\sqrt{y/x}} = \sqrt{\frac{x}{y}}$
Why using $\sqrt{P}$ instead of P? There are two reasons:
$$ L=ΔPΔy
$$
$$ Proof: \\ \sqrt{xy}=\frac{y_1−y_0}{\sqrt{P_1}-\sqrt{P_0}} \\ \sqrt{xy}({\sqrt{P_1}-\sqrt{P_0}})= {y_1−y_0} \\ \sqrt{xy}(\sqrt{\frac{y_1}{x_1}}-\sqrt{\frac{y_0}{x_0}})={y_1−y_0} \\ Since,\sqrt{x_0y_0}=\sqrt{x_1y_1}=\sqrt{xy}=L \\ \sqrt{\frac{x_1y_1y_1}{x_1}}-\sqrt{\frac{x_0y_0y_0}{x_0}} = {y_1−y_0} \\ \sqrt{y_1^2}-\sqrt{y_0^2} = {y_1−y_0} \\ {y_1−y_0}={y_1−y_0}
$$
Again, we don’t need to calculate actual prices–we can calculate output amount right away. Also, since we’re not going to track and store $x$ **and $y$ our calculation will be based only on $L$ and $\sqrt{P}$. From the formula above we can calculate $Δy$.
$$ Δy = Δ\sqrt{P}L $$
As we discussed above, prices in a pool are reciprocals of each other. Thus $Δx$ is:
$$ Δx = Δ\frac{1}{\sqrt{P}}L $$