You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+1-11
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Primitive Releases SolStat
2
2
3
-
SolStat is a Math library written in solidity for statistical function approximations. The library is composed of three core contracts; Bisection.sol, Gaussian.sol, and Invariant.sol. We will go over each of these contracts and their testing suites. We at Primitive use these contracts to support development with RMM-01s unique trading function, which utilizes the cumulative distribution function (CDF) of the normal distribution denoted by the greek capital letter Phi($\Phi$) in the literature [1,2]. You may recognize the normal or Gaussian distribution as the bell curve. This distribution is significant in modeling real-valued random numbers of unknown distributions. Within the RMM-01 trading function and options pricing, the CDF is used to model random price movement of a Markov process. Since price paths are commonly modeled with markovian proccesses, we believe that the greater community will find value in this library.
3
+
SolStat is a Math library written in solidity for statistical function approximations. The library is composed of two core libraries; Gaussian.sol, and Invariant.sol. We will go over each of these libraries and their testing suites. We at Primitive use these libraries to support development with RMM-01s unique trading function, which utilizes the cumulative distribution function (CDF) of the normal distribution denoted by the greek capital letter Phi($\Phi$) in the literature [1,2]. You may recognize the normal or Gaussian distribution as the bell curve. This distribution is significant in modeling real-valued random numbers of unknown distributions. Within the RMM-01 trading function and options pricing, the CDF is used to model random price movement of a Markov process. Since price paths are commonly modeled with markovian proccesses, we believe that the greater community will find value in this library.
4
4
5
5
## Irrational Functions
6
6
@@ -10,16 +10,6 @@ The primary reason for utilizing these approximation algorithms is that computer
10
10
11
11
In classical computing, our computational resources have become [abundant](https://en.wikipedia.org/wiki/Moore%27s_law), allowing us the liberty to iterate these algorithms to achieve our desired accuracy. However, the [Ethereum Virtual Machine (EVM)](https://ethereum.org/en/developers/docs/evm/) has a necessary monetary cost of computation. This computational environment has monetarily motivated developers to find efficient algorithms and hacks to reduce their applications' computational overhead (and thus the cost of computation).
12
12
13
-
## `Bisection.sol`
14
-
15
-
This contract contains the logic for the [bisection root finding algorithm](https://en.wikipedia.org/wiki/Bisection_method). This algorithm can be applied to any continuous function to help find its roots. Some square roots are not rational numbers, and thus we would like to be able to find a root within some preferred accuracy bound given our computational constraints. The algorithm works by specifying an interval known to contain the root, bisecting the interval, and then selecting the subinterval in which the function changes sign. In the implementation of this algorithm, the parameters are:
16
-
`ain` Initial value greater than root. (To the left of).
17
-
`bin` Initial value less than root. (To the right of).
18
-
`eps` The Error of the root computed compared to the actual root.
19
-
`max` The maximum number of iterations before exiting the loop.
20
-
`fx` Function to find the root of such that $f(x) = 0$.
21
-
The function returns a root solution within the error of `eps` to $f(x) = 0$. This method is robust, reliable, and runs in $O(log(n))$ time. There are known root-finding algorithms with faster convergence.
22
-
23
13
## `Gaussian.sol`
24
14
25
15
This contract implements a number of functions important to the gaussian distributions. Importantly all these implementations are only for a mean $\mu = 0$ and variance $\sigma = 1$. These implementations are based on the [Numerical Recipes](https://e-maxx.ru/bookz/files/numerical_recipes.pdf) textbook and its C implementation. [Numerical Recipes](https://e-maxx.ru/bookz/files/numerical_recipes.pdf) cites the original text by Abramowitz and Stegun, "[Handbook of Mathematical Functions](https://personal.math.ubc.ca/~cbm/aands/abramowitz_and_stegun.pdf)," which should be read to understand these unique functions and the implications of their numerical approximations. This implementation was also inspired by the [javascript Gausian library](https://github.com/errcw/gaussian), which implements the same algorithm.
0 commit comments