File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1051,8 +1051,10 @@ fn success_probability(
10511051 // the amount, divided by the same integral from the minimum to the maximum liquidity
10521052 // bounds.
10531053 //
1054- // Because the integral is simply a constant times (x - 0.5)^3, this means we simply
1055- // subtract the two bounds mius 0.5 to the 3rd power.
1054+ // Because the integral from x to y is simply (y - 0.5)^3 - (x - 0.5)^3, we can
1055+ // calculate the cumulative density function between the min/max bounds trivially. Note
1056+ // that we don't bother to normalize the CDF to total to 1, as it will come out in the
1057+ // division of num / den.
10561058 let max_pow = ( max - 0.5 ) . powi ( 3 ) ;
10571059 let num = max_pow - ( amount - 0.5 ) . powi ( 3 ) ;
10581060 let den = max_pow - ( min - 0.5 ) . powi ( 3 ) ;
You can’t perform that action at this time.
0 commit comments