diff --git a/src/ConstantSum/README.md b/src/ConstantSum/README.md index b9bf52b7..e5b414b3 100644 --- a/src/ConstantSum/README.md +++ b/src/ConstantSum/README.md @@ -14,7 +14,9 @@ We mark reserves as: - $P \equiv \mathtt{price}$ The **trading function** is: -$$\boxed{\varphi(x,y,L;P) = \frac{x}{L} + \frac{y}{LP} -1}$$ +$$ +\boxed{\varphi(x,y,L;P) =P \frac{x}{L} + \frac{y}{L} -1} +$$ where $L$ is the **liquidity** of the pool. ## Price @@ -23,11 +25,17 @@ The reported price of the pool given the reseres is $P$. ## Pool initialization The `ConstantSum` pool can be initialized with any given price and any given value of reserves. A user may supply $(x_0,y_0,P)$, then we find that: -$$L_0 = x_0 + \frac{y_0}{P}$$ + +$$ +L_0 = Px_0 + y_0 +$$ ## Swap We require that the trading function remain invariant when a swap is applied, that is: -$$\frac{x+\Delta_X}{L + \Delta_L} + \frac{y+\Delta_Y}{P(L + \Delta_L)}-1 = 0$$ +$$ +P\frac{x+\Delta_X}{L + \Delta_L} + \frac{y+\Delta_Y}{L + \Delta_L}-1 = 0 +$$ + where either $\Delta_X$ or $\Delta_Y$ is given by user input and the $\Delta_L$ comes from fees. ### Trade in $\Delta_X$ for $\Delta_Y$ @@ -48,8 +56,10 @@ $$\boxed{\Delta_X = \frac{\gamma}{P} \Delta_Y}$$ Allocations and deallocations should not change the price of a pool and since this pool only quotes a single price, any amount of reserves can be allocated at any time. We need only compute the new $L$. Specifically: -$$\Delta_L = \Delta_X + \frac{\Delta_Y}{P}$$ +$$ +\Delta_L = P\Delta_X + \Delta_Y +$$ ## Value Function via $L$ and $S$ Given that we treat $Y$ as the numeraire, we know that the portfolio value of a pool when $X$ is at price $S$ is: diff --git a/src/GeometricMean/README.md b/src/GeometricMean/README.md index 2f68b956..9f50d9d3 100644 --- a/src/GeometricMean/README.md +++ b/src/GeometricMean/README.md @@ -6,106 +6,97 @@ The `GeometricMean` DFMM gives the LP a portfolio that consists of a value-weigh If we pick the weight of the $X$-token to be $0.80$ and $0.20$ for the $Y$-token, then the LP will have a portfolio that is 80% in $X$ and 20% $Y$ by value. ## Core -We mark reserves as: -- $x \equiv \mathtt{rX}$ -- $y \equiv \mathtt{rY}$ +We mark the vector reserves as: +- $\boldsymbol{r} \in \R^n_+ \equiv \mathtt{reserves}$ -`GeometricMean` has two variable parameters: -- $w_X \equiv \mathtt{wX}$ -- $w_Y \equiv \mathtt{wY}$ +`GeometricMean` also assigns weights to each of the reserves: +- $\boldsymbol{w} \in [0,1]^n \equiv \mathtt{weights}$ - These parameters must satisfy $$ -w_x, w_y \geq 0 \\ -w_x+w_y=1 +\sum_{i=0}^{n-1} w_i = 1 $$ The **trading function** is: $$ -\boxed{\varphi(x,y;w_X,w_Y) = \left(\frac{x}{L}\right)^{w_X} \left(\frac{y}{L}\right)^{w_Y} -1} +\boxed{\varphi(\mathbf{r}, L;\mathbf{w}) = \prod_{i=0}^{n-1}\left(\frac{r_i}{L}\right)^{w_i} -1} $$ where $L$ is the **liquidity** of the pool. ## Price -The reported price of the pool given the reseres is: +The reported price of Token $i$ with respect to Token $j$is: $$ \begin{equation} -\boxed{P = \frac{w_X}{w_Y}\frac{y}{x}} +\boxed{P_{ij} = \frac{w_i}{w_j}\frac{r_j}{r_i}} +\end{equation} +$$ +Note $P_{ij} \neq P_{ji}$ in general. +Furthermore, assuming that token $n-1$ is the numeraire, then we can just write the price of Token $i$ as: +$$ +\begin{equation} +P_i = \frac{w_i}{w_{n-1}}\frac{r_{n-1}}{r_i} \end{equation} $$ -## Pool initialization -We need to initalize a pool from a given price $S_0$ and an amount of a token $x_0$ or $y_0$. +## Pool initialization +To initalize a pool, we must first specify the initial reserves and the weights. +Equivalently, and often more conveniently, we can specify the initial prices, the weights, and an amount of the numeraire token (Token $n-1$). -### Given $x$ and price -Using the price formula above in Eq. (1), we can solve for $y_0$: +### Given Reserves and Weights +If we are given the reserves and the weights, then we can solve for the liquidity by: $$ -\boxed{y_0 = \frac{w_Y}{w_X}S_0 x_0} +L = \prod_{i=0}^{n-1} r_i^{w_i}. $$ -### Given $y$ and price -Again, using Eq. (1), we get: +### Given Prices and Weights +If we have $P_i$ for all $i$ (noting that $P_{n-1} = 1$ by definition), then we can solve for the amount of reserve $r_i$ by: $$ -\boxed{x_0 = \frac{w_X}{w_Y}\frac{1}{S_0}y_0} +r_i = \frac{w_i}{w_{n-1}}\frac{r_{n-1}}{P_i}, $$ +since the user will also have to specify the amount of the numeraire token. +We then compute $L$ as before. ## Swap We require that the trading function remain invariant when a swap is applied, that is: $$ -\left(\frac{x+\Delta_X}{L + \Delta_L}\right)^{w_X} \left(\frac{y+\Delta_Y}{L + \Delta_L}\right)^{w_Y}-1 = 0 +\boxed{\varphi(\mathbf{r} + \mathbf{\Delta_r}, L + \Delta_L;\mathbf{w}) = \prod_{i=0}^{n-1}\left(\frac{r_i + \Delta_{r_i}}{L + \Delta_L}\right)^{w_i} -1}. $$ -where either $\Delta_X$ or $\Delta_Y$ is given by user input and the $\Delta_L$ comes from fees. +In our case, we will deal with only single token input and single token output swaps. +Also, the $\Delta_L \geq 0$ and, in particular, is greater than zero when there is a nonzero swap fee. -In general, with a fee parameter $\gamma$, we have: +In general, with a fee parameter $\gamma$, we have a change in $L$ when tendering $r_i$ given by: $$ -\Delta_L = w_R(1-\gamma) L \frac{\Delta_R}{R} +\Delta_L = w_i(1-\gamma) L \frac{\Delta_{r_i}}{r_i}. $$ -where $R$ represents either token $X$ or $Y$. -### Trade in $\Delta_X$ for $\Delta_Y$ -If we want to trade in $\Delta_X$ for $\Delta_Y$, -we use our invariant equation and solve for $\Delta_Y$ in terms of $\Delta_X$ to get: -$$ -\boxed{\Delta_Y = \left(\frac{L + \Delta_L}{(x+\Delta_X)^{w_X}} \right)^{\frac{1}{w_Y}} - y} -$$ -### Trade in $\Delta_Y$ for $\Delta_X$ +### Trade in $\Delta_{r_i}$ for $\Delta_{r_j}$ If we want to trade in $\Delta_X$ for $\Delta_Y$, we use our invariant equation and solve for $\Delta_Y$ in terms of $\Delta_X$ to get: $$ -\boxed{\Delta_X = \left(\frac{L + \Delta_L}{(y+\Delta_Y)^{w_Y}} \right)^{\frac{1}{w_X}} - x} +\boxed{\Delta_{r_j} = \left(\frac{L + \Delta_L}{\displaystyle{\prod_{k \in \{0,\dots, n-1\} \setminus j}^{n-1} r_k^{w_k}}} \right)^{\frac{1}{w_X}} - r_j} $$ +This amount will be negative and the equation should be negated if you want a positive amount out. ## Allocations and Deallocations -**Input $\delta_X$:** If a user wants to allocate a specific amount of $\delta_X$, then it must be that: +**Input $\Delta_{r_i}$:** If a user wants to allocate a specific amount of Token $r_i$, then it must be that: $$ -\frac{x}{L} = \frac{x+\Delta_X}{L+\Delta_L} +\frac{r_i}{L} = \frac{r_i+\Delta_{r_i}}{L+\Delta_L} $$ which yields: $$ \Delta_L = L \frac{\Delta_X}{x} $$ -Then it must be that since the ratio of reserves cannot change. +Then it must be that since the ratio of reserves cannot change, so the amount that the other reserves change by is: $$ -\Delta_Y = y\frac{\Delta_X}{x} +\Delta_{r_j} = r_j\frac{\Delta_{r_i}}{r_i} $$ -**Input $\Delta_Y$:** To allocate a specific amount of $\Delta_Y$, then it must be that: -$$ -\frac{y}{\mu L} = \frac{y+\Delta_Y}{\mu(L+\Delta_L)} -$$ -which yields: -$$ -\Delta_L = L \frac{\Delta_Y}{y} -$$ -and we likewise get -$$ -\Delta_X = x\frac{\Delta_Y}{y} -$$ ## Value Function via $L$ and $S$ +To look at a value function, we will consider a pool with just a token $X$ and a numeraire $Y$. Given that we treat $Y$ as the numeraire, we know that the portfolio value of a pool when $X$ is at price $S$ is: $$ V = Sx(S) + y(S) @@ -121,3 +112,4 @@ $$ \boxed{V(L,S)=LS^{w_X}\left(\left( \frac{w_X}{w_Y}\right)^{w_Y}+\left( \frac{w_Y}{w_X}\right)^{w_X}\right)} $$ +For pools with $n$-tokens, the value function for any pair $r_i$ and the numeraire $r_{n-1}$ is given as above. \ No newline at end of file diff --git a/src/GeometricMean/geometric_mean.nb b/src/GeometricMean/geometric_mean.nb index 73ec28e0..3285011a 100644 --- a/src/GeometricMean/geometric_mean.nb +++ b/src/GeometricMean/geometric_mean.nb @@ -10,10 +10,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 161, 7] -NotebookDataLength[ 83159, 2316] -NotebookOptionsPosition[ 75246, 2169] -NotebookOutlinePosition[ 75802, 2188] -CellTagsIndexPosition[ 75759, 2185] +NotebookDataLength[ 84997, 2374] +NotebookOptionsPosition[ 77062, 2225] +NotebookOutlinePosition[ 77621, 2244] +CellTagsIndexPosition[ 77578, 2241] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -45,7 +45,7 @@ Cell[BoxData[ RowBox[{"don", "'"}], "t"}]}], " ", "*)"}]}]], "Code", CellChangeTimes->{{3.9119115610079527`*^9, 3.91191157715276*^9}}, CellLabel-> - "In[813]:=",ExpressionUUID->"90a85ca4-15ef-43a6-a1c9-9ded2b5b4873"], + "In[940]:=",ExpressionUUID->"90a85ca4-15ef-43a6-a1c9-9ded2b5b4873"], Cell[CellGroupData[{ @@ -128,7 +128,7 @@ Cell[BoxData[{ 3.911912447202764*^9}, {3.9119132862667913`*^9, 3.911913339991631*^9}, { 3.911913462657144*^9, 3.9119134680216084`*^9}}, CellLabel-> - "In[814]:=",ExpressionUUID->"7253b091-e52f-418b-a1c8-287d88022e6a"] + "In[945]:=",ExpressionUUID->"7253b091-e52f-418b-a1c8-287d88022e6a"] }, Open ]], Cell[CellGroupData[{ @@ -162,7 +162,7 @@ Cell[BoxData[ CellChangeTimes->{{3.911912501940172*^9, 3.911912546049423*^9}, { 3.911912581390644*^9, 3.911912592262026*^9}}, CellLabel-> - "In[818]:=",ExpressionUUID->"18a899a0-963a-45c4-a7a0-9fbeda760047"] + "In[949]:=",ExpressionUUID->"18a899a0-963a-45c4-a7a0-9fbeda760047"] }, Open ]], Cell[CellGroupData[{ @@ -177,12 +177,17 @@ Cell[BoxData[ RowBox[{"x_", ",", "y_", ",", "L_", ",", "w_"}], "]"}], ":=", RowBox[{ RowBox[{ - SuperscriptBox["x", "w"], - SuperscriptBox["y", - RowBox[{"1", "-", "w"}]]}], "-", "L"}]}]], "Code", - CellChangeTimes->{{3.911912609075673*^9, 3.911912634724598*^9}}, + SuperscriptBox[ + RowBox[{"(", + FractionBox["x", "L"], ")"}], "w"], + SuperscriptBox[ + RowBox[{"(", + FractionBox["y", "L"], ")"}], + RowBox[{"1", "-", "w"}]]}], "-", "1"}]}]], "Code", + CellChangeTimes->{{3.911912609075673*^9, 3.911912634724598*^9}, { + 3.918572627487279*^9, 3.918572655393495*^9}}, CellLabel-> - "In[819]:=",ExpressionUUID->"25e959b2-4561-4b40-a658-c7cf56341acc"] + "In[951]:=",ExpressionUUID->"25e959b2-4561-4b40-a658-c7cf56341acc"] }, Open ]] }, Open ]] }, Open ]], @@ -218,7 +223,7 @@ Cell[BoxData[{ SubscriptBox["\[Gamma]", "0"]}], "}"}], " ", "=", " ", RowBox[{"{", RowBox[{ - FractionBox["1", "2"], ",", "1"}], "}"}]}], ";"}], "\n", + FractionBox["1", "4"], ",", "0.995"}], "}"}]}], ";"}], "\n", RowBox[{"Assert", "[", RowBox[{"0", "<=", SubscriptBox["w", "0"], "<=", "1"}], "]"}], "\n", @@ -238,9 +243,10 @@ Cell[BoxData[{ 3.916758461710663*^9, 3.916758485200482*^9}, {3.9167630696181583`*^9, 3.9167630711333857`*^9}, {3.9168506991445208`*^9, 3.916850699759934*^9}, { 3.917375527833433*^9, 3.917375530306773*^9}, {3.917474535641025*^9, - 3.917474536663909*^9}}, + 3.917474536663909*^9}, {3.918572905622752*^9, 3.918572908365975*^9}, { + 3.918573026581327*^9, 3.918573026707073*^9}}, CellLabel-> - "In[820]:=",ExpressionUUID->"a277fd9d-36f8-4eee-9601-665001bbe972"], + "In[1101]:=",ExpressionUUID->"a277fd9d-36f8-4eee-9601-665001bbe972"], Cell[CellGroupData[{ @@ -248,18 +254,17 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"\\!\\(\\*SubscriptBox[\\(w\\), \\(0\\)]\\) = \"\>", "EchoLabel"], " ", - FractionBox["1", "2"]}]], "Echo", + FractionBox["1", "4"]}]], "Echo", CellChangeTimes->{ - 3.917474537220233*^9},ExpressionUUID->"e292a780-3309-44c3-be1d-\ -26b2a20e24a3"], + 3.91857302718543*^9},ExpressionUUID->"cba24bcd-4248-4768-9ccc-38294fdb5805"], Cell[BoxData[ RowBox[{ TagBox["\<\"\\!\\(\\*SubscriptBox[\\(\[Gamma]\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "1"}]], "Echo", + "EchoLabel"], " ", "0.995`"}]], "Echo", CellChangeTimes->{ - 3.917474537230825*^9},ExpressionUUID->"b4ef115e-13e6-465e-afa5-\ -f607b00b73a0"] + 3.918573027217659*^9},ExpressionUUID->"9e0f3cc3-161b-4f64-8955-\ +315bd5479577"] }, Open ]] }, Open ]] }, Open ]], @@ -285,7 +290,7 @@ Cell[BoxData[{ SubscriptBox["x", "0"], ",", SubscriptBox["S", "0"]}], "}"}], " ", "=", " ", RowBox[{"{", - RowBox[{"1", ",", " ", "1"}], "}"}]}], ";"}], " "}], "\n", + RowBox[{"1000000000", ",", " ", "1"}], "}"}]}], ";"}], " "}], "\n", RowBox[{ RowBox[{"Echo", "[", RowBox[{ @@ -301,9 +306,11 @@ Cell[BoxData[{ 3.9167584720251627`*^9, 3.916758473473184*^9}, {3.916763078664383*^9, 3.916763079312771*^9}, {3.916850486059314*^9, 3.916850517153616*^9}, { 3.9173801291544447`*^9, 3.917380133892503*^9}, {3.9173803308316917`*^9, - 3.9173803309348583`*^9}, {3.917474542527548*^9, 3.917474545068673*^9}}, + 3.9173803309348583`*^9}, {3.917474542527548*^9, 3.917474545068673*^9}, { + 3.918572821536396*^9, 3.918572823603607*^9}, {3.9185729104081907`*^9, + 3.918572928566394*^9}, {3.918572999585181*^9, 3.9185730234312067`*^9}}, CellLabel-> - "In[823]:=",ExpressionUUID->"fabf4afc-21e6-47a6-b63d-ba788b915987"], + "In[1104]:=",ExpressionUUID->"fabf4afc-21e6-47a6-b63d-ba788b915987"], Cell[CellGroupData[{ @@ -311,18 +318,18 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"The initial X-reserve balance is: \ \\!\\(\\*SubscriptBox[\\(x\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "1"}]], "Echo", + "EchoLabel"], " ", "1000000000"}]], "Echo", CellChangeTimes->{ - 3.917474545509263*^9},ExpressionUUID->"01616c47-d47f-4163-ae7f-\ -1486a28100e4"], + 3.918573028754086*^9},ExpressionUUID->"1d278e94-c651-4137-83e9-\ +d2326c525bcd"], Cell[BoxData[ RowBox[{ TagBox["\<\"\\!\\(\\*SubscriptBox[\\(S\\), \\(0\\)]\\) = \"\>", "EchoLabel"], " ", "1"}]], "Echo", CellChangeTimes->{ - 3.917474545542253*^9},ExpressionUUID->"fc434cef-4acc-4e55-bde9-\ -391e8b23b2d8"] + 3.918573028786948*^9},ExpressionUUID->"53c2e4f4-bee6-4c1d-83f6-\ +d3ecd21f40b1"] }, Open ]] }, Open ]], @@ -377,7 +384,7 @@ Cell[BoxData[{ CellChangeTimes->{{3.911912822320621*^9, 3.911912827848645*^9}, { 3.911912883452937*^9, 3.9119128835495768`*^9}}, CellLabel-> - "In[825]:=",ExpressionUUID->"ee083f7c-4161-4e24-8675-42d8b5ffacbe"], + "In[1106]:=",ExpressionUUID->"ee083f7c-4161-4e24-8675-42d8b5ffacbe"], Cell[CellGroupData[{ @@ -385,19 +392,19 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"The initial liquidity is: \\!\\(\\*SubscriptBox[\\(L\\), \ \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "1.`18."}]], "Echo", + "EchoLabel"], " ", "2.279507056954777641993563252`18.*^9"}]], "Echo", CellChangeTimes->{ - 3.917474548436577*^9},ExpressionUUID->"47b0b03a-8b5e-49c0-ab03-\ -4782db75c308"], + 3.918573030178784*^9},ExpressionUUID->"6b61905f-d1d8-44b7-9fd3-\ +6efde1eb1d66"], Cell[BoxData[ RowBox[{ TagBox["\<\"The initial Y-reserve balance is: \ \\!\\(\\*SubscriptBox[\\(y\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "1.`18."}]], "Echo", + "EchoLabel"], " ", "3.`18.*^9"}]], "Echo", CellChangeTimes->{ - 3.9174745484663353`*^9},ExpressionUUID->"dc83f75a-8600-43f2-b1e3-\ -eba4431e2b04"] + 3.918573030212949*^9},ExpressionUUID->"60c82180-6ac4-4f59-bd05-\ +b87827fc82ed"] }, Open ]] }, Open ]] }, Open ]], @@ -432,15 +439,15 @@ Cell[BoxData[{ "\"\\""}], "]"}], ";"}]}], "Code", CellChangeTimes->{{3.911912932500325*^9, 3.911912980651959*^9}}, CellLabel-> - "In[827]:=",ExpressionUUID->"9b2bc5ef-d095-45dd-ac2b-15f02684ac4f"], + "In[1108]:=",ExpressionUUID->"9b2bc5ef-d095-45dd-ac2b-15f02684ac4f"], Cell[BoxData[ RowBox[{ TagBox["\<\"The initial price is: P = \"\>", "EchoLabel"], " ", "1"}]], "Echo", CellChangeTimes->{ - 3.917474552187778*^9},ExpressionUUID->"4a6673d1-2530-4a7d-9666-\ -b22656868b6c"] + 3.918573031739126*^9},ExpressionUUID->"8da8050f-0e99-4100-bd4f-\ +9431d231aafe"] }, Open ]] }, Open ]], @@ -492,7 +499,7 @@ Cell[BoxData[{ CellChangeTimes->{{3.911913388555017*^9, 3.911913437262168*^9}, 3.9119134968996763`*^9}, CellLabel-> - "In[829]:=",ExpressionUUID->"5ace6d65-c46d-491e-a7b3-d364ee7f21fb"] + "In[1110]:=",ExpressionUUID->"5ace6d65-c46d-491e-a7b3-d364ee7f21fb"] }, Open ]] }, Open ]] }, Open ]], @@ -513,21 +520,31 @@ Cell["Now we need to set up the swap logic.", "Subsection", Cell[BoxData[{ RowBox[{ - RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", + RowBox[{"fees", "[", RowBox[{"\[CapitalDelta]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "\[Gamma]"}], ")"}], "\[CapitalDelta]"}]}], "\n", RowBox[{ RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"\[CapitalDelta]_", ",", "R_", ",", "L_", ",", "\[Gamma]_"}], + SubscriptBox["\[Delta]", "LiqX"], "[", + RowBox[{ + "\[CapitalDelta]_", ",", "R_", ",", "L_", ",", "w_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", + RowBox[{"w", " ", + RowBox[{"fees", "[", + RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}], + FractionBox["L", "R"]}]}], "\n", + RowBox[{ RowBox[{ - FractionBox["1", "2"], + SubscriptBox["\[Delta]", "LiqY"], "[", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", + "\[CapitalDelta]_", ",", "R_", ",", "L_", ",", "w_", ",", "\[Gamma]_"}], + "]"}], " ", ":=", " ", + RowBox[{ + RowBox[{"(", + RowBox[{"1", "-", "w"}], ")"}], " ", + RowBox[{"fees", "[", RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}], FractionBox["L", "R"]}]}], "\n", RowBox[{ @@ -542,8 +559,9 @@ Cell[BoxData[{ FractionBox[ RowBox[{"L", "+", RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"\[CapitalDelta]", ",", "y", ",", "L", ",", "\[Gamma]"}], + SubscriptBox["\[Delta]", "LiqY"], "[", + RowBox[{ + "\[CapitalDelta]", ",", "y", ",", "L", ",", "w", ",", "\[Gamma]"}], "]"}]}], SuperscriptBox[ RowBox[{"(", @@ -562,8 +580,9 @@ Cell[BoxData[{ FractionBox[ RowBox[{"L", "+", RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"\[CapitalDelta]", ",", "x", ",", "L", ",", "\[Gamma]"}], + SubscriptBox["\[Delta]", "LiqX"], "[", + RowBox[{ + "\[CapitalDelta]", ",", "x", ",", "L", ",", "w", ",", "\[Gamma]"}], "]"}]}], SuperscriptBox[ RowBox[{"(", @@ -581,115 +600,152 @@ Cell[BoxData[{ 3.916750092177647*^9, 3.916750092710829*^9}, {3.917375550285816*^9, 3.917375553361146*^9}, {3.917375646968779*^9, 3.917375651113062*^9}, { 3.9173757221234703`*^9, 3.9173758146366262`*^9}, {3.917380235352436*^9, - 3.917380256042615*^9}, {3.917380371447682*^9, 3.917380373267902*^9}}, + 3.917380256042615*^9}, {3.917380371447682*^9, 3.917380373267902*^9}, { + 3.918572231405321*^9, 3.918572284540254*^9}, {3.918572681943273*^9, + 3.91857268496103*^9}, {3.918575228425824*^9, 3.918575248534638*^9}, { + 3.9185752845411987`*^9, 3.9185752961950283`*^9}, 3.918575371410864*^9, { + 3.918575477141179*^9, 3.918575510485251*^9}}, CellLabel-> - "In[831]:=",ExpressionUUID->"6c9eba4a-50a0-4c93-b07c-3139817809de"], + "In[1163]:=",ExpressionUUID->"6c9eba4a-50a0-4c93-b07c-3139817809de"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ - SubscriptBox["\[CapitalDelta]", "X"], "[", - RowBox[{"0.1", ",", - SubscriptBox["x", "0"], ",", - SubscriptBox["y", "0"], ",", - SubscriptBox["L", "0"], ",", - SubscriptBox["w", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}], "\n", + RowBox[{"YIn", " ", "=", " ", "1"}], ";"}], "\n", RowBox[{ - RowBox[{"\[CurlyPhi]", "[", + RowBox[{"Echo", "[", RowBox[{ - RowBox[{ - SubscriptBox["x", "0"], "+", + RowBox[{"N", "[", RowBox[{ SubscriptBox["\[CapitalDelta]", "X"], "[", - RowBox[{"0.1", ",", + RowBox[{"YIn", ",", SubscriptBox["x", "0"], ",", SubscriptBox["y", "0"], ",", SubscriptBox["L", "0"], ",", SubscriptBox["w", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", - RowBox[{ - SubscriptBox["y", "0"], "+", "0.1"}], ",", - RowBox[{ - SubscriptBox["L", "0"], "+", - RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"0.1", ",", - SubscriptBox["y", "0"], ",", - SubscriptBox["L", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", - SubscriptBox["w", "0"]}], "]"}], "\n"}], "\n", + SubscriptBox["\[Gamma]", "0"]}], "]"}], "]"}], ",", " ", + "\"\<\!\(\*SubscriptBox[\(\[CapitalDelta]\), \(X\)]\) = \>\""}], "]"}], + ";"}], "\n", RowBox[{ - SubscriptBox["\[CapitalDelta]", "Y"], "[", - RowBox[{"0.1", ",", - SubscriptBox["x", "0"], ",", - SubscriptBox["y", "0"], ",", - SubscriptBox["L", "0"], ",", - SubscriptBox["w", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}], "\n", - RowBox[{"\[CurlyPhi]", "[", RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + RowBox[{"\[CurlyPhi]", "[", + RowBox[{ + RowBox[{ + SubscriptBox["x", "0"], "+", + RowBox[{ + SubscriptBox["\[CapitalDelta]", "X"], "[", + RowBox[{"YIn", ",", + SubscriptBox["x", "0"], ",", + SubscriptBox["y", "0"], ",", + SubscriptBox["L", "0"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", + RowBox[{ + SubscriptBox["y", "0"], "+", "YIn"}], ",", + RowBox[{ + SubscriptBox["L", "0"], "+", + RowBox[{ + SubscriptBox["\[Delta]", "LiqY"], "[", + RowBox[{"YIn", ",", + SubscriptBox["y", "0"], ",", + SubscriptBox["L", "0"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", + SubscriptBox["w", "0"]}], "]"}], ",", " ", "\"\\""}], + "]"}], ";"}], "\n"}], "\n", + RowBox[{ + RowBox[{"XIn", " ", "=", " ", "1"}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", RowBox[{ - SubscriptBox["x", "0"], "+", "0.1"}], ",", - RowBox[{ - SubscriptBox["y", "0"], "+", RowBox[{ SubscriptBox["\[CapitalDelta]", "Y"], "[", - RowBox[{"0.1", ",", + RowBox[{"XIn", ",", SubscriptBox["x", "0"], ",", SubscriptBox["y", "0"], ",", SubscriptBox["L", "0"], ",", SubscriptBox["w", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", + SubscriptBox["\[Gamma]", "0"]}], "]"}], ",", " ", + "\"\<\!\(\*SubscriptBox[\(\[CapitalDelta]\), \(Y\)]\) = \>\""}], "]"}], + ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", RowBox[{ - SubscriptBox["L", "0"], "+", - RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"0.1", ",", - SubscriptBox["x", "0"], ",", - SubscriptBox["L", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", - SubscriptBox["w", "0"]}], "]"}]}], "Code", + RowBox[{"\[CurlyPhi]", "[", + RowBox[{ + RowBox[{ + SubscriptBox["x", "0"], "+", "XIn"}], ",", + RowBox[{ + SubscriptBox["y", "0"], "+", + RowBox[{ + SubscriptBox["\[CapitalDelta]", "Y"], "[", + RowBox[{"XIn", ",", + SubscriptBox["x", "0"], ",", + SubscriptBox["y", "0"], ",", + SubscriptBox["L", "0"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", + RowBox[{ + SubscriptBox["L", "0"], "+", + RowBox[{ + SubscriptBox["\[Delta]", "LiqX"], "[", + RowBox[{"XIn", ",", + SubscriptBox["x", "0"], ",", + SubscriptBox["L", "0"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ",", + SubscriptBox["w", "0"]}], "]"}], ",", " ", "\"\\""}], + "]"}], ";"}]}], "Code", CellChangeTimes->{{3.9173801538368683`*^9, 3.917380182502496*^9}, { 3.917380406138091*^9, 3.917380427451881*^9}, {3.917382817211936*^9, - 3.917382944892488*^9}, {3.917474578659257*^9, 3.917474580665434*^9}}, + 3.917382944892488*^9}, {3.917474578659257*^9, 3.917474580665434*^9}, { + 3.918572295967634*^9, 3.918572371350017*^9}, {3.9185727421179123`*^9, + 3.918572807871854*^9}, {3.918572860607503*^9, 3.918572860836522*^9}, { + 3.91857320247493*^9, 3.9185732282521553`*^9}, {3.918575432420752*^9, + 3.918575435715103*^9}}, CellLabel-> - "In[835]:=",ExpressionUUID->"57d57c6e-b361-4057-8fe3-86b50c9464e4"], + "In[1168]:=",ExpressionUUID->"57d57c6e-b361-4057-8fe3-86b50c9464e4"], + +Cell[CellGroupData[{ Cell[BoxData[ - RowBox[{"-", "0.09090909090909105`"}]], "Output", + RowBox[{ + TagBox["\<\"\\!\\(\\*SubscriptBox[\\(\[CapitalDelta]\\), \\(X\\)]\\) = \"\>", + "EchoLabel"], " ", + RowBox[{"-", "0.9949992895126343`"}]}]], "Echo", CellChangeTimes->{ - 3.917380183658939*^9, 3.917380259953665*^9, 3.917380340546103*^9, { - 3.917380375623798*^9, 3.917380379003302*^9}, 3.9173804285014133`*^9, { - 3.9173829183952293`*^9, 3.917382946517559*^9}, 3.917474557013838*^9}, - CellLabel-> - "Out[835]=",ExpressionUUID->"705276af-d995-4ce0-b354-84831b308d2d"], + 3.9185755125952473`*^9},ExpressionUUID->"075b0db1-54f8-4fe5-824d-\ +678cfdca59bb"], -Cell[BoxData["0.`"], "Output", +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Validation = \"\>", + "EchoLabel"], " ", "0.`"}]], "Echo", CellChangeTimes->{ - 3.917380183658939*^9, 3.917380259953665*^9, 3.917380340546103*^9, { - 3.917380375623798*^9, 3.917380379003302*^9}, 3.9173804285014133`*^9, { - 3.9173829183952293`*^9, 3.917382946517559*^9}, 3.917474557016643*^9}, - CellLabel-> - "Out[836]=",ExpressionUUID->"2110b4c3-3d24-4487-ab7a-315bad605229"], + 3.918575512631504*^9},ExpressionUUID->"c63ebd0b-561e-4e36-95c8-\ +952ff058d8ac"], Cell[BoxData[ - RowBox[{"-", "0.09090909090909105`"}]], "Output", + RowBox[{ + TagBox["\<\"\\!\\(\\*SubscriptBox[\\(\[CapitalDelta]\\), \\(Y\\)]\\) = \"\>", + "EchoLabel"], " ", + RowBox[{"-", "0.9950032234191895`"}]}]], "Echo", CellChangeTimes->{ - 3.917380183658939*^9, 3.917380259953665*^9, 3.917380340546103*^9, { - 3.917380375623798*^9, 3.917380379003302*^9}, 3.9173804285014133`*^9, { - 3.9173829183952293`*^9, 3.917382946517559*^9}, 3.91747455701805*^9}, - CellLabel-> - "Out[837]=",ExpressionUUID->"da9c9147-ed0c-4928-9879-cb5907e8605b"], + 3.918575512639958*^9},ExpressionUUID->"542a0d11-9ce8-4cd4-8e8a-\ +80ba04570b3b"], -Cell[BoxData["0.`"], "Output", +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Validation = \"\>", + "EchoLabel"], " ", + RowBox[{"-", "8.881784197001252`*^-16"}]}]], "Echo", CellChangeTimes->{ - 3.917380183658939*^9, 3.917380259953665*^9, 3.917380340546103*^9, { - 3.917380375623798*^9, 3.917380379003302*^9}, 3.9173804285014133`*^9, { - 3.9173829183952293`*^9, 3.917382946517559*^9}, 3.917474557019392*^9}, - CellLabel-> - "Out[838]=",ExpressionUUID->"318c935c-af9d-45ae-996b-68e575a47d69"] + 3.9185755126641893`*^9},ExpressionUUID->"9a8696eb-4c30-4aa5-a12f-\ +0cb440faf8c1"] +}, Open ]] }, Open ]] }, Open ]] }, Open ]], @@ -2167,8 +2223,8 @@ Cell[BoxData[ }, Open ]] }, Open ]] }, -WindowSize->{992, 1233}, -WindowMargins->{{Automatic, 12}, {-819, Automatic}}, +WindowSize->{1651, 2083}, +WindowMargins->{{Automatic, 1674}, {Automatic, -819}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, FrontEndVersion->"13.2 for Mac OS X ARM (64-bit) (January 31, 2023)", @@ -2188,7 +2244,7 @@ CellTagsIndex->{} (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ -Cell[583, 22, 189, 3, 238, "Title",ExpressionUUID->"464b00f2-edbc-4299-9ebc-bbbbadc48e36"], +Cell[583, 22, 189, 3, 146, "Title",ExpressionUUID->"464b00f2-edbc-4299-9ebc-bbbbadc48e36"], Cell[CellGroupData[{ Cell[797, 29, 177, 3, 101, "Section",ExpressionUUID->"7647c4f8-4fe4-4b60-9236-0948b016bc8d"], Cell[977, 34, 531, 13, 54, "Code",ExpressionUUID->"90a85ca4-15ef-43a6-a1c9-9ded2b5b4873"], @@ -2200,119 +2256,121 @@ Cell[1995, 65, 644, 20, 50, "Text",ExpressionUUID->"9a6a4459-0d52-4b73-811d-1f5b Cell[2642, 87, 1453, 43, 230, "Code",ExpressionUUID->"7253b091-e52f-418b-a1c8-287d88022e6a"] }, Open ]], Cell[CellGroupData[{ -Cell[4132, 135, 558, 16, 107, "Subsubsection",ExpressionUUID->"c79752c3-b802-42fd-9612-2c9ed31365e8"], +Cell[4132, 135, 558, 16, 68, "Subsubsection",ExpressionUUID->"c79752c3-b802-42fd-9612-2c9ed31365e8"], Cell[4693, 153, 399, 11, 68, "Code",ExpressionUUID->"18a899a0-963a-45c4-a7a0-9fbeda760047"] }, Open ]], Cell[CellGroupData[{ Cell[5129, 169, 182, 2, 67, "Subsubsection",ExpressionUUID->"ccc19f67-4212-4173-8f38-591d9c869a78"], -Cell[5314, 173, 404, 11, 54, "Code",ExpressionUUID->"25e959b2-4561-4b40-a658-c7cf56341acc"] +Cell[5314, 173, 555, 16, 68, "Code",ExpressionUUID->"25e959b2-4561-4b40-a658-c7cf56341acc"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[5779, 191, 237, 6, 158, "Section",ExpressionUUID->"8ecbbf5d-d7c2-4753-8dae-ccd81d3ed5db"], +Cell[5930, 196, 237, 6, 101, "Section",ExpressionUUID->"8ecbbf5d-d7c2-4753-8dae-ccd81d3ed5db"], Cell[CellGroupData[{ -Cell[6041, 201, 257, 6, 122, "Subsection",ExpressionUUID->"3778290c-33c8-4669-bd57-a54efc82c76a"], +Cell[6192, 206, 257, 6, 81, "Subsection",ExpressionUUID->"3778290c-33c8-4669-bd57-a54efc82c76a"], Cell[CellGroupData[{ -Cell[6323, 211, 1232, 31, 136, "Code",ExpressionUUID->"a277fd9d-36f8-4eee-9601-665001bbe972"], +Cell[6474, 216, 1332, 32, 136, "Code",ExpressionUUID->"a277fd9d-36f8-4eee-9601-665001bbe972"], Cell[CellGroupData[{ -Cell[7580, 246, 251, 7, 53, "Echo",ExpressionUUID->"e292a780-3309-44c3-be1d-26b2a20e24a3"], -Cell[7834, 255, 237, 6, 38, "Echo",ExpressionUUID->"b4ef115e-13e6-465e-afa5-f607b00b73a0"] +Cell[7831, 252, 248, 6, 53, "Echo",ExpressionUUID->"cba24bcd-4248-4768-9ccc-38294fdb5805"], +Cell[8082, 260, 242, 6, 38, "Echo",ExpressionUUID->"9e0f3cc3-161b-4f64-8955-315bd5479577"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[8132, 268, 254, 6, 122, "Subsection",ExpressionUUID->"0e4b0b5f-de16-4a42-af35-cb7f8c5a845c"], +Cell[8385, 273, 254, 6, 81, "Subsection",ExpressionUUID->"0e4b0b5f-de16-4a42-af35-cb7f8c5a845c"], Cell[CellGroupData[{ -Cell[8411, 278, 1047, 27, 86, "Code",ExpressionUUID->"fabf4afc-21e6-47a6-b63d-ba788b915987"], +Cell[8664, 283, 1205, 29, 86, "Code",ExpressionUUID->"fabf4afc-21e6-47a6-b63d-ba788b915987"], Cell[CellGroupData[{ -Cell[9483, 309, 266, 7, 38, "Echo",ExpressionUUID->"01616c47-d47f-4163-ae7f-1486a28100e4"], -Cell[9752, 318, 230, 6, 38, "Echo",ExpressionUUID->"fc434cef-4acc-4e55-bde9-391e8b23b2d8"] +Cell[9894, 316, 275, 7, 38, "Echo",ExpressionUUID->"1d278e94-c651-4137-83e9-d2326c525bcd"], +Cell[10172, 325, 230, 6, 38, "Echo",ExpressionUUID->"53c2e4f4-bee6-4c1d-83f6-d3ecd21f40b1"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[10031, 330, 250, 6, 67, "Subsubsection",ExpressionUUID->"d14796ee-6661-403b-a067-2e1c5a6c6211"], +Cell[10451, 337, 250, 6, 67, "Subsubsection",ExpressionUUID->"d14796ee-6661-403b-a067-2e1c5a6c6211"], Cell[CellGroupData[{ -Cell[10306, 340, 1297, 39, 86, "Code",ExpressionUUID->"ee083f7c-4161-4e24-8675-42d8b5ffacbe"], +Cell[10726, 347, 1298, 39, 86, "Code",ExpressionUUID->"ee083f7c-4161-4e24-8675-42d8b5ffacbe"], Cell[CellGroupData[{ -Cell[11628, 383, 263, 7, 38, "Echo",ExpressionUUID->"47b0b03a-8b5e-49c0-ab03-4782db75c308"], -Cell[11894, 392, 273, 7, 38, "Echo",ExpressionUUID->"dc83f75a-8600-43f2-b1e3-eba4431e2b04"] +Cell[12049, 390, 293, 7, 38, "Echo",ExpressionUUID->"6b61905f-d1d8-44b7-9fd3-6efde1eb1d66"], +Cell[12345, 399, 274, 7, 38, "Echo",ExpressionUUID->"60c82180-6ac4-4f59-bd05-b87827fc82ed"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[12228, 406, 225, 4, 67, "Subsubsection",ExpressionUUID->"0a95fd1e-5759-46f5-b752-6b4f74d4268c"], +Cell[12680, 413, 225, 4, 67, "Subsubsection",ExpressionUUID->"0a95fd1e-5759-46f5-b752-6b4f74d4268c"], Cell[CellGroupData[{ -Cell[12478, 414, 675, 20, 86, "Code",ExpressionUUID->"9b2bc5ef-d095-45dd-ac2b-15f02684ac4f"], -Cell[13156, 436, 211, 6, 38, "Echo",ExpressionUUID->"4a6673d1-2530-4a7d-9666-b22656868b6c"] +Cell[12930, 421, 676, 20, 86, "Code",ExpressionUUID->"9b2bc5ef-d095-45dd-ac2b-15f02684ac4f"], +Cell[13609, 443, 211, 6, 38, "Echo",ExpressionUUID->"8da8050f-0e99-4100-bd4f-9431d231aafe"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[13416, 448, 280, 6, 106, "Subsubsection",ExpressionUUID->"f59add3e-9736-413f-b760-d953f4b2de71"], -Cell[13699, 456, 1145, 38, 98, "Code",ExpressionUUID->"5ace6d65-c46d-491e-a7b3-d364ee7f21fb"] +Cell[13869, 455, 280, 6, 67, "Subsubsection",ExpressionUUID->"f59add3e-9736-413f-b760-d953f4b2de71"], +Cell[14152, 463, 1146, 38, 98, "Code",ExpressionUUID->"5ace6d65-c46d-491e-a7b3-d364ee7f21fb"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[14905, 501, 153, 3, 101, "Section",ExpressionUUID->"0aa1aa4a-a222-4348-9a33-bdcf246c0ec1"], +Cell[15359, 508, 153, 3, 101, "Section",ExpressionUUID->"0aa1aa4a-a222-4348-9a33-bdcf246c0ec1"], +Cell[CellGroupData[{ +Cell[15537, 515, 208, 3, 81, "Subsection",ExpressionUUID->"a09de9d8-3ec0-4d13-8819-089fc369fa6e"], +Cell[15748, 520, 3455, 88, 294, "Code",ExpressionUUID->"6c9eba4a-50a0-4c93-b07c-3139817809de"], Cell[CellGroupData[{ -Cell[15083, 508, 208, 3, 81, "Subsection",ExpressionUUID->"a09de9d8-3ec0-4d13-8819-089fc369fa6e"], -Cell[15294, 513, 2831, 72, 242, "Code",ExpressionUUID->"6c9eba4a-50a0-4c93-b07c-3139817809de"], +Cell[19228, 612, 3506, 97, 245, "Code",ExpressionUUID->"57d57c6e-b361-4057-8fe3-86b50c9464e4"], Cell[CellGroupData[{ -Cell[18150, 589, 2337, 68, 183, "Code",ExpressionUUID->"57d57c6e-b361-4057-8fe3-86b50c9464e4"], -Cell[20490, 659, 384, 7, 40, "Output",ExpressionUUID->"705276af-d995-4ce0-b354-84831b308d2d"], -Cell[20877, 668, 350, 6, 40, "Output",ExpressionUUID->"2110b4c3-3d24-4487-ab7a-315bad605229"], -Cell[21230, 676, 383, 7, 40, "Output",ExpressionUUID->"da9c9147-ed0c-4928-9879-cb5907e8605b"], -Cell[21616, 685, 350, 6, 40, "Output",ExpressionUUID->"318c935c-af9d-45ae-996b-68e575a47d69"] +Cell[22759, 713, 282, 7, 38, "Echo",ExpressionUUID->"075b0db1-54f8-4fe5-824d-678cfdca59bb"], +Cell[23044, 722, 200, 6, 38, "Echo",ExpressionUUID->"c63ebd0b-561e-4e36-95c8-952ff058d8ac"], +Cell[23247, 730, 280, 7, 38, "Echo",ExpressionUUID->"542a0d11-9ce8-4cd4-8e8a-80ba04570b3b"], +Cell[23530, 739, 240, 7, 38, "Echo",ExpressionUUID->"9a8696eb-4c30-4aa5-a12f-0cb440faf8c1"] +}, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[22027, 698, 156, 3, 101, "Section",ExpressionUUID->"2af33c95-75fa-4c2a-987e-0c0efa8a1771"], -Cell[22186, 703, 515, 12, 111, "Text",ExpressionUUID->"72430652-d39e-479e-8fb5-8c2568d7c943"], +Cell[23843, 754, 156, 3, 101, "Section",ExpressionUUID->"2af33c95-75fa-4c2a-987e-0c0efa8a1771"], +Cell[24002, 759, 515, 12, 81, "Text",ExpressionUUID->"72430652-d39e-479e-8fb5-8c2568d7c943"], Cell[CellGroupData[{ -Cell[22726, 719, 537, 14, 108, "Subsubsection",ExpressionUUID->"a8656622-88c3-4ada-82e5-d33556722b56"], -Cell[23266, 735, 517, 17, 107, "Code",ExpressionUUID->"8864b3f3-1b36-4dcd-99b8-7a357f5a3a30"] +Cell[24542, 775, 537, 14, 68, "Subsubsection",ExpressionUUID->"a8656622-88c3-4ada-82e5-d33556722b56"], +Cell[25082, 791, 517, 17, 107, "Code",ExpressionUUID->"8864b3f3-1b36-4dcd-99b8-7a357f5a3a30"] }, Open ]], Cell[CellGroupData[{ -Cell[23820, 757, 171, 3, 81, "Subsection",ExpressionUUID->"f9739415-ba82-4653-b842-33b37c1cd286"], +Cell[25636, 813, 171, 3, 81, "Subsection",ExpressionUUID->"f9739415-ba82-4653-b842-33b37c1cd286"], Cell[CellGroupData[{ -Cell[24016, 764, 400, 11, 107, "Subsubsection",ExpressionUUID->"905228e2-efe5-43aa-9780-0b193149ea3d"], +Cell[25832, 820, 400, 11, 68, "Subsubsection",ExpressionUUID->"905228e2-efe5-43aa-9780-0b193149ea3d"], Cell[CellGroupData[{ -Cell[24441, 779, 12280, 363, 721, "Code",ExpressionUUID->"1a8d1d1f-d7f4-4461-a836-4d4571ea6392"], -Cell[36724, 1144, 7205, 138, 337, "Output",ExpressionUUID->"986f7163-cf03-4de4-b998-9538f3a4c8bc"], +Cell[26257, 835, 12280, 363, 721, "Code",ExpressionUUID->"1a8d1d1f-d7f4-4461-a836-4d4571ea6392"], +Cell[38540, 1200, 7205, 138, 337, "Output",ExpressionUUID->"986f7163-cf03-4de4-b998-9538f3a4c8bc"], Cell[CellGroupData[{ -Cell[43954, 1286, 300, 6, 38, "Echo",ExpressionUUID->"6394a97c-351e-437d-8c02-9b0642aacf09"], -Cell[44257, 1294, 302, 8, 38, "Echo",ExpressionUUID->"5e6b589a-5de5-4f17-9268-a35f46b410b1"], -Cell[44562, 1304, 392, 10, 38, "Echo",ExpressionUUID->"957d146b-e63f-416f-a7cb-8c6b69727396"], -Cell[44957, 1316, 279, 7, 38, "Echo",ExpressionUUID->"a6375d85-fb17-4296-9761-db2b17a953c6"], -Cell[45239, 1325, 236, 5, 38, "Echo",ExpressionUUID->"ea158521-8811-4328-bda0-60677eb48800"], -Cell[45478, 1332, 3029, 98, 201, "Echo",ExpressionUUID->"4c5f61bd-03b7-4432-a272-0f26503b2dfb"] +Cell[45770, 1342, 300, 6, 38, "Echo",ExpressionUUID->"6394a97c-351e-437d-8c02-9b0642aacf09"], +Cell[46073, 1350, 302, 8, 38, "Echo",ExpressionUUID->"5e6b589a-5de5-4f17-9268-a35f46b410b1"], +Cell[46378, 1360, 392, 10, 38, "Echo",ExpressionUUID->"957d146b-e63f-416f-a7cb-8c6b69727396"], +Cell[46773, 1372, 279, 7, 38, "Echo",ExpressionUUID->"a6375d85-fb17-4296-9761-db2b17a953c6"], +Cell[47055, 1381, 236, 5, 38, "Echo",ExpressionUUID->"ea158521-8811-4328-bda0-60677eb48800"], +Cell[47294, 1388, 3029, 98, 178, "Echo",ExpressionUUID->"4c5f61bd-03b7-4432-a272-0f26503b2dfb"] }, Open ]], -Cell[48522, 1433, 384, 7, 40, "Output",ExpressionUUID->"a1f818a7-7515-42f6-8412-5023424e7584"], -Cell[48909, 1442, 364, 6, 40, "Output",ExpressionUUID->"53eae298-6178-4ff5-afd7-6d8d8a6d15d1"], -Cell[49276, 1450, 363, 6, 40, "Output",ExpressionUUID->"8a5a30f2-553b-4cde-86b0-6f924840169e"] +Cell[50338, 1489, 384, 7, 40, "Output",ExpressionUUID->"a1f818a7-7515-42f6-8412-5023424e7584"], +Cell[50725, 1498, 364, 6, 40, "Output",ExpressionUUID->"53eae298-6178-4ff5-afd7-6d8d8a6d15d1"], +Cell[51092, 1506, 363, 6, 40, "Output",ExpressionUUID->"8a5a30f2-553b-4cde-86b0-6f924840169e"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[49700, 1463, 171, 3, 81, "Subsection",ExpressionUUID->"f642d822-e56a-4daf-87b3-4a7c12588060"], +Cell[51516, 1519, 171, 3, 81, "Subsection",ExpressionUUID->"f642d822-e56a-4daf-87b3-4a7c12588060"], Cell[CellGroupData[{ -Cell[49896, 1470, 377, 10, 68, "Subsubsection",ExpressionUUID->"53a95604-bde4-406e-8c5f-f440053636d6"], +Cell[51712, 1526, 377, 10, 68, "Subsubsection",ExpressionUUID->"53a95604-bde4-406e-8c5f-f440053636d6"], Cell[CellGroupData[{ -Cell[50298, 1484, 13806, 417, 879, "Code",ExpressionUUID->"7a15b2a1-0c7b-4080-9632-dc9021620919"], -Cell[64107, 1903, 7344, 140, 330, "Output",ExpressionUUID->"f6e93834-5111-4db5-8c3e-43dda9b8a147"], +Cell[52114, 1540, 13806, 417, 879, "Code",ExpressionUUID->"7a15b2a1-0c7b-4080-9632-dc9021620919"], +Cell[65923, 1959, 7344, 140, 330, "Output",ExpressionUUID->"f6e93834-5111-4db5-8c3e-43dda9b8a147"], Cell[CellGroupData[{ -Cell[71476, 2047, 304, 7, 38, "Echo",ExpressionUUID->"8ac1734a-e0db-4cdb-81dc-2aa139ec630e"], -Cell[71783, 2056, 304, 8, 38, "Echo",ExpressionUUID->"cef205b4-24c5-4b42-84f6-3911caee3c22"], -Cell[72090, 2066, 394, 10, 38, "Echo",ExpressionUUID->"7b57ec96-1204-4b48-b343-3a8cb80fbd77"], -Cell[72487, 2078, 279, 7, 38, "Echo",ExpressionUUID->"9c3d0530-4afa-4a50-a712-9da4101925ad"], -Cell[72769, 2087, 241, 6, 38, "Echo",ExpressionUUID->"40d8d1a6-b0d6-46a6-b818-6eaf5ee08fcd"], -Cell[73013, 2095, 1291, 43, 86, "Echo",ExpressionUUID->"ed0c361d-6c42-46c2-a90d-f49fa0612c9c"] +Cell[73292, 2103, 304, 7, 38, "Echo",ExpressionUUID->"8ac1734a-e0db-4cdb-81dc-2aa139ec630e"], +Cell[73599, 2112, 304, 8, 38, "Echo",ExpressionUUID->"cef205b4-24c5-4b42-84f6-3911caee3c22"], +Cell[73906, 2122, 394, 10, 38, "Echo",ExpressionUUID->"7b57ec96-1204-4b48-b343-3a8cb80fbd77"], +Cell[74303, 2134, 279, 7, 38, "Echo",ExpressionUUID->"9c3d0530-4afa-4a50-a712-9da4101925ad"], +Cell[74585, 2143, 241, 6, 38, "Echo",ExpressionUUID->"40d8d1a6-b0d6-46a6-b818-6eaf5ee08fcd"], +Cell[74829, 2151, 1291, 43, 86, "Echo",ExpressionUUID->"ed0c361d-6c42-46c2-a90d-f49fa0612c9c"] }, Open ]], -Cell[74319, 2141, 292, 6, 40, "Output",ExpressionUUID->"7cf2cd9d-1ff3-448c-8907-80dcc7585b4c"], -Cell[74614, 2149, 276, 5, 40, "Output",ExpressionUUID->"a16d71b5-1eb7-4c52-831c-1c470734a16a"], -Cell[74893, 2156, 289, 6, 40, "Output",ExpressionUUID->"ae67615f-9200-4a1b-b127-1e6135b099df"] +Cell[76135, 2197, 292, 6, 40, "Output",ExpressionUUID->"7cf2cd9d-1ff3-448c-8907-80dcc7585b4c"], +Cell[76430, 2205, 276, 5, 40, "Output",ExpressionUUID->"a16d71b5-1eb7-4c52-831c-1c470734a16a"], +Cell[76709, 2212, 289, 6, 40, "Output",ExpressionUUID->"ae67615f-9200-4a1b-b127-1e6135b099df"] }, Open ]] }, Open ]] }, Open ]] diff --git a/src/GeometricMean/n_token_geometric_mean.nb b/src/GeometricMean/n_token_geometric_mean.nb new file mode 100644 index 00000000..473aabf7 --- /dev/null +++ b/src/GeometricMean/n_token_geometric_mean.nb @@ -0,0 +1,406 @@ +(* Content-type: application/vnd.wolfram.mathematica *) + +(*** Wolfram Notebook File ***) +(* http://www.wolfram.com/nb *) + +(* CreatedBy='WolframDesktop 13.2' *) + +(*CacheID: 234*) +(* Internal cache information: +NotebookFileLineBreakTest +NotebookFileLineBreakTest +NotebookDataPosition[ 161, 7] +NotebookDataLength[ 13161, 396] +NotebookOptionsPosition[ 11523, 360] +NotebookOutlinePosition[ 12026, 377] +CellTagsIndexPosition[ 11983, 374] +WindowFrame->Normal*) + +(* Beginning of Notebook Content *) +Notebook[{ + +Cell[CellGroupData[{ +Cell["n-Token Geometric Mean Trading Function", "Title", + CellChangeTimes->{{3.918751578310741*^9, + 3.9187516237186537`*^9}},ExpressionUUID->"b9153d6d-addd-49dc-914c-\ +671e23f8f6c5"], + +Cell[BoxData[ + RowBox[{ + RowBox[{"On", "[", "Assert", "]"}], ";"}]], "Code", + CellLabel-> + "In[4437]:=",ExpressionUUID->"abb15b31-0a39-46c6-bf1d-00038da522b3"], + +Cell[BoxData[{ + RowBox[{ + RowBox[{ + RowBox[{"{", + RowBox[{ + SubscriptBox["w", "0"], ",", + SubscriptBox["w", "1"], ",", + SubscriptBox["w", "2"], ",", + SubscriptBox["\[Gamma]", "i"]}], "}"}], " ", "=", " ", + RowBox[{"{", + RowBox[{ + FractionBox["1", "4"], ",", + FractionBox["1", "2"], ",", + FractionBox["1", "4"], ",", "0.995"}], "}"}]}], ";"}], "\n", + RowBox[{ + RowBox[{ + RowBox[{"{", + RowBox[{ + SubscriptBox["r", "0"], ",", + SubscriptBox["r", "1"], ",", + SubscriptBox["r", "2"]}], "}"}], " ", "=", " ", + RowBox[{"{", + RowBox[{"2", ",", "1", ",", "4"}], "}"}]}], ";"}], "\n", + RowBox[{ + RowBox[{"Assert", "[", + RowBox[{ + SubscriptBox["w", "0"], ">=", "0"}], "]"}], ";", " ", + RowBox[{"Assert", "[", + RowBox[{ + SubscriptBox["w", "1"], ">=", "0"}], "]"}], ";", " ", + RowBox[{"Assert", "[", + RowBox[{ + SubscriptBox["w", "2"], ">=", "0"}], "]"}], ";"}], "\n", + RowBox[{ + RowBox[{"Assert", "[", + RowBox[{ + RowBox[{ + SubscriptBox["w", "0"], "+", + SubscriptBox["w", "1"], "+", + SubscriptBox["w", "2"]}], "==", "1"}], "]"}], ";"}]}], "Code", + CellChangeTimes->{{3.918751691232606*^9, 3.918751736459319*^9}, { + 3.918751784392592*^9, 3.918751817471953*^9}, {3.918751851607045*^9, + 3.91875188728032*^9}, {3.918752891330223*^9, 3.918752911941004*^9}, { + 3.918833722601438*^9, 3.918833724616372*^9}, {3.9188338684873323`*^9, + 3.918833887396367*^9}, {3.918833942167193*^9, 3.918833946922741*^9}}, + CellLabel-> + "In[4541]:=",ExpressionUUID->"a0e84500-0eec-4695-80c6-06f05dc58a45"], + +Cell[CellGroupData[{ + +Cell[BoxData[{ + RowBox[{ + RowBox[{ + RowBox[{"L", "[", + RowBox[{ + "r0_", ",", "r1_", ",", "r2_", ",", "w0_", ",", "w1_", ",", "w2_"}], + "]"}], " ", ":=", " ", + RowBox[{ + SuperscriptBox["r0", "w0"], + SuperscriptBox["r1", "w1"], + SuperscriptBox["r2", "w2"]}]}], ";"}], "\n", + RowBox[{ + RowBox[{ + RowBox[{"\[CurlyPhi]", "[", + RowBox[{ + "r0_", ",", "r1_", ",", "r2_", ",", "w0_", ",", "w1_", ",", "w2_", ",", + "L_"}], "]"}], " ", ":=", " ", + RowBox[{ + RowBox[{ + SuperscriptBox[ + RowBox[{"(", + FractionBox["r0", "L"], ")"}], "w0"], + SuperscriptBox[ + RowBox[{"(", + FractionBox["r1", "L"], ")"}], "w1"], + SuperscriptBox[ + RowBox[{"(", + FractionBox["r2", "L"], ")"}], "w2"]}], "-", "1"}]}], ";"}], "\n", + RowBox[{ + RowBox[{ + SubscriptBox["L", "i"], " ", ":=", " ", + RowBox[{"L", "[", + RowBox[{ + SubscriptBox["r", "0"], ",", + SubscriptBox["r", "1"], ",", + SubscriptBox["r", "2"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["w", "1"], ",", + SubscriptBox["w", "2"]}], "]"}]}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + RowBox[{"N", "[", + SubscriptBox["L", "i"], "]"}], ",", " ", + "\"\\""}], + "]"}], ";"}], "\n", + RowBox[{"Assert", "[", + RowBox[{ + RowBox[{"\[CurlyPhi]", "[", + RowBox[{ + SubscriptBox["r", "0"], ",", + SubscriptBox["r", "1"], ",", + SubscriptBox["r", "2"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["w", "1"], ",", + SubscriptBox["w", "2"], ",", + SubscriptBox["L", "i"]}], "]"}], " ", "==", " ", "0"}], "]"}], "\n", + RowBox[{ + RowBox[{ + RowBox[{"P", "[", + RowBox[{"rj_", ",", "wj_"}], "]"}], " ", ":=", " ", + RowBox[{ + FractionBox["wj", + SubscriptBox["w", "2"]], + FractionBox[ + SubscriptBox["r", "2"], "rj"]}]}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + RowBox[{"P", "[", + RowBox[{ + SubscriptBox["r", "0"], ",", + SubscriptBox["w", "0"]}], "]"}], ",", " ", + "\"\\""}], "]"}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + RowBox[{"P", "[", + RowBox[{ + SubscriptBox["r", "1"], ",", + SubscriptBox["w", "0"]}], "]"}], ",", " ", + "\"\\""}], "]"}], ";"}]}], "Code", + CellChangeTimes->{{3.9187521241864777`*^9, 3.918752206468246*^9}, { + 3.918752408371162*^9, 3.9187525015264397`*^9}, {3.918752778204928*^9, + 3.9187527934165163`*^9}, {3.918752864976017*^9, 3.918752879664754*^9}, { + 3.918752910813592*^9, 3.9187529311666317`*^9}, 3.918810807339789*^9, + 3.9188187264364147`*^9, {3.918830706855132*^9, 3.918830811295597*^9}, { + 3.918833155720422*^9, 3.9188331576473083`*^9}, 3.918833261083931*^9, { + 3.918833415294015*^9, 3.918833528124111*^9}}, + CellLabel-> + "In[4545]:=",ExpressionUUID->"0e356c65-8dbf-4f2f-bf8a-bba723f830ef"], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{ + TagBox["\<\"The initial \\!\\(\\*SubscriptBox[\\(L\\), \\(\\(i\\)\\(\\\\ \ +\\)\\)]\\)= \"\>", + "EchoLabel"], " ", "1.681792830507429`"}]], "Echo", + CellChangeTimes->{ + 3.918833950315713*^9},ExpressionUUID->"45bd1a35-2daf-486c-be7e-\ +ac9cf769f4bf"], + +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Price of Token0 in terms of Token2 is: \ +\\!\\(\\*SubscriptBox[\\(P\\), \\(0\\)]\\) = \"\>", + "EchoLabel"], " ", "2"}]], "Echo", + CellChangeTimes->{ + 3.918833950343854*^9},ExpressionUUID->"153b6381-03f3-4cc5-b89e-\ +8a58c370c70d"], + +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Price of Token0 in terms of Token2 is : \ +\\!\\(\\*SubscriptBox[\\(P\\), \\(1\\)]\\) = \"\>", + "EchoLabel"], " ", "4"}]], "Echo", + CellChangeTimes->{ + 3.9188339503546124`*^9},ExpressionUUID->"86ca229b-d3d3-4392-b475-\ +5c5b2a8c4703"] +}, Open ]] +}, Open ]], + +Cell[BoxData[{ + RowBox[{ + RowBox[{ + RowBox[{ + SubscriptBox["\[Delta]", "Liq"], "[", + RowBox[{ + "d0_", ",", "d1_", ",", "d2_", ",", "r0_", ",", "r1_", ",", "r2_", ",", + "w0_", ",", "w1_", ",", "w2_", ",", "L_", ",", "\[Gamma]_"}], "]"}], " ", + ":=", " ", + RowBox[{"L", " ", + RowBox[{"(", + RowBox[{"1", "-", "\[Gamma]"}], ")"}], + RowBox[{"(", " ", + RowBox[{ + RowBox[{"w0", " ", + FractionBox["d0", "r0"]}], " ", "+", " ", + RowBox[{"w1", " ", + FractionBox["d1", "r1"]}], " ", "+", " ", + RowBox[{"w2", " ", + FractionBox["d2", "r2"]}]}], ")"}]}]}], ";"}], "\n", + RowBox[{ + RowBox[{ + RowBox[{ + SubscriptBox["\[CapitalDelta]", "0"], "[", + RowBox[{ + "d1_", ",", "d2_", ",", "r0_", ",", "r1_", ",", "r2_", ",", "w0_", ",", + "w1_", ",", "w2_", ",", "L_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", + + RowBox[{ + SuperscriptBox[ + RowBox[{"(", + FractionBox[ + RowBox[{"L", "+", + RowBox[{ + SubscriptBox["\[Delta]", "Liq"], "[", + RowBox[{ + "0", ",", "d1", ",", "d2", ",", "r0", ",", "r1", ",", "r2", ",", + "w0", ",", "w1", ",", "w2", ",", "L", ",", "\[Gamma]"}], "]"}]}], + RowBox[{ + SuperscriptBox[ + RowBox[{"(", + RowBox[{"r1", "+", "d1"}], ")"}], "w1"], + SuperscriptBox[ + RowBox[{"(", + RowBox[{"r2", "+", "d2"}], ")"}], "w2"]}]], ")"}], + FractionBox["1", "w0"]], "-", "r0"}]}], ";"}]}], "Code", + CellChangeTimes->{{3.918831190664383*^9, 3.918831375407617*^9}, + 3.918831755178097*^9, {3.918832333868799*^9, 3.918832358812463*^9}, { + 3.9188324005431747`*^9, 3.918832455177681*^9}, {3.918832495802816*^9, + 3.9188325358730917`*^9}}, + CellLabel-> + "In[4553]:=",ExpressionUUID->"23d32e68-bd22-4680-9cad-6dfbeb7a10f9"], + +Cell[CellGroupData[{ + +Cell[BoxData[{ + RowBox[{ + RowBox[{"d1In", " ", "=", " ", "1"}], ";"}], "\n", + RowBox[{ + RowBox[{"d0Out", " ", "=", " ", + RowBox[{ + SubscriptBox["\[CapitalDelta]", "0"], "[", + RowBox[{"d1In", ",", "0", ",", + SubscriptBox["r", "0"], ",", + SubscriptBox["r", "1"], ",", + SubscriptBox["r", "2"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["w", "1"], ",", + SubscriptBox["w", "2"], ",", + SubscriptBox["L", "i"], ",", + SubscriptBox["\[Gamma]", "i"]}], "]"}]}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + "d0Out", ",", " ", + "\"\\""}], "]"}], ";"}], "\n", + RowBox[{ + RowBox[{"deltaL", " ", "=", " ", + RowBox[{ + SubscriptBox["\[Delta]", "Liq"], "[", + RowBox[{"0", ",", "d1In", ",", "0", ",", + SubscriptBox["r", "0"], ",", + SubscriptBox["r", "1"], ",", + SubscriptBox["r", "2"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["w", "1"], ",", + SubscriptBox["w", "2"], ",", + SubscriptBox["L", "i"], ",", + SubscriptBox["\[Gamma]", "i"]}], "]"}]}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + "deltaL", ",", " ", + "\"\\""}], "]"}], ";"}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + RowBox[{"\[CurlyPhi]", "[", + RowBox[{ + RowBox[{ + SubscriptBox["r", "0"], "+", "d0Out"}], ",", " ", + RowBox[{ + SubscriptBox["r", "1"], "+", "d1In"}], ",", + SubscriptBox["r", "2"], ",", + SubscriptBox["w", "0"], ",", + SubscriptBox["w", "1"], ",", + SubscriptBox["w", "2"], ",", + RowBox[{ + SubscriptBox["L", "i"], "+", "deltaL"}]}], "]"}], ",", " ", + "\"\\""}], "]"}], ";"}]}], "Code", + CellChangeTimes->{{3.918832548072268*^9, 3.918832558704307*^9}, { + 3.918832654073709*^9, 3.918832696307899*^9}, {3.918832748510351*^9, + 3.9188328562801743`*^9}, {3.918832937076887*^9, 3.918833022245729*^9}, { + 3.918833176995616*^9, 3.918833183177202*^9}, {3.918833845045725*^9, + 3.9188338531292753`*^9}, {3.918833895356765*^9, 3.918833895763596*^9}}, + CellLabel-> + "In[4555]:=",ExpressionUUID->"10e2bdf9-b3e1-49bd-a8b0-90a96f87bb2a"], + +Cell[CellGroupData[{ + +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Amount out: \\!\\(\\*SubscriptBox[\\(\[CapitalDelta]\\), \ +\\(0\\)]\\) = \"\>", + "EchoLabel"], " ", + RowBox[{"-", "1.494981218730469`"}]}]], "Echo", + CellChangeTimes->{ + 3.918833952576915*^9},ExpressionUUID->"4493edf0-f1b4-4406-b26f-\ +093804d19521"], + +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Liquidity change: \\!\\(\\*SubscriptBox[\\(\[CapitalDelta]\\), \ +\\(L\\)]\\) = \"\>", + "EchoLabel"], " ", "0.004204482076268576`"}]], "Echo", + CellChangeTimes->{ + 3.918833952606021*^9},ExpressionUUID->"2e895919-575c-4e22-a635-\ +66cffb839ef4"], + +Cell[BoxData[ + RowBox[{ + TagBox["\<\"Validation = \"\>", + "EchoLabel"], " ", "0.`"}]], "Echo", + CellChangeTimes->{ + 3.9188339526178627`*^9},ExpressionUUID->"b5051048-024e-4982-abd4-\ +ad63864fd797"] +}, Open ]] +}, Open ]] +}, Open ]] +}, +WindowSize->{3161, 2083}, +WindowMargins->{{Automatic, 12}, {Automatic, -819}}, +FrontEndVersion->"13.2 for Mac OS X ARM (64-bit) (January 31, 2023)", +StyleDefinitions->FrontEnd`FileName[{$RootDirectory, "Users", "colin", + "Documents"}, "DarkMode.nb", CharacterEncoding -> "UTF-8"], +ExpressionUUID->"49e64aa8-68d4-4425-b2a2-bba672c9d2ed" +] +(* End of Notebook Content *) + +(* Internal cache information *) +(*CellTagsOutline +CellTagsIndex->{} +*) +(*CellTagsIndex +CellTagsIndex->{} +*) +(*NotebookFileOutline +Notebook[{ +Cell[CellGroupData[{ +Cell[583, 22, 184, 3, 194, "Title",ExpressionUUID->"b9153d6d-addd-49dc-914c-671e23f8f6c5"], +Cell[770, 27, 161, 4, 69, "Code",ExpressionUUID->"abb15b31-0a39-46c6-bf1d-00038da522b3"], +Cell[934, 33, 1592, 46, 216, "Code",ExpressionUUID->"a0e84500-0eec-4695-80c6-06f05dc58a45"], +Cell[CellGroupData[{ +Cell[2551, 83, 3096, 92, 421, "Code",ExpressionUUID->"0e356c65-8dbf-4f2f-bf8a-bba723f830ef"], +Cell[CellGroupData[{ +Cell[5672, 179, 277, 7, 50, "Echo",ExpressionUUID->"45bd1a35-2daf-486c-be7e-ac9cf769f4bf"], +Cell[5952, 188, 271, 7, 50, "Echo",ExpressionUUID->"153b6381-03f3-4cc5-b89e-8a58c370c70d"], +Cell[6226, 197, 274, 7, 50, "Echo",ExpressionUUID->"86ca229b-d3d3-4392-b475-5c5b2a8c4703"] +}, Open ]] +}, Open ]], +Cell[6527, 208, 1833, 51, 184, "Code",ExpressionUUID->"23d32e68-bd22-4680-9cad-6dfbeb7a10f9"], +Cell[CellGroupData[{ +Cell[8385, 263, 2288, 63, 278, "Code",ExpressionUUID->"10e2bdf9-b3e1-49bd-a8b0-90a96f87bb2a"], +Cell[CellGroupData[{ +Cell[10698, 330, 293, 8, 50, "Echo",ExpressionUUID->"4493edf0-f1b4-4406-b26f-093804d19521"], +Cell[10994, 340, 284, 7, 50, "Echo",ExpressionUUID->"2e895919-575c-4e22-a635-66cffb839ef4"], +Cell[11281, 349, 202, 6, 50, "Echo",ExpressionUUID->"b5051048-024e-4982-abd4-ad63864fd797"] +}, Open ]] +}, Open ]] +}, Open ]] +} +] +*) + +(* End of internal cache information *) + diff --git a/src/LogNormal/README.md b/src/LogNormal/README.md index 759610a8..af6daa61 100644 --- a/src/LogNormal/README.md +++ b/src/LogNormal/README.md @@ -2,9 +2,11 @@ This will be all the background needed to understand the `LogNormal` DFMM. ## Conceptual Overview -The `LogNormal` DFMM provides the LP with a a log-normal shaped liquidity distribution centered around a price $K$ with a width given by $\sigma$. -This strategy can be made time-dependent by an additional $\tau$ parameter that is the time til the pool will "expire". -In this case, the LN trading function provides the LP with a payoff that is equivalent to a Black-Scholes covered call option with strike $K$, implied volatility $\sigma$, and time to expiration $\tau$. The parameters $K$ and $\sigma$ can also be made time dependent. +The `LogNormal` DFMM provides the LP with a a log-normal shaped liquidity distribution centered around a price $\mu$ with a width given by $\sigma$. + +Note that this strategy can be made time-dependent by an additional $\tau$ parameter that is the time til the pool will "expire". +In this case, the LN trading function provides the LP with a payoff that is equivalent to a Black-Scholes covered call option with strike $K = \mu$, implied volatility $\sigma$, and time to expiration $\tau$. +We do not cover this explicitly here. ## Core We mark reserves as: @@ -31,11 +33,13 @@ As the pool's liquidity increases, the maximal amount of each reserve increases We will use the following notation: $$\begin{equation} d_1(S;\mu,\sigma) = \frac{\ln\frac{S}{\mu}+\frac{1}{2}\sigma^2 }{\sigma} -\end{equation}$$ - -$$\begin{equation} -d_2(S;\mu,\sigma) = \frac{\ln\frac{S}{K}-\frac{1}{2}\sigma^2 }{\sigma} -\end{equation}$$ +\end{equation} +$$ +$$ +\begin{equation} +d_2(S;\mu,\sigma) = \frac{\ln\frac{S}{\mu}-\frac{1}{2}\sigma^2 }{\sigma} +\end{equation} +$$ ## Price We can provide the price of the pool given either of the reserves: @@ -69,7 +73,9 @@ $$\begin{equation} \boxed{L_0 = \frac{x}{1-\Phi(d_1(S;\mu,\sigma))}} \end{equation}$$ From this, we can get the amount $y_0$ -$$\boxed{y_0 = \mu L_0 \Phi(d_2(S;K,\sigma, \tau))}$$ +$$ +\boxed{y_0 = \mu L_0 \Phi(d_2(S;\mu,\sigma, \tau))} +$$ ### Given $y$ and price @@ -82,6 +88,35 @@ Suppose that the user specifies the amount $y$ they wish to allocate and they al Now we need to get $x$: $$\boxed{x_0 = L_0 \left(1-\Phi\left(d_1(S;\mu,\sigma)\right)\right)}$$ +## Allocations and Deallocations +Allocations and deallocations should not change the price of a pool, and hence the ratio of reserves cannot change while increasing liquidity the correct amount. + +**Input $\Delta_X$:** If a user wants to allocate a specific amount of $\Delta_X$, then it must be that: +$$ +\frac{x}{L} = \frac{x+\Delta_X}{L+\Delta_L} +$$ +which yields: +$$ +\boxed{\Delta_L = L \frac{\Delta_X}{x}} +$$ +Then it must be that +$$ +\boxed{\Delta_Y = y\frac{\Delta_X}{x}} +$$ + +**Input $\Delta_Y$:** To allocate a specific amount of $\Delta_Y$, then it must be that: +$$ +\frac{y}{\mu L} = \frac{y+\Delta_Y}{\mu(L+\Delta_L)} +$$ +which yields: +$$ +\boxed{\Delta_L = L \frac{\Delta_Y}{y}} +$$ +and we likewise get +$$ +\boxed{\Delta_X = x\frac{\Delta_Y}{y}} +$$ + ## Swaps We require that the trading function remain invariant when a swap is applied, that is: $$\Phi^{-1}\left(\frac{x+\Delta_X}{L + \Delta_L}\right)+\Phi^{-1}\left(\frac{y}{\mu (L + \Delta_L)}\right)+\sigma = 0$$ @@ -90,34 +125,27 @@ where either $\Delta_X$ or $\Delta_Y$ is given by user input and the $\Delta_L$ ### Trade in $\Delta_X$ for $\Delta_Y$ If we want to trade in $\Delta_X$ for $\Delta_Y$, we first accumulate fees by taking -$$\Delta_L = (1-\gamma) \Delta_X.$$ +$$ +\textrm{Fees} = (1-\gamma) \Delta_X. +$$ +Then, we treat these fees as an allocation, therefore: +$$ +\boxed{\Delta_L = \frac{P}{Px +y}L\frac{(1-\gamma)\Delta_X}{x}} +$$ +where $P$ is the price of token $X$ quoted by the pool itself (i.e., using $P_X$ or $P_Y$ in Eq. (4) or (5) above). Then we can use our invariant equation and solve for $\Delta_Y$ in terms of $\Delta_X$ to get: $$\boxed{\Delta_Y = \mu (L+\Delta_L)\cdot\Phi\left(-\sigma-\Phi^{-1}\left(\frac{x+\Delta_X}{L+\Delta_L}\right)\right)-y}$$ ### Trade in $\Delta_Y$ for $\Delta_X$ If we want to trade in $\Delta_X$ for $\Delta_Y$, we first accumulate fees by taking -$$\Delta_L = \frac{1-\gamma}{\mu} \Delta_Y.$$ +$$ +\boxed{\Delta_L = L\frac{(1-\gamma)\Delta_X}{Px +y}} +$$ Then we can use our invariant equation and solve for $\Delta_X$ in terms of $\Delta_Y$ to get: -$$\boxed{\Delta_X = (L+\delta_L)\cdot\Phi\left(-\sigma-\Phi^{-1}\left(\frac{y+\Delta_Y}{K(L+\Delta_L)}\right)\right)-x}$$ - -## Allocations and Deallocations -Allocations and deallocations should not change the price of a pool, and hence the ratio of reserves cannot change while increasing liquidity the correct amount. - -**Input $\delta_X$:** If a user wants to allocate a specific amount of $\delta_X$, then it must be that: -$$\frac{x}{L} = \frac{x+\Delta_X}{L+\Delta_L}$$ -which yields: -$$\Delta_L = L \frac{\Delta_X}{x}$$ -Then it must be that -$$\Delta_Y = y\frac{\Delta_X}{x}$$ - -**Input $\Delta_Y$:** To allocate a specific amount of $\Delta_Y$, then it must be that: -$$\frac{y}{\mu L} = \frac{y+\Delta_Y}{\mu(L+\Delta_L)}$$ -which yields: -$$\Delta_L = L \frac{\Delta_Y}{y}$$ -and we likewise get -$$\Delta_X = x\frac{\Delta_Y}{y}$$ - +$$ +\boxed{\Delta_X = (L+\Delta_L)\cdot\Phi\left(-\sigma-\Phi^{-1}\left(\frac{y+\Delta_Y}{\mu(L+\Delta_L)}\right)\right)-x} +$$ ## Value Function on $L(S)$ Relate to value on $V(L,S)$ and $V(x,y)$. @@ -125,10 +153,14 @@ Then we can use this to tokenize. We have $L_X(x, S)$ and $L_Y(y, S)$. We know that: $$V = Sx + y$$ We can get the following from the trading function: -$$x = LS\cdot\left(1-\Phi\left(\frac{\ln\frac{S}{K}+\frac{1}{2}\sigma^2}{\sigma}\right)\right)\\ -y = K\cdot L\cdot \Phi\left(\frac{\ln\frac{S}{K}-\frac{1}{2}\sigma^2}{\sigma}\right)$$ +$$ +x = LS\cdot\left(1-\Phi\left(\frac{\ln\frac{S}{\mu}+\frac{1}{2}\sigma^2}{\sigma}\right)\right)\\ +y = \mu\cdot L\cdot \Phi\left(\frac{\ln\frac{S}{\mu}-\frac{1}{2}\sigma^2}{\sigma}\right) +$$ Therefore: -$$\boxed{V(L,S) = L\left( S\cdot\left(1-\Phi\left(\frac{\ln\frac{S}{K}+\frac{1}{2}\sigma^2}{\sigma}\right)\right) + K\cdot \Phi\left(\frac{\ln\frac{S}{K}-\frac{1}{2}\sigma^2}{\sigma}\right)\right)}$$ +$$ +\boxed{V(L,S) = L\left( S\cdot\left(1-\Phi\left(\frac{\ln\frac{S}{\mu}+\frac{1}{2}\sigma^2}{\sigma}\right)\right) + \mu\cdot \Phi\left(\frac{\ln\frac{S}{\mu}-\frac{1}{2}\sigma^2}{\sigma}\right)\right)} +$$ ### Time Dependence Note that $L$ effectively changes as parameters of the trading function change. diff --git a/src/LogNormal/log_normal.nb b/src/LogNormal/log_normal.nb index 3ce64e8d..329ffa88 100644 --- a/src/LogNormal/log_normal.nb +++ b/src/LogNormal/log_normal.nb @@ -3,10 +3,10 @@ NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 0, 0] -NotebookDataLength[ 81895, 2317] -NotebookOptionsPosition[ 73068, 2142] -NotebookOutlinePosition[ 73624, 2161] -CellTagsIndexPosition[ 73581, 2158] +NotebookDataLength[ 86695, 2333] +NotebookOptionsPosition[ 78138, 2161] +NotebookOutlinePosition[ 78697, 2180] +CellTagsIndexPosition[ 78654, 2177] WindowFrame->Normal*) (* Beginning of Notebook Content *) @@ -50,7 +50,7 @@ Cell[BoxData[ CellChangeTimes->{{3.91138727840687*^9, 3.911387281430051*^9}, { 3.911387543969853*^9, 3.911387555514419*^9}}, CellLabel-> - "In[897]:=",ExpressionUUID->"8255c47c-fa0b-4fdd-8638-752453aca613"] + "In[3266]:=",ExpressionUUID->"8255c47c-fa0b-4fdd-8638-752453aca613"] }, Open ]], Cell[CellGroupData[{ @@ -79,7 +79,7 @@ Cell[BoxData[{ 3.917383102823773*^9}, {3.9173831552741337`*^9, 3.917383158507695*^9}, 3.917383532443891*^9}, CellLabel-> - "In[898]:=",ExpressionUUID->"25d6c1c4-f902-41e0-8746-c63f6b03d94e"] + "In[3833]:=",ExpressionUUID->"25d6c1c4-f902-41e0-8746-c63f6b03d94e"] }, Open ]], Cell[CellGroupData[{ @@ -97,36 +97,30 @@ Cell[BoxData[{ RowBox[{ RowBox[{ SubscriptBox["d", "1"], "[", - RowBox[{"S_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], "]"}], " ", ":=", - " ", + RowBox[{"S_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", " ", FractionBox[ RowBox[{ RowBox[{"Log", "[", - FractionBox["S", "K"], "]"}], " ", "+", " ", + FractionBox["S", "\[Mu]"], "]"}], " ", "+", " ", RowBox[{ FractionBox["1", "2"], - SuperscriptBox["\[Sigma]", "2"], "\[Tau]"}]}], - RowBox[{"\[Sigma]", - RowBox[{"\[Sqrt]", "\[Tau]"}]}]]}], "\n", + SuperscriptBox["\[Sigma]", "2"]}]}], "\[Sigma]"]}], "\n", RowBox[{ RowBox[{ SubscriptBox["d", "2"], "[", - RowBox[{"S_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], "]"}], " ", ":=", - " ", + RowBox[{"S_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", " ", FractionBox[ RowBox[{ RowBox[{"Log", "[", - FractionBox["S", "K"], "]"}], " ", "-", " ", + FractionBox["S", "\[Mu]"], "]"}], " ", "-", " ", RowBox[{ FractionBox["1", "2"], - SuperscriptBox["\[Sigma]", "2"], "\[Tau]"}]}], - RowBox[{"\[Sigma]", - RowBox[{"\[Sqrt]", "\[Tau]"}]}]]}]}], "Code", + SuperscriptBox["\[Sigma]", "2"]}]}], "\[Sigma]"]}]}], "Code", CellChangeTimes->{{3.911383086202894*^9, 3.911383096527341*^9}, { - 3.911383144055451*^9, 3.911383310823001*^9}, {3.9113851030677443`*^9, - 3.91138511600043*^9}}, + 3.911383144055451*^9, 3.911383310823001*^9}, {3.9113851030677443`*^9, + 3.91138511600043*^9}, 3.9185709112502613`*^9}, CellLabel-> - "In[900]:=",ExpressionUUID->"d5d16a82-3e60-44ff-affc-b50eb9144304"] + "In[3835]:=",ExpressionUUID->"d5d16a82-3e60-44ff-affc-b50eb9144304"] }, Open ]], Cell[CellGroupData[{ @@ -154,66 +148,62 @@ Cell[BoxData[{ RowBox[{ RowBox[{ SubscriptBox["L", "X"], "[", - RowBox[{"x_", ",", "S_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], - "]"}], " ", ":=", " ", + RowBox[{"x_", ",", "S_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", + " ", FractionBox["x", RowBox[{"1", " ", "-", " ", RowBox[{"\[CapitalPhi]", "[", RowBox[{ SubscriptBox["d", "1"], "[", - RowBox[{"S", ",", "K", ",", "\[Sigma]", ",", "\[Tau]"}], "]"}], - "]"}]}]]}], "\n", + RowBox[{"S", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], "]"}]}]]}], "\n", RowBox[{ RowBox[{ SubscriptBox["L", "Y"], "[", - RowBox[{"y_", ",", "S_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], - "]"}], " ", ":=", " ", + RowBox[{"y_", ",", "S_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", + " ", FractionBox["y", - RowBox[{"K", " ", + RowBox[{"\[Mu]", " ", RowBox[{"\[CapitalPhi]", "[", RowBox[{ SubscriptBox["d", "2"], "[", - RowBox[{"S", ",", "K", ",", "\[Sigma]", ",", "\[Tau]"}], "]"}], - "]"}]}]]}], "\n", + RowBox[{"S", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], "]"}]}]]}], "\n", RowBox[{ RowBox[{"X", "[", - RowBox[{"y_", ",", "S_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], - "]"}], " ", ":=", " ", + RowBox[{"y_", ",", "S_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", + " ", RowBox[{ RowBox[{ SubscriptBox["L", "Y"], "[", - RowBox[{"y", ",", "S", ",", "K", ",", "\[Sigma]", ",", "\[Tau]"}], "]"}], - " ", + RowBox[{"y", ",", "S", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], " ", RowBox[{"(", RowBox[{"1", " ", "-", " ", RowBox[{"\[CapitalPhi]", "[", RowBox[{ SubscriptBox["d", "1"], "[", - RowBox[{"S", ",", "K", ",", "\[Sigma]", ",", "\[Tau]"}], "]"}], - "]"}]}], ")"}]}]}], "\n", + RowBox[{"S", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], "]"}]}], + ")"}]}]}], "\n", RowBox[{ RowBox[{"Y", "[", - RowBox[{"x_", ",", "S_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], - "]"}], " ", ":=", " ", - RowBox[{"K", " ", + RowBox[{"x_", ",", "S_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", + " ", + RowBox[{"\[Mu]", " ", RowBox[{ SubscriptBox["L", "X"], "[", - RowBox[{"x", ",", "S", ",", "K", ",", "\[Sigma]", ",", "\[Tau]"}], "]"}], - " ", + RowBox[{"x", ",", "S", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], " ", RowBox[{"\[CapitalPhi]", "[", RowBox[{ SubscriptBox["d", "2"], "[", - RowBox[{"S", ",", "K", ",", "\[Sigma]", ",", "\[Tau]"}], "]"}], - "]"}]}]}]}], "Code", + RowBox[{"S", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], "]"}]}]}]}], "Code",\ + CellChangeTimes->{{3.911383688783895*^9, 3.911383741794456*^9}, { - 3.911383797950727*^9, 3.911383809912835*^9}, {3.9113838491740713`*^9, - 3.911383864952888*^9}, {3.9113841779644413`*^9, 3.911384322151863*^9}, { - 3.911384433609087*^9, 3.911384448745434*^9}, {3.9113850554248533`*^9, - 3.911385099649076*^9}, {3.91138525707533*^9, 3.911385263363533*^9}, { - 3.911385324670476*^9, 3.911385325035862*^9}, {3.911409187909778*^9, - 3.9114091880800257`*^9}}, + 3.911383797950727*^9, 3.911383809912835*^9}, {3.9113838491740713`*^9, + 3.911383864952888*^9}, {3.9113841779644413`*^9, 3.911384322151863*^9}, { + 3.911384433609087*^9, 3.911384448745434*^9}, {3.9113850554248533`*^9, + 3.911385099649076*^9}, {3.91138525707533*^9, 3.911385263363533*^9}, { + 3.911385324670476*^9, 3.911385325035862*^9}, {3.911409187909778*^9, + 3.9114091880800257`*^9}, 3.9185709187863417`*^9}, CellLabel-> - "In[902]:=",ExpressionUUID->"3950a1e9-9c32-45c4-b5ef-404c37d6ef65"] + "In[3837]:=",ExpressionUUID->"3950a1e9-9c32-45c4-b5ef-404c37d6ef65"] }, Open ]], Cell[CellGroupData[{ @@ -230,9 +220,9 @@ Cell[BoxData[{ RowBox[{ RowBox[{ SubscriptBox["P", "X"], "[", - RowBox[{"x_", ",", "L_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], - "]"}], " ", ":=", " ", - RowBox[{"K", " ", + RowBox[{"x_", ",", "L_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", + " ", + RowBox[{"\[Mu]", " ", RowBox[{"Exp", "[", RowBox[{ RowBox[{ @@ -246,23 +236,23 @@ Cell[BoxData[{ RowBox[{ RowBox[{ SubscriptBox["P", "Y"], "[", - RowBox[{"y_", ",", "L_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], - "]"}], " ", ":=", " ", - RowBox[{"K", " ", + RowBox[{"y_", ",", "L_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", + " ", + RowBox[{"\[Mu]", " ", RowBox[{"Exp", "[", RowBox[{ RowBox[{ RowBox[{ SubscriptBox["\[CapitalPhi]", "inv"], "[", FractionBox["y", - RowBox[{"K", " ", "L"}]], "]"}], "\[Sigma]"}], " ", "+", " ", + RowBox[{"\[Mu]", " ", "L"}]], "]"}], "\[Sigma]"}], " ", "+", " ", RowBox[{ FractionBox["1", "2"], SuperscriptBox["\[Sigma]", "2"]}]}], "]"}]}]}]}], "Code", CellChangeTimes->{{3.9113839769604807`*^9, 3.911384029460125*^9}, { - 3.911385062781126*^9, 3.911385091502931*^9}}, + 3.911385062781126*^9, 3.911385091502931*^9}, 3.91857093005863*^9}, CellLabel-> - "In[906]:=",ExpressionUUID->"cdbca2c9-2426-4adf-8516-6c22e3b352b1"] + "In[3841]:=",ExpressionUUID->"cdbca2c9-2426-4adf-8516-6c22e3b352b1"] }, Open ]], Cell[CellGroupData[{ @@ -275,8 +265,7 @@ a417d745ef90"], Cell[BoxData[ RowBox[{ RowBox[{"\[CurlyPhi]", "[", - RowBox[{ - "x_", ",", "y_", ",", "L_", ",", "K_", ",", "\[Sigma]_", ",", "\[Tau]_"}], + RowBox[{"x_", ",", "y_", ",", "L_", ",", "\[Mu]_", ",", "\[Sigma]_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{ @@ -285,13 +274,11 @@ Cell[BoxData[ RowBox[{ SubscriptBox["\[CapitalPhi]", "inv"], "[", FractionBox["y", - RowBox[{"K", " ", "L"}]], "]"}], "+", - RowBox[{"\[Sigma]", - RowBox[{"\[Sqrt]", "\[Tau]"}]}]}]}]], "Code", + RowBox[{"\[Mu]", " ", "L"}]], "]"}], "+", "\[Sigma]"}]}]], "Code", CellChangeTimes->{{3.911410806554799*^9, 3.911410882453505*^9}, { - 3.9114109468550673`*^9, 3.9114109866059113`*^9}}, + 3.9114109468550673`*^9, 3.9114109866059113`*^9}, 3.9185709352254477`*^9}, CellLabel-> - "In[908]:=",ExpressionUUID->"a65cb5ec-cdac-40e0-bb49-f3d8157592d9"] + "In[3843]:=",ExpressionUUID->"a65cb5ec-cdac-40e0-bb49-f3d8157592d9"] }, Open ]] }, Open ]] }, Open ]], @@ -320,53 +307,32 @@ fee parameter \[Gamma]\ Cell[CellGroupData[{ -Cell[BoxData[ +Cell[BoxData[{ RowBox[{ - RowBox[{"(*", - RowBox[{ - RowBox[{ - RowBox[{"{", - RowBox[{ - SubscriptBox["K", "0"], ",", " ", - SubscriptBox["\[Sigma]", "0"], ",", " ", - SubscriptBox["\[Tau]", "0"], ",", " ", - SubscriptBox["\[Gamma]", "0"]}], "}"}], " ", "=", " ", - RowBox[{"{", - RowBox[{"3", ",", " ", - FractionBox["1", "4"], ",", " ", "1", ",", " ", "0.997"}], "}"}]}], - ";"}], " ", "*)"}], "\n", RowBox[{ RowBox[{ - RowBox[{ - RowBox[{"{", - RowBox[{ - SubscriptBox["K", "0"], ",", " ", - SubscriptBox["\[Sigma]", "0"], ",", " ", - SubscriptBox["\[Tau]", "0"], ",", " ", - SubscriptBox["\[Gamma]", "0"]}], "}"}], " ", "=", " ", - RowBox[{"{", - RowBox[{"1", ",", " ", - FractionBox["1", "8"], ",", " ", "1", ",", " ", "0.997"}], "}"}]}], - ";"}], " ", "\n", - RowBox[{ - RowBox[{"Echo", "[", - RowBox[{ - SubscriptBox["K", "0"], ",", " ", - "\"\<\!\(\*SubscriptBox[\(K\), \(0\)]\) = \>\""}], "]"}], ";", " ", - RowBox[{"Echo", "[", + RowBox[{"{", RowBox[{ + SubscriptBox["\[Mu]", "0"], ",", " ", SubscriptBox["\[Sigma]", "0"], ",", " ", - "\"\<\!\(\*SubscriptBox[\(\[Sigma]\), \(0\)]\) = \>\""}], "]"}], ";", - " ", - RowBox[{"Echo", "[", - RowBox[{ - SubscriptBox["\[Tau]", "0"], ",", " ", - "\"\<\!\(\*SubscriptBox[\(\[Tau]\), \(0\)]\) = \>\""}], "]"}], ";", " ", - RowBox[{"Echo", "[", - RowBox[{ - SubscriptBox["\[Gamma]", "0"], ",", " ", - "\"\<\!\(\*SubscriptBox[\(\[Gamma]\), \(0\)]\) = \>\""}], "]"}], - ";"}]}]}]], "Code", + SubscriptBox["\[Gamma]", "0"]}], "}"}], " ", "=", " ", + RowBox[{"{", + RowBox[{"1", ",", " ", + FractionBox["1", "4"], ",", " ", "0.995"}], "}"}]}], ";"}], " "}], "\n", + RowBox[{ + RowBox[{"Echo", "[", + RowBox[{ + SubscriptBox["K", "0"], ",", " ", + "\"\<\!\(\*SubscriptBox[\(K\), \(0\)]\) = \>\""}], "]"}], ";", " ", + RowBox[{"Echo", "[", + RowBox[{ + SubscriptBox["\[Sigma]", "0"], ",", " ", + "\"\<\!\(\*SubscriptBox[\(\[Sigma]\), \(0\)]\) = \>\""}], "]"}], ";", " ", + RowBox[{"Echo", "[", + RowBox[{ + SubscriptBox["\[Gamma]", "0"], ",", " ", + "\"\<\!\(\*SubscriptBox[\(\[Gamma]\), \(0\)]\) = \>\""}], "]"}], + ";"}]}], "Code", CellChangeTimes->{ 3.91138448247676*^9, {3.9113845136096563`*^9, 3.911384540517331*^9}, { 3.911384579083336*^9, 3.911384646274679*^9}, {3.911384706054633*^9, @@ -378,19 +344,32 @@ Cell[BoxData[ 3.916935393268579*^9}, {3.916935561687649*^9, 3.916935563633135*^9}, { 3.91738367920582*^9, 3.917383680576692*^9}, {3.917384081819539*^9, 3.917384085426984*^9}, {3.9173856229323063`*^9, 3.917385639341588*^9}, { - 3.91751517656183*^9, - 3.917515189435231*^9}},ExpressionUUID->"8d262a91-37a1-41fb-b1b3-\ -ae8191b1ccda"], + 3.91751517656183*^9, 3.917515189435231*^9}, {3.918570943201333*^9, + 3.918570984185614*^9}, {3.918571110139764*^9, 3.9185711113502274`*^9}, { + 3.9185720081337433`*^9, 3.918572008408592*^9}, {3.918575751023251*^9, + 3.918575751913149*^9}, {3.918576073288947*^9, 3.9185760735774183`*^9}, { + 3.918576642017666*^9, 3.918576642103425*^9}, {3.918582513027935*^9, + 3.918582513467471*^9}, {3.918582809143463*^9, 3.918582809217847*^9}, { + 3.918582876514236*^9, 3.918582923985523*^9}, {3.918583425222728*^9, + 3.918583425376048*^9}, {3.918583546078206*^9, 3.918583546573629*^9}, { + 3.918584395359364*^9, 3.918584395834972*^9}, {3.9185864064676332`*^9, + 3.918586406580247*^9}, {3.918587050341199*^9, 3.918587075189999*^9}, { + 3.918588451693397*^9, 3.918588451829137*^9}, {3.918630585921973*^9, + 3.918630585996049*^9}, {3.9186306784955587`*^9, 3.918630678602592*^9}, { + 3.918631219716024*^9, 3.918631219811838*^9}, {3.918631276745323*^9, + 3.9186312768635263`*^9}}, + CellLabel-> + "In[3844]:=",ExpressionUUID->"8d262a91-37a1-41fb-b1b3-ae8191b1ccda"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ TagBox["\<\"\\!\\(\\*SubscriptBox[\\(K\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "3"}]], "Echo", + "EchoLabel"], " ", "1"}]], "Echo", CellChangeTimes->{ - 3.917385639673291*^9},ExpressionUUID->"af988e57-d45b-493e-8c77-\ -aeb0d6754a04"], + 3.9186459576704597`*^9},ExpressionUUID->"63fa2685-ead2-42c3-8894-\ +aa3d0f759278"], Cell[BoxData[ RowBox[{ @@ -398,24 +377,16 @@ Cell[BoxData[ "EchoLabel"], " ", FractionBox["1", "4"]}]], "Echo", CellChangeTimes->{ - 3.917385639702611*^9},ExpressionUUID->"7cbb943d-e136-42be-b7bf-\ -17128b81f7f7"], - -Cell[BoxData[ - RowBox[{ - TagBox["\<\"\\!\\(\\*SubscriptBox[\\(\[Tau]\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "1"}]], "Echo", - CellChangeTimes->{ - 3.917385639712528*^9},ExpressionUUID->"35bc58ee-e40e-4bf3-9e9f-\ -061ba0d278fb"], + 3.918645957703246*^9},ExpressionUUID->"ab767d72-08f9-45a3-8d7a-\ +62a93aac3a75"], Cell[BoxData[ RowBox[{ TagBox["\<\"\\!\\(\\*SubscriptBox[\\(\[Gamma]\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "0.997`"}]], "Echo", + "EchoLabel"], " ", "0.995`"}]], "Echo", CellChangeTimes->{ - 3.917385639734725*^9},ExpressionUUID->"e144304b-6b21-4799-ac3b-\ -3fa33013028a"] + 3.918645957713688*^9},ExpressionUUID->"865ae55a-ba52-403c-9134-\ +dd94b3a70090"] }, Open ]] }, Open ]] }, Open ]], @@ -442,7 +413,7 @@ Cell[BoxData[{ SubscriptBox["x", "0"], ",", SubscriptBox["S", "0"]}], "}"}], " ", "=", " ", RowBox[{"{", - RowBox[{"1000000", ",", " ", "2"}], "}"}]}], ";"}], " "}], "\n", + RowBox[{"1000000000", ",", " ", "0.75"}], "}"}]}], ";"}], " "}], "\n", RowBox[{ RowBox[{"Echo", "[", RowBox[{ @@ -460,8 +431,25 @@ Cell[BoxData[{ 3.917383705323718*^9}, {3.917383899939695*^9, 3.9173839018597183`*^9}, { 3.917383976339484*^9, 3.917383976688408*^9}, 3.917384041262576*^9, { 3.9173840921075373`*^9, 3.9173840922911777`*^9}, 3.917384525229738*^9, { - 3.917515198755231*^9, - 3.917515199530878*^9}},ExpressionUUID->"085ca656-cc94-43cf-a8c6-\ + 3.917515198755231*^9, 3.917515199530878*^9}, {3.918575982190796*^9, + 3.918575982584321*^9}, {3.918582811121216*^9, 3.9185828112296124`*^9}, { + 3.918582880689728*^9, 3.9185828808310337`*^9}, {3.918582926936624*^9, + 3.9185829296473217`*^9}, {3.91858299719833*^9, 3.918582997406849*^9}, { + 3.918583291020159*^9, 3.918583291177719*^9}, {3.918583428982098*^9, + 3.9185834291087303`*^9}, {3.918583548048421*^9, 3.918583551706524*^9}, { + 3.918584158439363*^9, 3.918584158785482*^9}, {3.918584216906336*^9, + 3.9185842170754147`*^9}, {3.918584354834117*^9, 3.918584355139624*^9}, { + 3.918584446835289*^9, 3.918584447252163*^9}, {3.918585317499875*^9, + 3.918585320001732*^9}, {3.918585959285797*^9, 3.918585960380043*^9}, { + 3.918587011890151*^9, 3.9185870122509117`*^9}, {3.91858707864706*^9, + 3.918587079216874*^9}, {3.9186305834832478`*^9, 3.918630583772887*^9}, { + 3.918630681419763*^9, 3.918630681553543*^9}, {3.9186312811761227`*^9, + 3.9186312818709307`*^9}, 3.918631349127054*^9, {3.918631421837872*^9, + 3.918631422168438*^9}, {3.918631663100456*^9, 3.9186316633223667`*^9}, { + 3.918643343448288*^9, 3.918643343752068*^9}, {3.918646106269537*^9, + 3.918646106440174*^9}, {3.918646277573381*^9, 3.918646277908587*^9}, { + 3.9186465675649567`*^9, 3.918646568407236*^9}, {3.918647114579299*^9, + 3.9186471322198763`*^9}},ExpressionUUID->"085ca656-cc94-43cf-a8c6-\ c116e23e4910"], Cell[CellGroupData[{ @@ -470,18 +458,18 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"The initial X-reserve balance is: \ \\!\\(\\*SubscriptBox[\\(x\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "1000"}]], "Echo", + "EchoLabel"], " ", "1000000000"}]], "Echo", CellChangeTimes->{ - 3.9173856411472588`*^9},ExpressionUUID->"b0609413-5fee-4b86-aed9-\ -380cc72ca5ad"], + 3.918646568794178*^9},ExpressionUUID->"d46f0b65-6c97-4fd7-a377-\ +fd814b863b4a"], Cell[BoxData[ RowBox[{ TagBox["\<\"\\!\\(\\*SubscriptBox[\\(S\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", "2"}]], "Echo", + "EchoLabel"], " ", "0.75`"}]], "Echo", CellChangeTimes->{ - 3.917385641179336*^9},ExpressionUUID->"0d8deb13-fecc-40d5-b792-\ -e5be624a621e"] + 3.918646568829261*^9},ExpressionUUID->"d830d4bf-eeeb-4bb6-a004-\ +32188869cd46"] }, Open ]] }, Open ]], @@ -512,16 +500,14 @@ Cell[BoxData[{ RowBox[{ SubscriptBox["x", "0"], ",", SubscriptBox["S", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}], ",", " ", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}], ",", " ", RowBox[{"Y", "[", RowBox[{ SubscriptBox["x", "0"], ",", SubscriptBox["S", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}]}], "}"}]}], ";"}], " "}], "\n", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}]}], "}"}]}], ";"}], " "}], "\n", RowBox[{ RowBox[{"Echo", "[", RowBox[{ @@ -541,9 +527,11 @@ Cell[BoxData[{ 3.911384992602735*^9, 3.9113850128379593`*^9}, {3.911385047347066*^9, 3.9113850518014383`*^9}, {3.9113851385254107`*^9, 3.9113851753238697`*^9}, { 3.91138696634296*^9, 3.911386992951726*^9}, {3.911387349621842*^9, - 3.911387398394403*^9}, {3.911912845565853*^9, 3.9119128460491123`*^9}}, + 3.911387398394403*^9}, {3.911912845565853*^9, 3.9119128460491123`*^9}, { + 3.918570990618823*^9, 3.918570994101475*^9}, {3.9185711059481163`*^9, + 3.9185711082874823`*^9}}, CellLabel-> - "In[811]:=",ExpressionUUID->"57112165-db6f-447c-9713-f9c85c6d4828"], + "In[4060]:=",ExpressionUUID->"57112165-db6f-447c-9713-f9c85c6d4828"], Cell[CellGroupData[{ @@ -551,20 +539,19 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"The initial liquidity is: \\!\\(\\*SubscriptBox[\\(L\\), \ \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", - "1072.05816303780375296378681139341832357048`18."}]], "Echo", + "EchoLabel"], " ", "1.1799546999753058`*^9"}]], "Echo", CellChangeTimes->{ - 3.91738564223216*^9},ExpressionUUID->"4fd65137-02a9-41b3-ba18-0ebf41cc4e36"], + 3.918646570423168*^9},ExpressionUUID->"d45d2202-bcd3-4d72-9040-\ +061ec9d3b3fd"], Cell[BoxData[ RowBox[{ TagBox["\<\"The initial Y-reserve balance is: \ \\!\\(\\*SubscriptBox[\\(y\\), \\(0\\)]\\) = \"\>", - "EchoLabel"], " ", - "129.71081089049378429032401949955047960211`18."}]], "Echo", + "EchoLabel"], " ", "1.1920585842721254`*^8"}]], "Echo", CellChangeTimes->{ - 3.917385642263144*^9},ExpressionUUID->"21eb62ab-27a6-41dd-a389-\ -5142ff75a033"] + 3.918646570454266*^9},ExpressionUUID->"7f4698d3-1c35-46e4-b14b-\ +549da3ca9c05"] }, Open ]] }, Open ]] }, Open ]], @@ -587,17 +574,15 @@ Cell[BoxData[{ RowBox[{ SubscriptBox["x", "0"], ",", SubscriptBox["L", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}], " ", "==", " ", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}], " ", "==", " ", RowBox[{ SubscriptBox["P", "Y"], "[", RowBox[{ SubscriptBox["y", "0"], ",", SubscriptBox["L", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}]}], "]"}], "\n", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}]}], "]"}], "\n", RowBox[{ RowBox[{ RowBox[{"Echo", "[", @@ -607,24 +592,24 @@ Cell[BoxData[{ RowBox[{ SubscriptBox["x", "0"], ",", SubscriptBox["L", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}], ",", " ", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}], ",", " ", "\"\\""}], "]"}], ";"}], " "}]}], "Code", CellChangeTimes->{{3.9113853639105387`*^9, 3.9113854185634947`*^9}, { 3.9113869483534203`*^9, 3.911386962492029*^9}, {3.911386994813387*^9, 3.911387177122032*^9}, {3.911387291516371*^9, 3.911387309281919*^9}, - 3.911912928324705*^9}, + 3.911912928324705*^9, {3.9185711812613907`*^9, 3.918571185390046*^9}, { + 3.91857169317227*^9, 3.918571699558569*^9}}, CellLabel-> - "In[356]:=",ExpressionUUID->"05df5500-1e66-49a9-afd7-256365f8b6dc"], + "In[4062]:=",ExpressionUUID->"05df5500-1e66-49a9-afd7-256365f8b6dc"], Cell[BoxData[ RowBox[{ TagBox["\<\"The initial price is: P = \"\>", - "EchoLabel"], " ", "2"}]], "Echo", + "EchoLabel"], " ", "0.75`"}]], "Echo", CellChangeTimes->{ - 3.917384531034382*^9},ExpressionUUID->"15c46bab-62f8-4c23-be66-\ -af5cfc278ceb"] + 3.9186465723885307`*^9},ExpressionUUID->"2780423d-6264-4b5d-a5a5-\ +68bad0b82ef8"] }, Open ]] }, Open ]], @@ -654,16 +639,14 @@ Cell[BoxData[{ RowBox[{ SubscriptBox["y", "0"], ",", SubscriptBox["S", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}], ",", " ", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}], ",", " ", RowBox[{"X", "[", RowBox[{ SubscriptBox["y", "0"], ",", SubscriptBox["S", "0"], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}]}], "}"}]}], ";"}], "\n", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}]}], "}"}]}], ";"}], "\n", RowBox[{ RowBox[{"Assert", "[", RowBox[{ @@ -679,9 +662,10 @@ Cell[BoxData[{ SubscriptBox["x", "0"]}], "}"}]}], "]"}], ";"}]}], "Code", CellChangeTimes->{{3.911387447754344*^9, 3.911387533259612*^9}, { 3.911409113951961*^9, 3.911409136342054*^9}, {3.911409206127439*^9, - 3.911409206365666*^9}}, + 3.911409206365666*^9}, {3.918571188362344*^9, 3.918571190424653*^9}, { + 3.9185717026957493`*^9, 3.918571706012089*^9}}, CellLabel-> - "In[358]:=",ExpressionUUID->"05cdeb1a-e1b0-40a7-af51-51ab9b75cc2e"] + "In[4064]:=",ExpressionUUID->"05cdeb1a-e1b0-40a7-af51-51ab9b75cc2e"] }, Open ]] }, Open ]] }, Open ]], @@ -707,83 +691,108 @@ reserve.\ Cell[BoxData[{ RowBox[{ RowBox[{ - RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", + RowBox[{"fees", "[", RowBox[{"\[CapitalDelta]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{"(", - RowBox[{"1", "-", "\[Gamma]"}], ")"}], "\[CapitalDelta]"}]}], "\n", - RowBox[{"(*", + RowBox[{"1", "-", "\[Gamma]"}], ")"}], "\[CapitalDelta]"}]}], + " "}], "\n", + RowBox[{ + RowBox[{ + SubscriptBox["\[Delta]", "LiqX"], "[", RowBox[{ + "\[CapitalDelta]_", ",", "x_", ",", "y_", ",", "L_", ",", "\[Mu]_", ",", + "\[Sigma]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", + RowBox[{ + RowBox[{ + SubscriptBox["P", "X"], "[", + RowBox[{"x", ",", "L", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], " ", "L", + " ", + FractionBox[ + RowBox[{"fees", "[", + RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}], RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"\[CapitalDelta]_", ",", "R_", ",", "L_", ",", "\[Gamma]_"}], - "]"}], " ", ":=", " ", + RowBox[{ + RowBox[{ + SubscriptBox["P", "X"], "[", + RowBox[{"x", ",", "L", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], " ", + "x"}], " ", "+", " ", "y"}]]}]}], "\n", + RowBox[{ + RowBox[{ + SubscriptBox["\[Delta]", "LiqY"], "[", + RowBox[{ + "\[CapitalDelta]_", ",", "x_", ",", "y_", ",", "L_", ",", "\[Mu]_", ",", + "\[Sigma]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", + RowBox[{"L", " ", + FractionBox[ + RowBox[{"fees", "[", + RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}], RowBox[{ RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", - RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}], - FractionBox["L", "R"]}]}], "*)"}]}], "\n", + RowBox[{ + SubscriptBox["P", "Y"], "[", + RowBox[{"y", ",", "L", ",", "\[Mu]", ",", "\[Sigma]"}], "]"}], " ", + "x"}], " ", "+", " ", "y"}]]}]}], "\n", RowBox[{ RowBox[{ SubscriptBox["\[CapitalDelta]", "X"], "[", RowBox[{ - "\[CapitalDelta]_", ",", "x_", ",", "y_", ",", "L_", ",", "K_", ",", - "\[Sigma]_", ",", "\[Tau]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", + "\[CapitalDelta]_", ",", "x_", ",", "y_", ",", "L_", ",", "\[Mu]_", ",", + "\[Sigma]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"L", "+", RowBox[{ - FractionBox["1", "K"], + SubscriptBox["\[Delta]", "LiqY"], "[", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", - RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}]}]}], ")"}], + "\[CapitalDelta]", ",", "x", ",", "y", ",", "L", ",", "\[Mu]", ",", + "\[Sigma]", ",", "\[Gamma]"}], "]"}]}], ")"}], RowBox[{"\[CapitalPhi]", "[", RowBox[{ - RowBox[{ - RowBox[{"-", "\[Sigma]"}], - RowBox[{"\[Sqrt]", "\[Tau]"}]}], " ", "-", " ", + RowBox[{"-", "\[Sigma]"}], " ", "-", " ", RowBox[{ SubscriptBox["\[CapitalPhi]", "inv"], "[", FractionBox[ RowBox[{"y", "+", "\[CapitalDelta]"}], - RowBox[{"K", + RowBox[{"\[Mu]", RowBox[{"(", RowBox[{"L", "+", RowBox[{ - FractionBox["1", "K"], + SubscriptBox["\[Delta]", "LiqY"], "[", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", - RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}]}]}], - ")"}]}]], "]"}]}], "]"}]}], "-", "x"}]}], "\n", + "\[CapitalDelta]", ",", "x", ",", "y", ",", "L", ",", "\[Mu]", + ",", "\[Sigma]", ",", "\[Gamma]"}], "]"}]}], ")"}]}]], "]"}]}], + "]"}]}], "-", "x"}]}], "\n", RowBox[{ RowBox[{ SubscriptBox["\[CapitalDelta]", "Y"], "[", RowBox[{ - "\[CapitalDelta]_", ",", "x_", ",", "y_", ",", "L_", ",", "K_", ",", - "\[Sigma]_", ",", "\[Tau]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", + "\[CapitalDelta]_", ",", "x_", ",", "y_", ",", "L_", ",", "\[Mu]_", ",", + "\[Sigma]_", ",", "\[Gamma]_"}], "]"}], " ", ":=", " ", RowBox[{ - RowBox[{"K", + RowBox[{"\[Mu]", RowBox[{"(", RowBox[{"L", "+", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", - RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}]}], ")"}], + SubscriptBox["\[Delta]", "LiqX"], "[", + RowBox[{ + "\[CapitalDelta]", ",", "x", ",", "y", ",", "L", ",", "\[Mu]", ",", + "\[Sigma]", ",", "\[Gamma]"}], "]"}]}], ")"}], RowBox[{"\[CapitalPhi]", "[", RowBox[{ - RowBox[{ - RowBox[{"-", "\[Sigma]"}], - RowBox[{"\[Sqrt]", "\[Tau]"}]}], " ", "-", " ", + RowBox[{"-", "\[Sigma]"}], " ", "-", " ", RowBox[{ SubscriptBox["\[CapitalPhi]", "inv"], "[", FractionBox[ RowBox[{"x", "+", "\[CapitalDelta]"}], RowBox[{"L", "+", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", - RowBox[{"\[CapitalDelta]", ",", "\[Gamma]"}], "]"}]}]], "]"}]}], - "]"}]}], "-", "y"}]}]}], "Code", + SubscriptBox["\[Delta]", "LiqX"], "[", + RowBox[{ + "\[CapitalDelta]", ",", "x", ",", "y", ",", "L", ",", "\[Mu]", ",", + "\[Sigma]", ",", "\[Gamma]"}], "]"}]}]], "]"}]}], "]"}]}], "-", + "y"}]}]}], "Code", CellChangeTimes->{{3.9113879019426517`*^9, 3.91138810608572*^9}, { 3.911388182414874*^9, 3.911388482660475*^9}, {3.911388787674255*^9, 3.911388979350903*^9}, {3.911389141187207*^9, 3.911389159323999*^9}, { @@ -795,15 +804,65 @@ Cell[BoxData[{ 3.91738450986141*^9}, {3.917384708602298*^9, 3.917384711107472*^9}, { 3.917384741504918*^9, 3.917384745117815*^9}, {3.917384781098084*^9, 3.917384801570612*^9}, {3.917384922013281*^9, 3.917384925581356*^9}, { - 3.9173850860945387`*^9, 3.917385090363779*^9}, - 3.917385467785697*^9},ExpressionUUID->"0716117c-5381-46be-8b57-\ -f2cefa727879"], + 3.9173850860945387`*^9, 3.917385090363779*^9}, 3.917385467785697*^9, { + 3.91857109514256*^9, 3.9185711020502167`*^9}, {3.91857136201642*^9, + 3.918571379355769*^9}, {3.9185719508515673`*^9, 3.9185719564304523`*^9}, { + 3.918572032513034*^9, 3.9185720372819643`*^9}, {3.918575843943832*^9, + 3.918575846003868*^9}, {3.918576114999403*^9, 3.9185761615915833`*^9}, { + 3.918576659877521*^9, 3.918576669588545*^9}, {3.918576871025722*^9, + 3.918576980060952*^9}, {3.9185799351979227`*^9, 3.918580034351376*^9}, { + 3.918580066820713*^9, 3.918580088205531*^9}, {3.91858024962215*^9, + 3.918580262523444*^9}, {3.918580294205887*^9, 3.918580298495079*^9}, { + 3.918580365884131*^9, 3.9185803726739683`*^9}, {3.9185815280229187`*^9, + 3.918581595304048*^9}, {3.918581637999057*^9, 3.9185817030183477`*^9}, { + 3.9185818429293957`*^9, 3.9185818876898746`*^9}, {3.9185823204024343`*^9, + 3.918582435530633*^9}, {3.918582488030525*^9, 3.918582492481691*^9}, { + 3.918582676185212*^9, 3.918582684377091*^9}, {3.9185827212029133`*^9, + 3.918582726305999*^9}, {3.918582845001643*^9, 3.918582856707839*^9}, { + 3.91858350972567*^9, 3.918583524907681*^9}, {3.9185836349151993`*^9, + 3.918583689775346*^9}, {3.918583814649831*^9, 3.918583887826089*^9}, + 3.918584019823391*^9, {3.918584115383397*^9, 3.918584125997015*^9}, { + 3.918584188749694*^9, 3.918584207807349*^9}, {3.918584252596579*^9, + 3.918584283333911*^9}, {3.9185843240947323`*^9, 3.9185843419430447`*^9}, { + 3.918584596408697*^9, 3.918584605431155*^9}, {3.918584698005369*^9, + 3.9185847022659883`*^9}, {3.918584733166923*^9, 3.9185847359196243`*^9}, { + 3.918584835029223*^9, 3.918584914920583*^9}, {3.918585923120076*^9, + 3.918585949059307*^9}, {3.918585981929215*^9, 3.918586212982409*^9}, { + 3.9185862713877707`*^9, 3.918586283220223*^9}, {3.918586430146008*^9, + 3.918586438229198*^9}, {3.91858647808181*^9, 3.9185865516402187`*^9}, { + 3.9185869770915956`*^9, 3.918586998684773*^9}, {3.9185871705919724`*^9, + 3.918587233694872*^9}, {3.918587688250499*^9, 3.918587732617826*^9}, { + 3.918587822943163*^9, 3.918587895921957*^9}, {3.918630539218589*^9, + 3.9186305548276157`*^9}, {3.918630656016925*^9, 3.918630658939457*^9}, { + 3.918630702505906*^9, 3.918630723206217*^9}, {3.918630766067203*^9, + 3.9186307800116253`*^9}, {3.918630857798958*^9, 3.918630861330348*^9}, { + 3.918630944696974*^9, 3.9186309775688953`*^9}, {3.918631062524468*^9, + 3.918631190734248*^9}, {3.9186313271535597`*^9, 3.91863134257788*^9}, { + 3.918631387338098*^9, 3.918631390137829*^9}, {3.918631437297716*^9, + 3.918631438126658*^9}, {3.918631612143648*^9, 3.9186316513861513`*^9}, { + 3.918631686728327*^9, 3.918631830046607*^9}, {3.918631896508091*^9, + 3.9186320069107533`*^9}, {3.91863303862149*^9, 3.9186330635458193`*^9}, { + 3.91863310072386*^9, 3.918633119499754*^9}, {3.918633166361033*^9, + 3.918633196016712*^9}, {3.9186332409230433`*^9, 3.918633311599324*^9}, { + 3.918633342234268*^9, 3.918633383646895*^9}, {3.918633455651833*^9, + 3.9186334734597473`*^9}, {3.9186432538684263`*^9, 3.918643296703499*^9}, { + 3.9186433525370207`*^9, 3.918643372417371*^9}, 3.918643647132059*^9, { + 3.9186456605015583`*^9, 3.918645704439562*^9}, {3.918645736019648*^9, + 3.9186457417525*^9}, {3.9186458580141783`*^9, 3.9186458880641613`*^9}, { + 3.918646011039798*^9, 3.9186460131439123`*^9}, {3.918646045288979*^9, + 3.918646059600195*^9}, {3.91864617045295*^9, 3.918646267932062*^9}, { + 3.9186464192975893`*^9, 3.91864641960671*^9}, {3.918646608483427*^9, + 3.91864684851731*^9}, {3.9186469185057583`*^9, 3.918647050242887*^9}, { + 3.918647093303738*^9, 3.918647093440069*^9}, {3.918647162357498*^9, + 3.9186471626747093`*^9}}, + CellLabel-> + "In[4174]:=",ExpressionUUID->"0716117c-5381-46be-8b57-f2cefa727879"], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ - RowBox[{"YIn", " ", "=", " ", "10"}], ";"}], "\n", + RowBox[{"YIn", " ", "=", " ", "1"}], ";"}], "\n", RowBox[{ RowBox[{"XOut", " ", "=", " ", RowBox[{ @@ -812,28 +871,25 @@ Cell[BoxData[{ SubscriptBox["x", "0"], ",", SubscriptBox["y", "0"], ",", SubscriptBox["L", "0"], ",", - SubscriptBox["K", "0"], ",", + SubscriptBox["\[Mu]", "0"], ",", SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"], ",", SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ";"}], "\n", RowBox[{ RowBox[{ RowBox[{"Echo", "[", - RowBox[{"XOut", ",", " ", "\"\\""}], "]"}], ";"}], "\n", - RowBox[{"(*", - RowBox[{ - RowBox[{"DeltaL", " ", "=", " ", - RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"YIn", ",", - SubscriptBox["y", "0"], ",", - SubscriptBox["L", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ";"}], "*)"}]}], "\n", + RowBox[{"XOut", ",", " ", "\"\\""}], "]"}], ";"}], " ", + RowBox[{"(*", " ", + RowBox[{"Should", " ", "be", " ", ".796"}], " ", "*)"}]}], "\n", RowBox[{ RowBox[{"DeltaL", " ", "=", " ", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", + SubscriptBox["\[Delta]", "LiqY"], "[", RowBox[{"YIn", ",", + SubscriptBox["x", "0"], ",", + SubscriptBox["y", "0"], ",", + SubscriptBox["L", "0"], ",", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"], ",", SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ";"}], "\n", RowBox[{ RowBox[{ @@ -846,16 +902,12 @@ Cell[BoxData[{ RowBox[{ SubscriptBox["y", "0"], "+", "YIn"}], ",", RowBox[{ - SubscriptBox["L", "0"], "+", - RowBox[{ - FractionBox["1", - SubscriptBox["K", "0"]], "DeltaL"}]}], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}], ",", " ", + SubscriptBox["L", "0"], "+", "DeltaL"}], ",", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}], ",", " ", "\"\\""}], "]"}], ";"}], "\n"}], "\n", RowBox[{ - RowBox[{"XIn", " ", "=", " ", "10"}], ";"}], "\n", + RowBox[{"XIn", " ", "=", " ", "1"}], ";"}], "\n", RowBox[{ RowBox[{"YOut", " ", "=", " ", RowBox[{ @@ -864,74 +916,66 @@ Cell[BoxData[{ SubscriptBox["x", "0"], ",", SubscriptBox["y", "0"], ",", SubscriptBox["L", "0"], ",", - SubscriptBox["K", "0"], ",", + SubscriptBox["\[Mu]", "0"], ",", SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"], ",", SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ";"}], "\n", RowBox[{ RowBox[{ RowBox[{"Echo", "[", - RowBox[{"YOut", ",", " ", "\"\\""}], "]"}], ";"}], "\n", - RowBox[{"(*", - RowBox[{ - RowBox[{"DeltaL", " ", "=", " ", - RowBox[{ - SubscriptBox["\[Delta]", "Liq"], "[", - RowBox[{"XIn", ",", - SubscriptBox["x", "0"], ",", - SubscriptBox["L", "0"], ",", - SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ";"}], "*)"}]}], "\n", + RowBox[{"YOut", ",", " ", "\"\\""}], "]"}], ";"}], " ", + RowBox[{"(*", " ", + RowBox[{"Should", " ", "be", " ", "1.24375"}], " ", "*)"}]}], "\n", RowBox[{ RowBox[{"DeltaL", " ", "=", " ", RowBox[{ - SubscriptBox["\[Delta]", "in"], "[", + SubscriptBox["\[Delta]", "LiqX"], "[", RowBox[{"XIn", ",", + SubscriptBox["x", "0"], ",", + SubscriptBox["y", "0"], ",", + SubscriptBox["L", "0"], ",", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"], ",", SubscriptBox["\[Gamma]", "0"]}], "]"}]}], ";"}], "\n", - RowBox[{ - RowBox[{ - RowBox[{"Echo", "[", - RowBox[{ - RowBox[{"\[CurlyPhi]", "[", - RowBox[{ - RowBox[{ - SubscriptBox["x", "0"], "+", "XIn"}], ",", - RowBox[{ - SubscriptBox["y", "0"], "+", "YOut"}], ",", - RowBox[{ - SubscriptBox["L", "0"], "+", "DeltaL"}], ",", - SubscriptBox["K", "0"], ",", - SubscriptBox["\[Sigma]", "0"], ",", - SubscriptBox["\[Tau]", "0"]}], "]"}], ",", " ", - "\"\\""}], "]"}], ";"}], "\n"}], "\n", RowBox[{ RowBox[{"Echo", "[", RowBox[{ - RowBox[{"2", "/", - RowBox[{"(", - RowBox[{"YOut", "/", "XIn"}], ")"}]}], ",", " ", - "\"\<2/\!\(\*FractionBox[SubscriptBox[\(Y\), \(out\)], \ -SubscriptBox[\(X\), \(in\)]]\) = \>\""}], "]"}], ";"}], "\n", - RowBox[{ - RowBox[{"Echo", "[", - RowBox[{ - RowBox[{ - RowBox[{"(", - RowBox[{"YIn", "/", "XOut"}], ")"}], "/", "2"}], ",", " ", - "\"\<\!\(\*FractionBox[SubscriptBox[\(Y\), \(in\)], SubscriptBox[\(X\), \ -\(out\)]]\)/2 = \>\""}], "]"}], ";"}]}], "Code", + RowBox[{"\[CurlyPhi]", "[", + RowBox[{ + RowBox[{ + SubscriptBox["x", "0"], "+", "XIn"}], ",", + RowBox[{ + SubscriptBox["y", "0"], "+", "YOut"}], ",", + RowBox[{ + SubscriptBox["L", "0"], "+", "DeltaL"}], ",", + SubscriptBox["\[Mu]", "0"], ",", + SubscriptBox["\[Sigma]", "0"]}], "]"}], ",", " ", + "\"\\""}], "]"}], ";"}]}], "Code", CellChangeTimes->{{3.9173824881246443`*^9, 3.917382640107789*^9}, { - 3.917382703512905*^9, 3.917382797160448*^9}, {3.917382957143201*^9, - 3.9173829787289667`*^9}, {3.917383009866159*^9, 3.91738301413713*^9}, { - 3.9173830595966473`*^9, 3.9173830608297663`*^9}, {3.917383133177814*^9, - 3.917383139655548*^9}, {3.91738319090906*^9, 3.9173832152140627`*^9}, { - 3.917383329695533*^9, 3.9173833441047373`*^9}, {3.917383592136142*^9, - 3.917383601902347*^9}, {3.917383788771337*^9, 3.9173838368765507`*^9}, { - 3.917383998912529*^9, 3.917384002782464*^9}, {3.917384361112628*^9, - 3.917384432792912*^9}, {3.917384584058999*^9, 3.917384619281192*^9}, { - 3.9173846522116756`*^9, 3.9173846873539762`*^9}, {3.9173849883607492`*^9, - 3.917384990884163*^9}, {3.917385341574011*^9, 3.917385423584772*^9}}, + 3.917382703512905*^9, 3.917382797160448*^9}, {3.917382957143201*^9, + 3.9173829787289667`*^9}, {3.917383009866159*^9, 3.91738301413713*^9}, { + 3.9173830595966473`*^9, 3.9173830608297663`*^9}, {3.917383133177814*^9, + 3.917383139655548*^9}, {3.91738319090906*^9, 3.9173832152140627`*^9}, { + 3.917383329695533*^9, 3.9173833441047373`*^9}, {3.917383592136142*^9, + 3.917383601902347*^9}, {3.917383788771337*^9, 3.9173838368765507`*^9}, { + 3.917383998912529*^9, 3.917384002782464*^9}, {3.917384361112628*^9, + 3.917384432792912*^9}, {3.917384584058999*^9, 3.917384619281192*^9}, { + 3.9173846522116756`*^9, 3.9173846873539762`*^9}, {3.9173849883607492`*^9, + 3.917384990884163*^9}, {3.917385341574011*^9, 3.917385423584772*^9}, { + 3.918571382615984*^9, 3.918571412216847*^9}, {3.918571717856246*^9, + 3.918571718925044*^9}, {3.918571975672353*^9, 3.9185719781640577`*^9}, { + 3.918575850485878*^9, 3.918575871098755*^9}, {3.918580315169186*^9, + 3.9185803368583097`*^9}, {3.918582534732585*^9, 3.9185825771962633`*^9}, { + 3.918582688010583*^9, 3.9185826955344*^9}, {3.918582731539423*^9, + 3.9185827367343893`*^9}, {3.918582864604357*^9, 3.918582868781686*^9}, { + 3.918583482655109*^9, 3.918583500351995*^9}, 3.9185843702651167`*^9, { + 3.918584645054994*^9, 3.9185846751565027`*^9}, {3.918584720161016*^9, + 3.918584725365926*^9}, {3.918587956963675*^9, 3.918587962241294*^9}, + 3.918589138602861*^9, 3.9186320307912188`*^9, {3.9186331433380632`*^9, + 3.9186331543138247`*^9}, {3.9186468606918497`*^9, + 3.9186469067855988`*^9}, {3.918647072837221*^9, 3.918647073727294*^9}, { + 3.918647266809247*^9, 3.918647298407833*^9}}, CellLabel-> - "In[789]:=",ExpressionUUID->"2687c350-1150-4951-bcf0-28364fa5bf73"], + "In[4199]:=",ExpressionUUID->"2687c350-1150-4951-bcf0-28364fa5bf73"], Cell[CellGroupData[{ @@ -939,55 +983,35 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"XOut = \"\>", "EchoLabel"], " ", - RowBox[{"-", "4.981498792389971`"}]}]], "Echo", + RowBox[{"-", "1.3266667127609253`"}]}]], "Echo", CellChangeTimes->{ - 3.91738542395758*^9},ExpressionUUID->"1aea5154-7487-4053-9b87-eaebfcd6471a"], + 3.9186472988237343`*^9},ExpressionUUID->"27baf199-5392-4622-872b-\ +c04b2522ee2d"], Cell[BoxData[ RowBox[{ TagBox["\<\"Validation = \"\>", - "EchoLabel"], " ", "0.`"}]], "Echo", + "EchoLabel"], " ", + RowBox[{"-", "2.220446049250313`*^-16"}]}]], "Echo", CellChangeTimes->{ - 3.917385423988958*^9},ExpressionUUID->"a705af7b-dd8d-4843-9013-\ -b64731e90a11"], + 3.91864729885005*^9},ExpressionUUID->"eecd11fc-1f1d-4de9-9e4a-07d53c8e0fbb"], Cell[BoxData[ RowBox[{ TagBox["\<\"YOut = \"\>", "EchoLabel"], " ", - RowBox[{"-", "19.900212359436182`"}]}]], "Echo", + RowBox[{"-", "0.7462499886751175`"}]}]], "Echo", CellChangeTimes->{ - 3.917385423997478*^9},ExpressionUUID->"d4db3b60-bed3-4a41-b647-\ -914ae220d498"], + 3.91864729885777*^9},ExpressionUUID->"292d880d-854e-49ac-80b7-b67aa90a72e5"], Cell[BoxData[ RowBox[{ TagBox["\<\"Validation = \"\>", "EchoLabel"], " ", - RowBox[{"-", "1.1102230246251565`*^-16"}]}]], "Echo", + RowBox[{"-", "2.220446049250313`*^-16"}]}]], "Echo", CellChangeTimes->{ - 3.917385424017386*^9},ExpressionUUID->"66263894-11e5-431a-bd4e-\ -56e199c15a5b"], - -Cell[BoxData[ - RowBox[{ - TagBox["\<\"2/\\!\\(\\*FractionBox[SubscriptBox[\\(Y\\), \\(out\\)], \ -SubscriptBox[\\(X\\), \\(in\\)]]\\) = \"\>", - "EchoLabel"], " ", - RowBox[{"-", "1.0050144007893715`"}]}]], "Echo", - CellChangeTimes->{ - 3.9173854240261383`*^9},ExpressionUUID->"77e6086f-c8ed-4881-ac7b-\ -1121513e1951"], - -Cell[BoxData[ - RowBox[{ - TagBox["\<\"\\!\\(\\*FractionBox[SubscriptBox[\\(Y\\), \\(in\\)], \ -SubscriptBox[\\(X\\), \\(out\\)]]\\)/2 = \"\>", - "EchoLabel"], " ", - RowBox[{"-", "1.0037139841604084`"}]}]], "Echo", - CellChangeTimes->{ - 3.9173854240418663`*^9},ExpressionUUID->"35ae76a0-b666-481e-9dfe-\ -b6888da9c15f"] + 3.9186472988780203`*^9},ExpressionUUID->"38d83234-0ac4-4733-b57c-\ +347036548a09"] }, Open ]] }, Open ]] }, Open ]] @@ -1022,14 +1046,12 @@ Cell[TextData[{ "We will need the marginal price ", Cell[BoxData[ FormBox[ - SubscriptBox["P", "M"], TraditionalForm]], - FormatType->TraditionalForm,ExpressionUUID-> + SubscriptBox["P", "M"], TraditionalForm]],ExpressionUUID-> "17089434-c32f-45ea-a26f-0d3ed9139695"], " of a swap to compute optimal arbitrages and a profit calculation ", Cell[BoxData[ FormBox[ - SubscriptBox["V", "A"], TraditionalForm]], - FormatType->TraditionalForm,ExpressionUUID-> + SubscriptBox["V", "A"], TraditionalForm]],ExpressionUUID-> "72aada08-6991-4530-9774-3dd0a302c916"] }], "Subsubsection", CellChangeTimes->{{3.9113884927083406`*^9, 3.911388517540121*^9}, { @@ -1057,7 +1079,7 @@ Cell[BoxData[{ 3.911408038142099*^9, 3.9114080663589067`*^9}, {3.9114081240293818`*^9, 3.91140812426967*^9}}, CellLabel-> - "In[616]:=",ExpressionUUID->"fadd5b7c-a968-401d-9e42-d6ca30b3a2a6"] + "In[2448]:=",ExpressionUUID->"fadd5b7c-a968-401d-9e42-d6ca30b3a2a6"] }, Open ]], Cell[CellGroupData[{ @@ -1089,7 +1111,7 @@ Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ - SubscriptBox["S", "ext"], " ", "=", " ", "1.8"}], ";", " ", + SubscriptBox["S", "ext"], " ", "=", " ", ".70"}], ";", " ", RowBox[{"Assert", "[", RowBox[{ SubscriptBox["S", "ext"], " ", "<", " ", @@ -1407,45 +1429,45 @@ Cell[BoxData[{ 3.91675072235946*^9, 3.916750736241868*^9}, {3.916750835562142*^9, 3.916750853604291*^9}, {3.916933983207768*^9, 3.916933985584363*^9}, { 3.916934589170532*^9, 3.916934742188787*^9}, {3.91738501952264*^9, - 3.917385025286654*^9}}, + 3.917385025286654*^9}, {3.918585613443736*^9, 3.918585616419739*^9}}, CellLabel-> - "In[618]:=",ExpressionUUID->"6bec84e7-f813-4bb5-9a1e-8a3d86e897da"], + "In[2450]:=",ExpressionUUID->"6bec84e7-f813-4bb5-9a1e-8a3d86e897da"], Cell[BoxData[ GraphicsBox[{{{}, {}, TagBox[ {RGBColor[0.368417, 0.506779, 0.709798], AbsoluteThickness[1.6], Opacity[ 1.], LineBox[CompressedData[" -1:eJwV0Gs0lAkAxvESOiI5mlxmdOHgoLK2mi5qPdJUW2or5JZby+5QCTXROq6t -SqEMM0ajUeZVZCUjxWjRNC69SsIJSQw1lcuYSC5F1n54zv/L8+ln/HuI0x8q -8+bN2z+3/yscELMaL/5sp8t3E+Z6a9odU1n2uISig5M6xzNXGvXbjRtEFl+l -rMKTZ8Y5n2hTdttyCy1iKDZgWkaLn9M00NNfG3CGYo9tHQWTlTRDiJJbVMIo -B5F/TzJdSrMEtbuj+STFD660lD13aVvwQt1LHEwJBb1ZdwFB2wNK736PFEkc -Ij4zvvZZeiJsXdY7NXkiOjgti+NC/LGClaRoCkmFIuKo2oqCIHwLOzpbKOWA -+2OTuYIeiiJLbYOsxkycC46yXeJ9Gm6qrbsMrQVIu8vhV9eHIytRX49SeRPd -B1+6R5hEYmLQRsu0SojYVXRd1o5ovPBzXRw1kAueTKYy6xwH9rqP7K6R2zCp -X1b1Z388QgXSMDVlPux9VxW3hP+NBsNCr3D9fzDcIxOrmp+HzpfZBiX1LqTj -j9Q9yy+g+a0vQ7TnHkzH+TOsE4loLz6fvLysGPp5wfM5BpexzZhd/uGhCOuH -bRrb8pLgzTcZcH5egqnlFyq63VPwVRLkvbPpPprfxd9fpLgCx9GNbZ0fS2FA -jt2LPpQKa+WdKJfvD6D/l5f5WQs2LvBbApymH4LOcpSrjrBx/bd4pzHdcmT4 -B4lPN6TBQiSPp+qLsTRba5LFTYeDTNltqlcBb1EP/6wXB4YGcdtbrR7hfbme -js8GLpg/auVqa/9FpKbEpm2Gi9MK9tUuRiWOOPUO/dSRAa07C5g8typQTtlO -JhXxQF26Oq7NrRp9XVdGIsMz8cXhRFPXxscY2qri4HjgGjitgtjU8sfQ++Au -LDLkI2qvcNfDTRLMBhZzKTI+pLVBOkUSCTbLkgRHyrKw00DrO9PhCS4KF43T -467DLCTs05fGJ9DzYKwZ8RDAXiAa335QijpP61cwy4ZQVENTeSnFXnqOFXso -G/4N/B0czxqoqvZSpTU34FvhmPzpTQ2U2qG+jN03UVFU3a4dWItJrrM/r/Qm -vC6p2+aN1IKp8a1kcGUOtmy1qJx/qg4BJi0zGgk5YI1o7bCeqcNluot75ucc -DMQ87zeKrceGkwuqPx8WIm/UJy/6Rz0c0wPT94qFkB4rZRYnPkVCCc2VYkaA -WvH+11saJBgTgTvzLxGYiValyjVJ9I31eAclEZBtNx001SYRPeoYbpVC4Dbp -n5KrS6JMoZZXmEpg/eu+ZoJGYnXA1EIRj8C+SZmncC0JnUOd9eJbBKI3vj1x -4xCJjwVpeCYh4Pdt+pceZxLxFvddk6UEGFVGS1a6zv3NyeD9tQQW7fISZXuS -2Gf8KqvpKYGMw2++CvxJ1PECJ1qbCBSxXsdcP0PiQQK7sOstAfbmqQNdESRc -zi2UCnoIsKYNjI0iSShjQ1/79BKwTXCXZsWQMPtuqt77nkB9evvCrIskeGGa -vvJBAgVuEx2dl0jQQ6zO3FYQuELTL6Amk2gZQhJTScCFcN3HTyWhFbi7rH+U -wCZm+PLONBL5ctvGgrE5v9UZw4ZcEvb+pu+Oj8/5DT+o9uCRkPupTK2ZnPMr -eZV67RqJsz7t2sNTBP4DDMpfbg== +1:eJwV0Ws01AkABXDklayUKWOijaOTOB5bK1ZxPUqiFCrPQliPEqMhMV7/VVGE +Etswq8Wiklc1ixAG46+EVDImJBKSsKi8Vh/uud/uh99VPhVg6yUiJCR0aCU/ +Onu0gtF6+Rej4nC9wE9X1Gr8RDbUllFkobFYnz4z0mw0Sw0rSaJsgZKozYz4 +oS6jPbmFapEUHaRJUHOTPgwb9Y00egZTjLE/PnzermfOqDThhQidcgQalprb +OG0SoPW+6ThLccMVdXHD4V55PBd3qfCnBOI5a4q33L0NlHeHHBProiEYvqkd +90of9B0Z78WG4qD0VJceG2SKzYyr420ByZDo8mK7u1jgO919uZCbit/9C/kC +njWKtstQM1r/BL+Jt/Wuuy3sRTvNFbTYMMps+PAw6xgy4uQ3Uqpvgyqtuk6m +zQFzYzrSqjXZeFFrc0yX54znbsd/Yo7mor1SKnt++SRSdgynCCbzMLxgIUoV +dkcgm0sXmyhA9IjhGcewU2hRKHQJkb8HXmioA0vOE7LTyy0TtPu4qM6yqU/x +Qsdb172lB4oxGincdkvbG10lFxOU/i2B/xZaTGiTD/Yop5R/4JTCeVDB+KSJ +H06wVEbtnpVBzsr1j3uC05ip8z2xr+0Btr+82gkXf1hN7XrNH36IgeXF/J75 +s9CauMM8Ov8InlXJDnqWgbjEeuFpu8DBVqk0jypJOjKtY2z/W18Oje01Okpd +dKiVDsXQ5CvA7HaMnUkPgmn/RK/qxkq46lgHDR09BwVqtEmn+mNccvBSmVRm +wHupcUhMswoD6744+Lxj4Nx4SpJgbzWyMtk2+SXBkL6zyjvdvgZTrTmDhswQ +0OQ0ol/bPwEzWWlJzuA8pk3PtAl21cJJtbJbVzIUqZ3sqOTyWjAPtOx2bg4F +0zLbnKNXB+0NO/Vfxl4At9FXtqiuDkplNbNuNmHYR5We9zath09/9W4x2XBs +DaB/nG6th3B/n+libziM2aWzJke4eBYY3K54m4ns0oZNIu1cGBR4fA04EQGP +FpZZqlMDPpUwBmrUI+FaaZXwsacBI5bfbC+MRqKy6EmXjE8jtDm3L9pVRsEl +Xtwgf7IRyx5H7lDMovHbbrVq4aAmXNKVsrPKjgZjUtpMa7EJdQGv3h5eHbPy +67MRxSgebgTxNVi+McifOpkfscRDRfOa/ZLNMeD6PfQuiWtG1GVrs7NaBGiV +gxb/rCbRL/NUZCmRwGKEKG1oDYkpJkuQl0Sg30R1TFWGxOoxX45zCoE80iMx +dz2JzTxJvwepBHZ2D3TkbCJxOsq8wzaDwMGv/U7ZmiTGJuqyHhcQiNj19kyW +DYn59vI9XlwCbt8XDPvsVvYQt/FjA4G9NYprfz5OQvK+/RdOEwEpc5fSv5xI +aMbP5ki2EEg71jPD9iARYvLrmsJ2AkWM7sjMYBJCZcXd4r0EUvS/HRacJ0HZ +EvXg7z4CjAWqsmIYCZVr1omn3hEwiHXgZkSS2O83blw+SIB3o0si4zIJQkWj +wHmMwF37uTf8eBJJyd9jRMcJXNskf5eWQIK9RDpXfCZwNOf4QVYyicd8n7Vz +kwT0vEOU+NdJvLbQHymeXvHTSPuscJPEe44E129mxe/zoyeO6SQWVbsyV82t ++JW9Sr51i8TS9byQqq8E/gd1j1xk "]]}, - Annotation[#, "Charting`Private`Tag$57056#1"]& ]}, {}}, + Annotation[#, "Charting`Private`Tag$18998#1"]& ]}, {}}, AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948], Axes->{True, True}, AxesLabel->{None, None}, @@ -1477,7 +1499,7 @@ eZV67RqJsz7t2sNTBP4DDMpfbg== Part[#, 1]], (Identity[#]& )[ Part[#, 2]]}& )}}, - PlotRange->{{0, 0.2}, {0., 0.03901618891876252}}, + PlotRange->{{0, 0.2}, {-2.8571428571428568`*^-9, 0.009263489123279008}}, PlotRangeClipping->True, PlotRangePadding->{{ Scaled[0.02], @@ -1487,9 +1509,9 @@ eZV67RqJsz7t2sNTBP4DDMpfbg== Ticks->{Automatic, Automatic}]], "Output", CellChangeTimes->{ 3.917383563255979*^9, 3.917384872931774*^9, {3.9173849757089787`*^9, - 3.9173850261946993`*^9}, 3.917385114645734*^9}, + 3.9173850261946993`*^9}, 3.917385114645734*^9, 3.918585617114811*^9}, CellLabel-> - "Out[620]=",ExpressionUUID->"88457644-f8dc-4649-adb3-9b54c9fd1c06"], + "Out[2452]=",ExpressionUUID->"ff2c3a54-a3b1-4be6-afbb-32094a16572f"], Cell[CellGroupData[{ @@ -1497,20 +1519,20 @@ Cell[BoxData[ RowBox[{ TagBox["\<\"The optimal amount of X to tender is: \\!\\(\\*SubscriptBox[\\(\ \[CapitalDelta]\\), \\(X\\)]\\) = \"\>", - "EchoLabel"], " ", "202.20119150794815`"}]], "Echo", + "EchoLabel"], " ", "6.230446865679352`*^7"}]], "Echo", CellChangeTimes->{ - 3.917385114735537*^9},ExpressionUUID->"d1f17eb9-1e3f-45fe-8a49-\ -8b9eefc03ffb"], + 3.918585617388137*^9},ExpressionUUID->"6c3d9d24-049c-4137-b7e3-\ +6cf83d94b59c"], Cell[BoxData[ RowBox[{ TagBox["\<\"The amount out is: \\!\\(\\*SubscriptBox[\\(\[CapitalDelta]\\), \ \\(Y\\)]\\) = \"\>", "EchoLabel"], " ", - RowBox[{"-", "383.25524969204025`"}]}]], "Echo", + RowBox[{"-", "4.51112226444927`*^7"}]}]], "Echo", CellChangeTimes->{ - 3.9173851147430677`*^9},ExpressionUUID->"62407cb0-a174-480a-8d16-\ -3a55f4b36678"], + 3.918585617396303*^9},ExpressionUUID->"255c6473-c036-4f07-8655-\ +af783da13368"], Cell[BoxData[ RowBox[{ @@ -1518,18 +1540,19 @@ Cell[BoxData[ \\(1\\)]\\),\\!\\(\\*SubscriptBox[\\(y\\), \\(1\\)]\\)) = \"\>", "EchoLabel"], " ", RowBox[{"{", - RowBox[{"1202.2011915079481`", ",", "1616.74475030796`"}], "}"}]}]], "Echo",\ - + RowBox[{"1.0623044686567935`*^9", ",", "7.409463578271984`*^7"}], + "}"}]}]], "Echo", CellChangeTimes->{ - 3.91738511476458*^9},ExpressionUUID->"d6ae3e9d-138a-4eac-9161-a39196238226"], + 3.9185856174259367`*^9},ExpressionUUID->"a6e336c8-67e3-4548-aec6-\ +53634d7b4e40"], Cell[BoxData[ RowBox[{ TagBox["\<\"The final price of the pool is: P = \"\>", - "EchoLabel"], " ", "1.8049533724284241`"}]], "Echo", + "EchoLabel"], " ", "0.7033820512261256`"}]], "Echo", CellChangeTimes->{ - 3.9173851147720413`*^9},ExpressionUUID->"a954a63c-1072-4dd1-a3b7-\ -6fea2ecdbf38"], + 3.918585617433468*^9},ExpressionUUID->"5f8a3663-d1c0-4227-93e2-\ +6e4110936aef"], Cell[BoxData[ RowBox[{ @@ -1543,21 +1566,19 @@ Cell[BoxData[ SuperscriptBox["\[ExponentialE]", RowBox[{ RowBox[{"-", - FractionBox[ - RowBox[{ - SuperscriptBox["\[Sigma]", "2"], " ", "\[Tau]"}], "2"]}], - "+", - RowBox[{ - SqrtBox["2"], " ", "\[Sigma]", " ", - SqrtBox["\[Tau]"], " ", - RowBox[{"InverseErfc", "[", - FractionBox[ - RowBox[{"2", " ", - RowBox[{"(", + FractionBox["1", "2"]}], " ", "\[Sigma]", " ", + RowBox[{"(", + RowBox[{"\[Sigma]", "-", + RowBox[{"2", " ", + SqrtBox["2"], " ", + RowBox[{"InverseErfc", "[", + FractionBox[ + RowBox[{"2", " ", + RowBox[{"(", RowBox[{"v", "+", "x"}], ")"}]}], - RowBox[{"L", "+", "v", "-", - RowBox[{"v", " ", "\[Gamma]"}]}]], "]"}]}]}]], " ", "K", - " ", + RowBox[{"L", "+", "v", "-", + RowBox[{"v", " ", "\[Gamma]"}]}]], "]"}]}]}], ")"}]}]], + " ", "K", " ", RowBox[{"(", RowBox[{"L", "+", RowBox[{"x", " ", @@ -1574,9 +1595,7 @@ Cell[BoxData[ RowBox[{"-", "1"}], "+", "\[Gamma]"}], ")"}], " ", RowBox[{"Erfc", "[", RowBox[{ - FractionBox[ - RowBox[{"\[Sigma]", " ", - SqrtBox["\[Tau]"]}], + FractionBox["\[Sigma]", SqrtBox["2"]], "-", RowBox[{"InverseErfc", "[", FractionBox[ @@ -1592,7 +1611,8 @@ Cell[BoxData[ RowBox[{"v", " ", "\[Gamma]"}]}]], "\[LessEqual]", "1"}]}, "ConditionalExpression"]}]], "Echo", CellChangeTimes->{ - 3.91738511509683*^9},ExpressionUUID->"fca08186-95ea-4887-8401-ad9d766f2ded"] + 3.918585617718585*^9},ExpressionUUID->"8b3d5769-45e4-45af-b1b7-\ +284acb1d88ab"] }, Open ]] }, Open ]] }, Open ]] @@ -1611,8 +1631,7 @@ Cell[TextData[{ "Let ", Cell[BoxData[ FormBox[ - SubscriptBox["O", "Y"], TraditionalForm]], - FormatType->TraditionalForm,ExpressionUUID-> + SubscriptBox["O", "Y"], TraditionalForm]],ExpressionUUID-> "daf8aba3-0522-4fdc-b0f6-095c37f44dc7"], " be the optimal amount of Y token to tender to get max arbitrage profit." }], "Subsubsection", @@ -2140,8 +2159,8 @@ f3028622cb8d"] }, Open ]] }, Open ]] }, -WindowSize->{823, 1233}, -WindowMargins->{{Automatic, 12}, {-819, Automatic}}, +WindowSize->{2125, 2083}, +WindowMargins->{{Automatic, 1157}, {Automatic, -819}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, FrontEndVersion->"13.2 for Mac OS X ARM (64-bit) (January 31, 2023)", @@ -2161,152 +2180,149 @@ CellTagsIndex->{} (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ -Cell[422, 15, 185, 3, 238, "Title",ExpressionUUID->"2003d08a-fff7-4f74-8623-7a0823c9cafa"], +Cell[422, 15, 185, 3, 194, "Title",ExpressionUUID->"2003d08a-fff7-4f74-8623-7a0823c9cafa"], Cell[CellGroupData[{ -Cell[632, 22, 221, 5, 158, "Section",ExpressionUUID->"514be430-48c5-4dc6-92af-6b1c3a5b8586"], +Cell[632, 22, 221, 5, 134, "Section",ExpressionUUID->"514be430-48c5-4dc6-92af-6b1c3a5b8586"], Cell[CellGroupData[{ -Cell[878, 31, 222, 5, 122, "Subsection",ExpressionUUID->"f16f1652-ed41-4414-8c9b-6b6d5d8061ac"], -Cell[1103, 38, 578, 14, 54, "Code",ExpressionUUID->"8255c47c-fa0b-4fdd-8638-752453aca613"] +Cell[878, 31, 222, 5, 107, "Subsection",ExpressionUUID->"f16f1652-ed41-4414-8c9b-6b6d5d8061ac"], +Cell[1103, 38, 579, 14, 69, "Code",ExpressionUUID->"8255c47c-fa0b-4fdd-8638-752453aca613"] }, Open ]], Cell[CellGroupData[{ -Cell[1718, 57, 202, 3, 81, "Subsection",ExpressionUUID->"b3dd161e-0b53-4183-b30c-be7844f26477"], -Cell[1923, 62, 808, 19, 86, "Code",ExpressionUUID->"25d6c1c4-f902-41e0-8746-c63f6b03d94e"] +Cell[1719, 57, 202, 3, 107, "Subsection",ExpressionUUID->"b3dd161e-0b53-4183-b30c-be7844f26477"], +Cell[1924, 62, 809, 19, 111, "Code",ExpressionUUID->"25d6c1c4-f902-41e0-8746-c63f6b03d94e"] }, Open ]], Cell[CellGroupData[{ -Cell[2768, 86, 307, 7, 122, "Subsection",ExpressionUUID->"f601d02f-f91e-4780-a166-a78097a54f48"], -Cell[3078, 95, 1093, 33, 161, "Code",ExpressionUUID->"d5d16a82-3e60-44ff-affc-b50eb9144304"] +Cell[2770, 86, 307, 7, 107, "Subsection",ExpressionUUID->"f601d02f-f91e-4780-a166-a78097a54f48"], +Cell[3080, 95, 978, 27, 205, "Code",ExpressionUUID->"d5d16a82-3e60-44ff-affc-b50eb9144304"] }, Open ]], Cell[CellGroupData[{ -Cell[4208, 133, 296, 7, 122, "Subsection",ExpressionUUID->"009a24ad-ebe5-4d73-bdda-a7839592332a"], +Cell[4095, 127, 296, 7, 107, "Subsection",ExpressionUUID->"009a24ad-ebe5-4d73-bdda-a7839592332a"], Cell[CellGroupData[{ -Cell[4529, 144, 244, 6, 106, "Subsubsection",ExpressionUUID->"3b15f5e3-f420-4095-899a-506c7286cc40"], -Cell[4776, 152, 2312, 63, 192, "Code",ExpressionUUID->"3950a1e9-9c32-45c4-b5ef-404c37d6ef65"] +Cell[4416, 138, 244, 6, 89, "Subsubsection",ExpressionUUID->"3b15f5e3-f420-4095-899a-506c7286cc40"], +Cell[4663, 146, 2208, 59, 244, "Code",ExpressionUUID->"3950a1e9-9c32-45c4-b5ef-404c37d6ef65"] }, Open ]], Cell[CellGroupData[{ -Cell[7125, 220, 253, 6, 106, "Subsubsection",ExpressionUUID->"6228385e-cfd2-4bd0-97f4-58c98a5a994e"], -Cell[7381, 228, 1219, 36, 123, "Code",ExpressionUUID->"cdbca2c9-2426-4adf-8516-6c22e3b352b1"] +Cell[6908, 210, 253, 6, 89, "Subsubsection",ExpressionUUID->"6228385e-cfd2-4bd0-97f4-58c98a5a994e"], +Cell[7164, 218, 1228, 36, 159, "Code",ExpressionUUID->"cdbca2c9-2426-4adf-8516-6c22e3b352b1"] }, Open ]], Cell[CellGroupData[{ -Cell[8637, 269, 186, 3, 67, "Subsubsection",ExpressionUUID->"18015876-38da-4fa9-82b7-a417d745ef90"], -Cell[8826, 274, 685, 19, 68, "Code",ExpressionUUID->"a65cb5ec-cdac-40e0-bb49-f3d8157592d9"] +Cell[8429, 259, 186, 3, 89, "Subsubsection",ExpressionUUID->"18015876-38da-4fa9-82b7-a417d745ef90"], +Cell[8618, 264, 649, 16, 90, "Code",ExpressionUUID->"a65cb5ec-cdac-40e0-bb49-f3d8157592d9"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[9572, 300, 285, 7, 158, "Section",ExpressionUUID->"da815218-0c74-4720-a5c9-76f45781c5e2"], +Cell[9328, 287, 285, 7, 134, "Section",ExpressionUUID->"da815218-0c74-4720-a5c9-76f45781c5e2"], Cell[CellGroupData[{ -Cell[9882, 311, 305, 7, 122, "Subsection",ExpressionUUID->"d461a415-44ca-4804-8248-6137a0f9449f"], +Cell[9638, 298, 305, 7, 107, "Subsection",ExpressionUUID->"d461a415-44ca-4804-8248-6137a0f9449f"], Cell[CellGroupData[{ -Cell[10212, 322, 2432, 60, 146, "Code",ExpressionUUID->"8d262a91-37a1-41fb-b1b3-ae8191b1ccda"], +Cell[9968, 309, 2677, 52, 134, "Code",ExpressionUUID->"8d262a91-37a1-41fb-b1b3-ae8191b1ccda"], Cell[CellGroupData[{ -Cell[12669, 386, 230, 6, 38, "Echo",ExpressionUUID->"af988e57-d45b-493e-8c77-aeb0d6754a04"], -Cell[12902, 394, 258, 7, 53, "Echo",ExpressionUUID->"7cbb943d-e136-42be-b7bf-17128b81f7f7"], -Cell[13163, 403, 235, 6, 38, "Echo",ExpressionUUID->"35bc58ee-e40e-4bf3-9e9f-061ba0d278fb"], -Cell[13401, 411, 242, 6, 38, "Echo",ExpressionUUID->"e144304b-6b21-4799-ac3b-3fa33013028a"] +Cell[12670, 365, 232, 6, 50, "Echo",ExpressionUUID->"63fa2685-ead2-42c3-8894-aa3d0f759278"], +Cell[12905, 373, 258, 7, 68, "Echo",ExpressionUUID->"ab767d72-08f9-45a3-8d7a-62a93aac3a75"], +Cell[13166, 382, 242, 6, 50, "Echo",ExpressionUUID->"865ae55a-ba52-403c-9134-dd94b3a70090"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[13704, 424, 307, 7, 122, "Subsection",ExpressionUUID->"a6874bc0-590c-4cb3-9d20-f010a014a154"], +Cell[13469, 395, 307, 7, 107, "Subsection",ExpressionUUID->"a6874bc0-590c-4cb3-9d20-f010a014a154"], Cell[CellGroupData[{ -Cell[14036, 435, 1157, 29, 86, "Code",ExpressionUUID->"085ca656-cc94-43cf-a8c6-c116e23e4910"], +Cell[13801, 406, 2471, 46, 111, "Code",ExpressionUUID->"085ca656-cc94-43cf-a8c6-c116e23e4910"], Cell[CellGroupData[{ -Cell[15218, 468, 271, 7, 38, "Echo",ExpressionUUID->"b0609413-5fee-4b86-aed9-380cc72ca5ad"], -Cell[15492, 477, 230, 6, 38, "Echo",ExpressionUUID->"0d8deb13-fecc-40d5-b792-e5be624a621e"] +Cell[16297, 456, 275, 7, 50, "Echo",ExpressionUUID->"d46f0b65-6c97-4fd7-a377-fd814b863b4a"], +Cell[16575, 465, 234, 6, 50, "Echo",ExpressionUUID->"d830d4bf-eeeb-4bb6-a004-32188869cd46"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[15771, 489, 251, 6, 106, "Subsubsection",ExpressionUUID->"d0f44536-b00f-4974-8c75-dd65dd319645"], +Cell[16858, 477, 251, 6, 89, "Subsubsection",ExpressionUUID->"d0f44536-b00f-4974-8c75-dd65dd319645"], Cell[CellGroupData[{ -Cell[16047, 499, 1719, 46, 86, "Code",ExpressionUUID->"57112165-db6f-447c-9713-f9c85c6d4828"], +Cell[17134, 487, 1744, 46, 111, "Code",ExpressionUUID->"57112165-db6f-447c-9713-f9c85c6d4828"], Cell[CellGroupData[{ -Cell[17791, 549, 304, 7, 38, "Echo",ExpressionUUID->"4fd65137-02a9-41b3-ba18-0ebf41cc4e36"], -Cell[18098, 558, 314, 8, 38, "Echo",ExpressionUUID->"21eb62ab-27a6-41dd-a389-5142ff75a033"] +Cell[18903, 537, 279, 7, 50, "Echo",ExpressionUUID->"d45d2202-bcd3-4d72-9040-061ec9d3b3fd"], +Cell[19185, 546, 287, 7, 50, "Echo",ExpressionUUID->"7f4698d3-1c35-46e4-b14b-549da3ca9c05"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[18473, 573, 224, 4, 67, "Subsubsection",ExpressionUUID->"0dabba71-0908-48dd-b11c-9fc06ac2d79b"], +Cell[19533, 560, 224, 4, 89, "Subsubsection",ExpressionUUID->"0dabba71-0908-48dd-b11c-9fc06ac2d79b"], Cell[CellGroupData[{ -Cell[18722, 581, 1319, 37, 86, "Code",ExpressionUUID->"05df5500-1e66-49a9-afd7-256365f8b6dc"], -Cell[20044, 620, 211, 6, 38, "Echo",ExpressionUUID->"15c46bab-62f8-4c23-be66-af5cfc278ceb"] +Cell[19782, 568, 1307, 35, 111, "Code",ExpressionUUID->"05df5500-1e66-49a9-afd7-256365f8b6dc"], +Cell[21092, 605, 217, 6, 50, "Echo",ExpressionUUID->"2780423d-6264-4b5d-a5a5-68bad0b82ef8"] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[20304, 632, 284, 6, 106, "Subsubsection",ExpressionUUID->"6c78f375-83c5-40c5-a26f-9dfafb83427b"], -Cell[20591, 640, 1387, 43, 98, "Code",ExpressionUUID->"05cdeb1a-e1b0-40a7-af51-51ab9b75cc2e"] +Cell[21358, 617, 284, 6, 89, "Subsubsection",ExpressionUUID->"6c78f375-83c5-40c5-a26f-9dfafb83427b"], +Cell[21645, 625, 1409, 42, 128, "Code",ExpressionUUID->"05cdeb1a-e1b0-40a7-af51-51ab9b75cc2e"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[22039, 690, 155, 3, 101, "Section",ExpressionUUID->"e0558e89-2c12-471a-af64-7b6a1457eb4d"], +Cell[23115, 674, 155, 3, 134, "Section",ExpressionUUID->"e0558e89-2c12-471a-af64-7b6a1457eb4d"], Cell[CellGroupData[{ -Cell[22219, 697, 290, 7, 122, "Subsection",ExpressionUUID->"2f7348b3-443c-4a22-943e-943b7962999e"], -Cell[22512, 706, 3602, 93, 214, "Code",ExpressionUUID->"0716117c-5381-46be-8b57-f2cefa727879"], +Cell[23295, 681, 290, 7, 107, "Subsection",ExpressionUUID->"2f7348b3-443c-4a22-943e-943b7962999e"], +Cell[23588, 690, 8190, 168, 362, "Code",ExpressionUUID->"0716117c-5381-46be-8b57-f2cefa727879"], Cell[CellGroupData[{ -Cell[26139, 803, 4710, 130, 602, "Code",ExpressionUUID->"2687c350-1150-4951-bcf0-28364fa5bf73"], +Cell[31803, 862, 4800, 115, 486, "Code",ExpressionUUID->"2687c350-1150-4951-bcf0-28364fa5bf73"], Cell[CellGroupData[{ -Cell[30874, 937, 224, 6, 38, "Echo",ExpressionUUID->"1aea5154-7487-4053-9b87-eaebfcd6471a"], -Cell[31101, 945, 200, 6, 38, "Echo",ExpressionUUID->"a705af7b-dd8d-4843-9013-b64731e90a11"], -Cell[31304, 953, 228, 7, 38, "Echo",ExpressionUUID->"d4db3b60-bed3-4a41-b647-914ae220d498"], -Cell[31535, 962, 239, 7, 38, "Echo",ExpressionUUID->"66263894-11e5-431a-bd4e-56e199c15a5b"], -Cell[31777, 971, 320, 8, 63, "Echo",ExpressionUUID->"77e6086f-c8ed-4881-ac7b-1121513e1951"], -Cell[32100, 981, 320, 8, 63, "Echo",ExpressionUUID->"35ae76a0-b666-481e-9dfe-b6888da9c15f"] +Cell[36628, 981, 230, 7, 50, "Echo",ExpressionUUID->"27baf199-5392-4622-872b-c04b2522ee2d"], +Cell[36861, 990, 235, 6, 50, "Echo",ExpressionUUID->"eecd11fc-1f1d-4de9-9e4a-07d53c8e0fbb"], +Cell[37099, 998, 225, 6, 50, "Echo",ExpressionUUID->"292d880d-854e-49ac-80b7-b67aa90a72e5"], +Cell[37327, 1006, 240, 7, 50, "Echo",ExpressionUUID->"38d83234-0ac4-4733-b57c-347036548a09"] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[32493, 997, 204, 4, 101, "Section",ExpressionUUID->"65d2b88d-22b2-481a-935c-71bdce9f21f1"], -Cell[32700, 1003, 568, 13, 142, "Text",ExpressionUUID->"f20cba79-bbb2-4d1b-9349-a349e8b0b7a4"], +Cell[37640, 1021, 204, 4, 134, "Section",ExpressionUUID->"65d2b88d-22b2-481a-935c-71bdce9f21f1"], +Cell[37847, 1027, 568, 13, 107, "Text",ExpressionUUID->"f20cba79-bbb2-4d1b-9349-a349e8b0b7a4"], Cell[CellGroupData[{ -Cell[33293, 1020, 692, 17, 146, "Subsubsection",ExpressionUUID->"d7131855-64d1-451f-98f3-152b4aa9f3a5"], -Cell[33988, 1039, 684, 20, 107, "Code",ExpressionUUID->"fadd5b7c-a968-401d-9e42-d6ca30b3a2a6"] +Cell[38440, 1044, 630, 15, 89, "Subsubsection",ExpressionUUID->"d7131855-64d1-451f-98f3-152b4aa9f3a5"], +Cell[39073, 1061, 685, 20, 137, "Code",ExpressionUUID->"fadd5b7c-a968-401d-9e42-d6ca30b3a2a6"] }, Open ]], Cell[CellGroupData[{ -Cell[34709, 1064, 268, 4, 81, "Subsection",ExpressionUUID->"eed8b815-af5d-458f-8082-a956f0fb88b9"], +Cell[39795, 1086, 268, 4, 107, "Subsection",ExpressionUUID->"eed8b815-af5d-458f-8082-a956f0fb88b9"], Cell[CellGroupData[{ -Cell[35002, 1072, 460, 12, 107, "Subsubsection",ExpressionUUID->"b20dcf41-6dfe-404c-8167-50b070efca5f"], +Cell[40088, 1094, 460, 12, 89, "Subsubsection",ExpressionUUID->"b20dcf41-6dfe-404c-8167-50b070efca5f"], Cell[CellGroupData[{ -Cell[35487, 1088, 11721, 323, 698, "Code",ExpressionUUID->"6bec84e7-f813-4bb5-9a1e-8a3d86e897da"], -Cell[47211, 1413, 3524, 78, 342, "Output",ExpressionUUID->"88457644-f8dc-4649-adb3-9b54c9fd1c06"], +Cell[40573, 1110, 11768, 323, 907, "Code",ExpressionUUID->"6bec84e7-f813-4bb5-9a1e-8a3d86e897da"], +Cell[52344, 1435, 3570, 78, 471, "Output",ExpressionUUID->"ff2c3a54-a3b1-4be6-afbb-32094a16572f"], Cell[CellGroupData[{ -Cell[50760, 1495, 302, 7, 38, "Echo",ExpressionUUID->"d1f17eb9-1e3f-45fe-8a49-8b9eefc03ffb"], -Cell[51065, 1504, 303, 8, 38, "Echo",ExpressionUUID->"62407cb0-a174-480a-8d16-3a55f4b36678"], -Cell[51371, 1514, 385, 9, 38, "Echo",ExpressionUUID->"d6ae3e9d-138a-4eac-9161-a39196238226"], -Cell[51759, 1525, 241, 6, 38, "Echo",ExpressionUUID->"a954a63c-1072-4dd1-a3b7-6fea2ecdbf38"], -Cell[52003, 1533, 2181, 61, 96, "Echo",ExpressionUUID->"fca08186-95ea-4887-8401-ad9d766f2ded"] +Cell[55939, 1517, 304, 7, 50, "Echo",ExpressionUUID->"6c3d9d24-049c-4137-b7e3-6cf83d94b59c"], +Cell[56246, 1526, 302, 8, 50, "Echo",ExpressionUUID->"255c6473-c036-4f07-8655-af783da13368"], +Cell[56551, 1536, 399, 10, 52, "Echo",ExpressionUUID->"a6e336c8-67e3-4548-aec6-53634d7b4e40"], +Cell[56953, 1548, 239, 6, 50, "Echo",ExpressionUUID->"5f8a3663-d1c0-4227-93e2-6e4110936aef"], +Cell[57195, 1556, 2090, 58, 241, "Echo",ExpressionUUID->"8b3d5769-45e4-45af-b1b7-284acb1d88ab"] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[54257, 1602, 171, 3, 81, "Subsection",ExpressionUUID->"d44a8cc6-b4f0-4204-b250-e68ad4e19d99"], +Cell[59358, 1622, 171, 3, 107, "Subsection",ExpressionUUID->"d44a8cc6-b4f0-4204-b250-e68ad4e19d99"], Cell[CellGroupData[{ -Cell[54453, 1609, 413, 11, 68, "Subsubsection",ExpressionUUID->"800e047e-b69c-4509-bda4-30799fa9a63e"], +Cell[59554, 1629, 382, 10, 89, "Subsubsection",ExpressionUUID->"800e047e-b69c-4509-bda4-30799fa9a63e"], Cell[CellGroupData[{ -Cell[54891, 1624, 7526, 215, 417, "Code",ExpressionUUID->"7ca95c98-841f-4a4d-8646-7ee5087c0cbe"], -Cell[62420, 1841, 3553, 78, 338, "Output",ExpressionUUID->"1f3d487e-7d60-4563-a2b3-f3aa65c1d146"], +Cell[59961, 1643, 7526, 215, 540, "Code",ExpressionUUID->"7ca95c98-841f-4a4d-8646-7ee5087c0cbe"], +Cell[67490, 1860, 3553, 78, 450, "Output",ExpressionUUID->"1f3d487e-7d60-4563-a2b3-f3aa65c1d146"], Cell[CellGroupData[{ -Cell[65998, 1923, 301, 7, 38, "Echo",ExpressionUUID->"20a8471e-d48d-4dc1-8a0f-2b45a51698ee"], -Cell[66302, 1932, 301, 8, 38, "Echo",ExpressionUUID->"5cd69ac1-3ee9-4f3c-b5cf-95d07eb0ff1c"], -Cell[66606, 1942, 391, 10, 38, "Echo",ExpressionUUID->"0834851c-ee77-4202-aa72-ad7a0f04c869"], -Cell[67000, 1954, 238, 6, 38, "Echo",ExpressionUUID->"e88a31f0-9ce3-43a8-a4fe-062f673969b4"], -Cell[67241, 1962, 2460, 70, 190, "Echo",ExpressionUUID->"24b12cbb-7a22-45fd-bb9e-d5824114ff9b"] +Cell[71068, 1942, 301, 7, 50, "Echo",ExpressionUUID->"20a8471e-d48d-4dc1-8a0f-2b45a51698ee"], +Cell[71372, 1951, 301, 8, 50, "Echo",ExpressionUUID->"5cd69ac1-3ee9-4f3c-b5cf-95d07eb0ff1c"], +Cell[71676, 1961, 391, 10, 50, "Echo",ExpressionUUID->"0834851c-ee77-4202-aa72-ad7a0f04c869"], +Cell[72070, 1973, 238, 6, 50, "Echo",ExpressionUUID->"e88a31f0-9ce3-43a8-a4fe-062f673969b4"], +Cell[72311, 1981, 2460, 70, 173, "Echo",ExpressionUUID->"24b12cbb-7a22-45fd-bb9e-d5824114ff9b"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ -Cell[69786, 2041, 164, 3, 101, "Section",ExpressionUUID->"b9760121-93f2-4105-bc65-e6b3dbe04aec"], +Cell[74856, 2060, 164, 3, 134, "Section",ExpressionUUID->"b9760121-93f2-4105-bc65-e6b3dbe04aec"], Cell[CellGroupData[{ -Cell[69975, 2048, 227, 5, 81, "Subsection",ExpressionUUID->"bf3ecf5a-6ea2-4f9a-a236-2d3956e9c134"], +Cell[75045, 2067, 227, 5, 108, "Subsection",ExpressionUUID->"bf3ecf5a-6ea2-4f9a-a236-2d3956e9c134"], Cell[CellGroupData[{ -Cell[70227, 2057, 2145, 57, 168, "Code",ExpressionUUID->"88153533-d3ba-42e3-8671-5c87d6eba466"], +Cell[75297, 2076, 2145, 57, 224, "Code",ExpressionUUID->"88153533-d3ba-42e3-8671-5c87d6eba466"], Cell[CellGroupData[{ -Cell[72397, 2118, 306, 8, 38, "Echo",ExpressionUUID->"9c86a598-6ad7-4cdc-b7d3-f17754fbb4f8"], -Cell[72706, 2128, 298, 7, 38, "Echo",ExpressionUUID->"edb1d49d-7246-436e-85d1-f3028622cb8d"] +Cell[77467, 2137, 306, 8, 50, "Echo",ExpressionUUID->"9c86a598-6ad7-4cdc-b7d3-f17754fbb4f8"], +Cell[77776, 2147, 298, 7, 50, "Echo",ExpressionUUID->"edb1d49d-7246-436e-85d1-f3028622cb8d"] }, Open ]] }, Open ]] }, Open ]]