[][src]Crate calcify

Calcify

A crate for 3-D and 4-D vector and matrix algebra, conceived for use in physics simulations. Builds out from a basic ThreeVec struct including most commonly used operations built in.

Notes

  • All physics constants are exported in the top in SI units. To retrieve them in Planck or natural units call calcify::Consts::planck() or calcify::Consts::natural().

  • FourMat::lambda() has been replaced by fn boost(initial: FourVec, v: ThreeVec). The math has been changed.

todo

Four-Momentum

Structs

Consts

Calcify consts in different unit systems

FourMat

Four Matrix

FourVec

Four Vector

ThreeMat

Three Matrix

ThreeVec

Three Vector

Enums

Sinv

Variants of S space-time invariant

Constants

BIG_G

Gravitational constant in SI (6.674_28e-11 m^3/(kg*s^2))

C_LIGHT

The speed of light in a vacuum in SI (299_792_458.0 m/s)

EP_NAUGHT

Permittivity of free space in SI (8.854_187_817e-12 F/m)

E_CHARGE

Elementary charge in SI (1.602_176_487e-19 C)

G_ALPHA

Gravitational coupling constant (1.752e-45 unitless)

H_BAR

Reduced Planck constant in SI (6.626_068_96e-34/2π J*S)

K_BOLTZ

Boltzmann constant in SI (1.380_650_4e-23 J/K)

MU_NAUGHT

Permeability of free space in SI (4π*10^-7 N/A^2)

M_ELECTRON

Electron mass in SI (9.109_382_15e-31 kg)

M_PROTON

Proton mass in SI (1.672_621_637e-27 kg)

PI

Re-export Rust's PI

Q_ALPHA

Fine structure constant (7.297_352_537_6e-3 unitless)

Functions

beta

Beta factor, |v| over the speed pf light in a vacuum, in SI. Returns a Result<f64,&'static str> which contains an Ok(f64), or an error string.

boost

Returns a FourVec, inside a Result, boosted into a frame of arbitrary velocity v. Each componant of v must be less than calcify::C_LIGHT. Uses a FourMat Lorentz Transformation tensor. If v = [0,0,0], then the boost tensor will be an identity by definition.

degrees_between

Return the angle between two vectors in degrees

gamma

Gamma, the lorentz factor, in SI.

radians_between

Return the angle between two vectors in radians