2 unstable releases
0.2.0 | Oct 11, 2022 |
---|---|
0.1.0 | Feb 20, 2017 |
#1047 in Math
85KB
2.5K
SLoC
natural_constants
Pre-defined constants from all disciplines (math, physics, ...) as a Rust library.
Add this to your Cargo.toml file:
natural_constants = "0.2.0"
Currently the following modules exist:
- math
- physics
- chemistry
- biology
- engineering
- conversion
It's far from complete. So if your favorite constant is missing, just let me know.
What should go in ? Everything that you think is useful. Some constants may fit into multiple modules - we then have to decide which one.
- Why are you using long names for the constants ? Why not a simple character like 'c' ?
Well simple characters are often used ("overloaded") by various constants, so to avoid ambiguity the full name is used.
- But isn't that too complicated to type ? Now my code looks too ugly!
Well no one stops you from doing s.th. like this:
use natural_constants::physics::*;
fn main() {
let c = speed_of_light_vac;
let m0 = 100.0;
// Use c in your code:
let E = m0 * c * c;
}
- What about pre-calculated stuff ?
Yes, why not ? If it's useful to you, it may also be useful to others.
This is an ongoing effort to make Rust more suitable for scientific / numeric computing, you can join the discussion here.
Other useful numeric / scientific crates:
- rand
- num
- fast_inv_sqrt
- vecmath
- cgmath-rs
- matrixmultiply
- nalgebra
- scirust
- beagle-rs
- ndarray
- statrs
- astro-rust
- rust-bio
- lapack
- rust-blas
- rust-gmp
- rust-gsl
- georust
- imageproc
- units
- simple_units