Mojo Scientific Library (MSL) v0.1.0 
Hello there! I am back again :). I am sharing the first release of MSL (Mojo Scientific Library), a comprehensive collection of scientific computation routines written in pure Mojo, derived from the GNU Scientific Library (GSL). It’s been a fun project to work on porting GSL routines has been a great way to learn the math behind numerical computing (people have come up with some crazy tricks over the years!). I think it’s now reached the point where it has enough routines to be genuinely useful, so I’m happy to share it here!
MSL is designed as the low-level scalar backend for SciJo (New release coming soon) and is now available on the modular-community channel.
Install
pixi add msl
Or use pixi-backend (checkout README for details).
What’s included in v0.1.0
There’s a lot of stuff packed in here!
- Special functions - Airy, Bessel (J/Y/I/K orders 0, 1, and integer n), Gamma, Beta, Error functions, Legendre polynomials, Digamma, Incomplete Gamma/Beta
- Numerical integration - Non-adaptive QNG (10→21→43→87-point), fixed Gauss-Kronrod rules (QK15–QK61), general adaptive QAG, and QAGS with Wynn epsilon extrapolation
- Numerical differentiation - Central (5-point), forward and backward (4-point) with automatic step refinement and separate truncation/rounding error estimates
- Interpolation - Piecewise linear, natural cubic spline, and Akima spline with eval/deriv/deriv2/integral
- Root-finding - Bisection, Brent’s method, Newton-Raphson, and secant
- Minimization - Brent’s method and golden section search
- ODE solvers - Classical RK4 (fixed step) and RKF45 (adaptive step with error control)
- Probability distributions - 14 distributions with samplers and PDFs: Gaussian, Uniform, Exponential, Gamma, Beta, Chi-squared, Poisson, Student-t, Log-normal, Weibull, Binomial, Negative Binomial, Cauchy, Laplace
- RNG - Mersenne Twister (MT19937) with an extensible
RNGAlgorithmtrait so you can plug in your own generator - Linear algebra -
VectorandMatrixwith math operations, BLAS Level 1/2/3 backed by mojoBLAS, and zero-copy non-owning views for interop with NuMojo NDArrays - Permutations - combinatorial permutation operations
Links
- GitHub: GitHub - mojomath/MSL: Mojo Scientific library (MSL) is a comprehensive collection of scientific computation routines derived from GNU Scientific Library (GSL) written in pure Mojo 🔥 · GitHub
- MojoMath org: mojomath · GitHub
MSL is now part of the MojoMath organisation alongside SciJo, StatMojo, and Matmojo. As always, contributions and feedback are very welcome! If there’s a routine you need, feel free to open an issue or PR! Happy computing!