Closed
Description
We could have a submodule that delivers common physical constants. Already I am finding myself having to type out the speed of light by hand; it would be useful if it were just built-in.
This could work as follows:
using DynamicQuantities
import DynamicQuantities: Units as U, Constants as C
Then, C
would let you access constants, and U
the units. This is similar to how astropy
does it, to avoid mixing namespaces.
e.g., the energy of a 500nm photon
wavelength = 500*U.nm
energy = C.c*C.h/wavelength
This Constants
namespace could also be exposed within the @u_str
macro, so you could also write this as
energy = (1/500) * u"C.c*C.h/nm"
I'd be interested to know if @odow or @ChrisRackauckas have any thoughts or ideas in this direction.
Metadata
Metadata
Assignees
Labels
No labels