pystein.constants module
Useful Physical Constants
Since the Astropy library provides a wonderful list of predefined constants, the approach here is to extend those objects to behave like sympy symbols. This prevents duplicate definitions of physical constants while providing a natural handle for each value when constructing a symbolic expression using sympy.
We have also extended the Units definition to include natural (Planck) units in which the physical constants c = G = hbar = kB = 1. These units are a geometrized system ideal for general relativity (the focus of this package).
References
[1] NIST CODATA2018 Value of Planck Length https://physics.nist.gov/cgi-bin/cuu/Value?plkl [2] NIST CODATA2018 Value of Planck Mass https://physics.nist.gov/cgi-bin/cuu/Value?plkm [3] NIST CODATA2018 Value of Planck Time https://physics.nist.gov/cgi-bin/cuu/Value?plkt [4] NIST CODATA2018 Value of Planck Temperatur https://physics.nist.gov/cgi-bin/cuu/Value?plktmp
- class pystein.constants.ConstantSymbol(constant: astropy.constants.constant.Constant, is_natural_unit: bool = False)
Bases:
sympy.core.symbol.SymbolConstant Symbol is a symbolic representation of a known physical constant, as defined in the astropy.constants module.
- property cgs
Pass-thru accessor to constant value in CGS units
- property constant
Safe attr access for _constant
- default_assumptions = {}
- is_constant()
Override this method to instantly return True
- property is_natural_unit
Safe attr access for _is_natural_unit
- name
- property natural
Pass-thru accessor to constant value in Natural units
- property si
Pass-thru accessor to constant value in SI units
- property unit
Safe attr access for constant.unit
- class pystein.constants.UnitSystem(value)
Bases:
str,enum.EnumUnit Systems Constants
- CGS = 'cgs'
- NATURAL = 'natural'
- SI = 'si'
- pystein.constants.subs_cgs(expr: sympy.core.expr.Expr) sympy.core.expr.Expr
Substitute any ConstantSymbols in an Expression with their value in a CGS units
- Parameters
expr – Expr, the sympy expression in which to substitute constant symbols for values
- Returns
Expr, the substituted expression
- pystein.constants.subs_natural(expr: sympy.core.expr.Expr) sympy.core.expr.Expr
Substitute any ConstantSymbols in an Expression with their value in a NATURAL units
- Parameters
expr – Expr, the sympy expression in which to substitute constant symbols for values
- Returns
Expr, the substituted expression
- pystein.constants.subs_si(expr: sympy.core.expr.Expr) sympy.core.expr.Expr
Substitute any ConstantSymbols in an Expression with their value in a SI units
- Parameters
expr – Expr, the sympy expression in which to substitute constant symbols for values
- Returns
Expr, the substituted expression