Skip to content

Pre-defined constants from all disciplines (math, physics, ...) as a Rust library

License

Notifications You must be signed in to change notification settings

willi-kappler/natural_constants

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

natural_constants

Build Status MIT licensed

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:

More here:

About

Pre-defined constants from all disciplines (math, physics, ...) as a Rust library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages