Physics::Constants

Some support for physical constants.

Bridging physical constants into Physics::Measure objects

SYNOPSIS

#!/usr/bin/env raku
use Physics::Constants;  #<== must use before Physics::Measure
use Physics::Measure :ALL;

say ~kg-amu;                        #6.02214076e+23 mol^-1  (avogadro number = Na)
say ~plancks-h;                     #6.626070015e-34 J.s
say ~faraday-constant;              #96485.33212 C/mol
say ~fine-structure-constant;       #0.0072973525693   (dimensionless)
say ~μ0;                            #1.25663706212e-06 H/m
say ~ℏ;                             #1.054571817e-34 J.s

my \λ = 2.5nm;
say "Wavelength of photon (λ) is " ~λ;

my \ν = c / λ;
say "Frequency of photon (ν) is " ~ν.in('petahertz');

my \Ep = ℎ * ν;
say "Energy of photon (Ep) is " ~Ep.in('attojoules');

#Wavelength of photon (λ) is 2.5 nm
#Frequency of photon (ν) is 119.9169832 petahertz
#Energy of photon (Ep) is 79.45783266707788 attojoules

This module is a wrapper on JJ Merelo Math::Constants
https://github.com/JJ/p6-math-constants
#say '----------------';
#say @physics-constants;
#say '----------------';
#say @physics-constants-names.sort;
#say '----------------';
#say @physics-constants-abbreviations.sort;

Physics::Constants v1.0.0

Some support for physical constants.

Authors

  • p6steve

License

Artistic-2.0

Dependencies

Math::ConstantsPhysics::Measure

Test Dependencies

Provides

  • Physics::Constants
  • Physics::MathConstantsWrapper

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.