This snippet based on Binet's formula combined with fast power algorithm. Four multiplications run in parallel, thus processor with four cores recommended. Bitwise operators improve divisions and multiplications by pow of 2.
0 people like thisPosted: 4 years ago by Pavel Tatarintsev
Function, what calculates x^n by non-recursive basic exponentiation squaring algorithm. This method uses the bits of the exponent to determine computing powers. Generic parameter x suitable for any type what supports multiplication. I do not suppose existence of inverse operator like "/", thus parameter n must be a positive integer only. It is not difficult to define an extended variant for a type what supports division.
3 people like thisPosted: 4 years ago by Pavel Tatarintsev
A small set of operators for converting boolean expressions to an optional type on the principle of false -> None, true -> Some value.
0 people like thisPosted: 2 years ago by Pavel Tatarintsev
The random hyperharmonic series is the infinite series S = Sum(1,inf,d(i)/i^pow), where integer pow is greater than 1, and d(i) are independent, identically distributed random variables with property P(d(i)=0) = P(d(i)=1) = 0.5. Cumulative function F(x) = P(S < x) for even powers can be build by combination of analytical and numerical computations.
5 people like thisPosted: 4 years ago by Pavel Tatarintsev
Contains operations for working with 2-dimensional lists.
3 people like thisPosted: 3 years ago by Pavel Tatarintsev