SciRS2 Special
Production-ready special functions module for the SciRS2 scientific computing library (v0.1.5).
Following the SciRS2 POLICY, this module provides a comprehensive collection of special mathematical functions used in scientific computing, engineering, and statistics. Designed for performance, accuracy, reliability, and ecosystem consistency, it offers memory-safe implementations with extensive testing coverage (190+ unit tests, 164 doctests).
Production Status
โ Ready for production use - Version 0.1.0 (SciRS2 POLICY & Enhanced Performance)
- Zero warnings build with full clippy compliance
- Comprehensive test coverage with property-based validation
- Memory-safe implementations with proper error handling
- 32 working examples demonstrating all function families
Features
Core Mathematical Functions (Production Ready)
- ๐ฅ Gamma Functions: Complete gamma function family with complex support
- ๐ Error Functions: erf, erfc, inverse variants with high precision
- ๐ Bessel Functions: J, Y, I, K variants including spherical forms
- ๐ฏ Elliptic Functions: Complete/incomplete integrals, Jacobi functions
- ๐ Orthogonal Polynomials: Legendre, Chebyshev, Hermite, Laguerre families
- ๐ Spherical Harmonics: Real and complex with proper normalization
- โก Airy Functions: Ai, Bi and derivatives with complex support
- ๐ฌ Hypergeometric Functions: 1F1, 2F1 with robust convergence
- ๐ต Mathieu Functions: Complete implementation with Fourier coefficients
- ๐งฎ Zeta Functions: Riemann, Hurwitz, and Dirichlet eta functions
- ๐ Lambert W Function: Real and complex branches
- ๐ Kelvin Functions: ber, bei, ker, kei and their derivatives
- ๐ก Struve Functions: H and L variants with asymptotic expansions
- ๐ Fresnel Integrals: S(x) and C(x) for optical applications
- ๐ Parabolic Cylinder Functions: Weber functions with scaling
- โญ Wright Functions: Wright Omega and Bessel generalizations
- ๐ฌ Coulomb Functions: Quantum mechanical wave functions
- ๐ Logarithmic Integral: Li(x) and exponential integrals
Advanced Capabilities
- ๐ Vectorized Operations: Efficient array processing with ndarray
- ๐ข Complex Number Support: Full complex arithmetic where applicable
- ๐ Statistical Functions: Logistic, softmax, logsumexp with numerical stability
- ๐งช Combinatorial Functions: Factorials, binomial coefficients, Stirling numbers
- โก Performance Optimized: Lookup tables and efficient algorithms
- ๐ Memory Safe: Zero-cost abstractions with Rust's safety guarantees
Installation
Add this production-ready crate to your Cargo.toml:
[]
= "0.1.5"
Recommended Configuration
For optimal performance in production applications:
[]
= { = "0.1.5", = ["parallel"] }
Available Features
parallel: Enable parallel processing for large arrays using Rayonsimd: Enable SIMD optimizations through scirs2-coregpu: Experimental GPU acceleration (WebGPU backend)lazy: Lazy evaluation for improved memory efficiency
Usage
Basic usage examples:
use ;
use CoreResult;
// Gamma and related functions
// Error function and related functions
// Bessel functions
// Elliptic functions
// Orthogonal polynomials
// Airy functions
// Hypergeometric functions
Components
Gamma Functions
Gamma and related functions:
use ;
Error Functions
Error function and variants:
use ;
Bessel Functions
Bessel and related functions:
use ;
Elliptic Functions
Elliptic integrals and related functions:
use ;
Orthogonal Polynomials
Various orthogonal polynomials:
use ;
Spherical Harmonics
Spherical harmonic functions:
use ;
Airy Functions
Airy functions and their derivatives:
use ;
Hypergeometric Functions
Various hypergeometric functions:
use ;
Mathieu Functions
Solutions to Mathieu's differential equation:
use ;
Zeta Functions
Zeta and related functions:
use ;
Testing & Reliability
Comprehensive Test Coverage
This production release includes extensive validation:
- 190 unit tests covering all mathematical functions
- 164 doctests ensuring API documentation accuracy
- 7 integration tests validating complex workflows
- Property-based testing for mathematical identities
- Edge case validation for extreme parameter values
- Numerical stability analysis for critical functions
Quality Assurance
- โ Zero warnings from cargo clippy (strict mode)
- โ Memory safety guaranteed by Rust's type system
- โ Deterministic behavior with reproducible results
- โ Error handling with descriptive Result types
- โ Performance benchmarks for regression detection
Examples
The module includes 32 working examples in the examples/ directory:
Core Functions
get_values.rs: Basic usage of various special functionsgamma_functions.rs: Complete gamma function familybessel_functions.rs: All Bessel function variantserror_functions.rs: Error function family with complex support
Advanced Applications
airy_functions.rs: Quantum mechanics and optics applicationselliptic_functions.rs: Complete elliptic integral toolkithypergeometric_functions.rs: Series solutions and special casesmathieu_functions.rs: Periodic solutions and Fourier analysisspherical_harmonics.rs: 3D visualization and quantum mechanicscoulomb_example.rs: Quantum scattering calculationswright_omega_example.rs: Advanced transcendental equations
Performance Demonstrations
array_operations_demo.rs: Vectorized operations showcaseadvanced_array_operations.rs: Memory-efficient bulk processingspecial_comprehensive_demo.rs: Full function library tour
Contributing
See the CONTRIBUTING.md file for contribution guidelines.
License
This project is Licensed under the Apache License 2.0. See LICENSE for details.
You can choose to use either license. See the LICENSE file for details.