Skip to content

Commit

Permalink
Update documentation in extra::algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp authored and David Peter committed Aug 29, 2024
1 parent e479a77 commit 21c5b67
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
16 changes: 15 additions & 1 deletion book/src/list-units.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ and — where sensible — units allow for [binary prefixes](https://en.wikipedi
| `Length` | [Ångström](https://en.wikipedia.org/wiki/Angstrom) | `angstrom`, `angstroms`, `Å`, `` |
| `Length` | [Astronomical unit](https://en.wikipedia.org/wiki/Astronomical_unit) | `astronomicalunit`, `astronomicalunits`, `au`, `AU` |
| `Length` | [Bohr](https://en.wikipedia.org/wiki/Hartree_atomic_units) | `bohr` |
| `Length` | [Earth radius](https://en.wikipedia.org/wiki/Earth) | `earth_radius` |
| `Length` | [Fathom](https://en.wikipedia.org/wiki/Fathom) | `fathom`, `fathoms` |
| `Length` | [Fermi](https://en.wikipedia.org/wiki/Femtometre) | `fermi` |
| `Length` | [Foot](https://en.wikipedia.org/wiki/Foot_(unit)) | `feet`, `foot`, `ft` |
| `Length` | [Furlong](https://en.wikipedia.org/wiki/Furlong) | `furlong`, `furlongs` |
| `Length` | [Inch](https://en.wikipedia.org/wiki/Inch) | `in`, `inch`, `inches` |
| `Length` | [Jupiter radius](https://en.wikipedia.org/wiki/Jupiter) | `jupiter_radius` |
| `Length` | [League](https://en.wikipedia.org/wiki/League_(unit)) | `league`, `leagues` |
| `Length` | [Light-year](https://en.wikipedia.org/wiki/Light-year) | `lightyear`, `lightyears`, `ly` |
| `Length` | [Light-second](https://en.wikipedia.org/wiki/Light-second) | `lightsecond`, `lightseconds`, `lsec` |
| `Length` | [Light-year](https://en.wikipedia.org/wiki/Light-year) | `lightyear`, `lightyears`, `ly`, `lyr` |
| `Length` | [Lunar radius](https://en.wikipedia.org/wiki/Moon#Size_and_mass) | `lunar_radius` |
| `Length` | [Mars radius](https://en.wikipedia.org/wiki/Mars) | `mars_radius` |
| `Length` | [Metre](https://en.wikipedia.org/wiki/Metre) | `m`, `meter`, `meters`, `metre`, `metres` |
| `Length` | [Micron](https://en.wikipedia.org/wiki/Micrometre) | `micron` |
| `Length` | [Mile](https://en.wikipedia.org/wiki/Mile) | `mi`, `mile`, `miles` |
Expand All @@ -84,6 +89,7 @@ and — where sensible — units allow for [binary prefixes](https://en.wikipedi
| `Length` | [Rack unit](https://en.wikipedia.org/wiki/Rack_unit) | `rackunit`, `rackunits`, `RU`, `U` |
| `Length` | [US rod](https://en.wikipedia.org/wiki/Rod_(unit)) | `perch`, `rod`, `rods` |
| `Length` | [Smoot](https://en.wikipedia.org/wiki/Smoot) | `smoot` |
| `Length` | [Solar radius](https://en.wikipedia.org/wiki/Sun) | `solar_radius` |
| `Length` | [Stoney length](https://en.wikipedia.org/wiki/Stoney_units) | `stoney_length` |
| `Length` | [Thousandth of an inch](https://en.wikipedia.org/wiki/Thousandth_of_an_inch) | `mil`, `mils`, `thou` |
| `Length` | [Yard](https://en.wikipedia.org/wiki/Yard) | `yard`, `yards`, `yd` |
Expand All @@ -98,14 +104,19 @@ and — where sensible — units allow for [binary prefixes](https://en.wikipedi
| `MagneticFluxDensity` | [Gauss](https://en.wikipedia.org/wiki/Gauss_(unit)) | `gauss` |
| `MagneticFluxDensity` | [Tesla](https://en.wikipedia.org/wiki/Tesla_(unit)) | `T`, `tesla`, `teslas` |
| `Mass` | [Dalton](https://en.wikipedia.org/wiki/Dalton) | `Da`, `dalton`, `daltons` |
| `Mass` | [Earth mass](https://en.wikipedia.org/wiki/Earth) | `earth_mass` |
| `Mass` | [Firkin](https://en.wikipedia.org/wiki/Firkin_(unit)) | `firkin`, `firkins` |
| `Mass` | [Grain](https://en.wikipedia.org/wiki/Grain_(unit)) | `grain`, `grains` |
| `Mass` | [Gram](https://en.wikipedia.org/wiki/Gram) | `g`, `gram`, `gramme`, `grammes`, `grams` |
| `Mass` | [Jupiter mass](https://en.wikipedia.org/wiki/Jupiter) | `jupiter_mass` |
| `Mass` | [Hundredweight](https://en.wikipedia.org/wiki/Hundredweight) | `cwt`, `long_hundredweight` |
| `Mass` | [Long ton](https://en.wikipedia.org/wiki/Long_ton) | `long_ton`, `long_tons` |
| `Mass` | [Lunar mass](https://en.wikipedia.org/wiki/Moon#Size_and_mass) | `lunar_mass` |
| `Mass` | [Mars mass](https://en.wikipedia.org/wiki/Mars) | `mars_mass` |
| `Mass` | [Ounce](https://en.wikipedia.org/wiki/Ounce) | `ounce`, `ounces`, `oz` |
| `Mass` | [Planck mass](https://en.wikipedia.org/wiki/Planck_mass) | `planck_mass` |
| `Mass` | [Pound](https://en.wikipedia.org/wiki/Pound_(mass)) | `lb`, `lbs`, `pound`, `pounds` |
| `Mass` | [Solar mass](https://en.wikipedia.org/wiki/Sun) | `solar_mass` |
| `Mass` | [Stone](https://en.wikipedia.org/wiki/Stone_(unit)) | `stone` |
| `Mass` | [Stoney mass](https://en.wikipedia.org/wiki/Stoney_units) | `stoney_mass` |
| `Mass` | [Tonne](https://en.wikipedia.org/wiki/Tonne) | `metricton`, `ton`, `tonne`, `tonnes`, `tons` |
Expand Down Expand Up @@ -156,6 +167,7 @@ and — where sensible — units allow for [binary prefixes](https://en.wikipedi
| `Pressure` | [Pascal](https://en.wikipedia.org/wiki/Pascal_(unit)) | `Pa`, `pascal`, `pascals` |
| `Pressure` | [Pound-force per square inch](https://en.wikipedia.org/wiki/Pounds_per_square_inch) | `psi`, `PSI` |
| `Pressure` | [Torr](https://en.wikipedia.org/wiki/Torr) | `torr` |
| `RadiantFlux` | [Solar luminosity](https://en.wikipedia.org/wiki/Solar_luminosity) | `solar_luminosity` |
| `Scalar` | [Billion](https://en.wikipedia.org/wiki/Billion) | `billion` |
| `Scalar` | [Dozen](https://en.wikipedia.org/wiki/Dozen) | `dozen` |
| `Scalar` | [Hundred](https://en.wikipedia.org/wiki/100_(number)) | `hundred` |
Expand All @@ -171,6 +183,8 @@ and — where sensible — units allow for [binary prefixes](https://en.wikipedi
| `Scalar` | [Thousand](https://en.wikipedia.org/wiki/1000_(number)) | `thousand` |
| `Scalar` | [Trillion](https://en.wikipedia.org/wiki/Trillion) | `trillion` |
| `SolidAngle` | [Steradian](https://en.wikipedia.org/wiki/Steradian) | `sr`, `steradian`, `steradians` |
| `SpectralFluxDensity` | [Jansky](https://en.wikipedia.org/wiki/Jansky) | `jansky`, `janskys`, `Jy` |
| `SpectralFluxDensity` | [Solar flux unit](https://en.wikipedia.org/wiki/Solar_flux_unit) | `sfu`, `solarfluxunit`, `solarfluxunits` |
| `Temperature` | [Kelvin](https://en.wikipedia.org/wiki/Kelvin) | `K`, `kelvin`, `kelvins` |
| `Temperature` | [Planck temperature](https://en.wikipedia.org/wiki/Planck_temperature) | `planck_temperature` |
| `Time` | [Century](https://en.wikipedia.org/wiki/Century) | `centuries`, `century` |
Expand Down
2 changes: 2 additions & 0 deletions numbat/modules/all.nbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use units::hartree

use extra::algebra
use extra::color
use extra::astronomy
use extra::cooking

use numerics::diff
use numerics::solve
Expand Down
42 changes: 40 additions & 2 deletions numbat/modules/extra/astronomy.nbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,67 @@ use physics::constants
use units::si
use units::astronomical

unit lyr: Length = lightyear

@name("Light-second")
@description("The distance that light travels in one second.")
@url("https://en.wikipedia.org/wiki/Light-second")
@aliases(lightseconds, lsec)
unit lightsecond: Length = speed_of_light × 1 s

@name("Lunar mass")
@description("The mass of Earth's Moon.")
@url("https://en.wikipedia.org/wiki/Moon#Size_and_mass")
unit lunar_mass: Mass = 7.342e22 kg

@name("Lunar radius")
@description("The radius of Earth's Moon.")
@url("https://en.wikipedia.org/wiki/Moon#Size_and_mass")
unit lunar_radius: Length = 1737.4 km

@name("Earth mass")
@description("The mass of planet Earth.")
@url("https://en.wikipedia.org/wiki/Earth")
unit earth_mass: Mass = 5.9722e24 kg

@name("Earth radius")
@description("The radius of planet Earth.")
@url("https://en.wikipedia.org/wiki/Earth")
unit earth_radius: Length = 6371.0088 km

@name("Mars mass")
@description("The mass of planet Mars.")
@url("https://en.wikipedia.org/wiki/Mars")
unit mars_mass: Mass = 6.4171e23 kg

@name("Mars radius")
@description("The radius of planet Mars.")
@url("https://en.wikipedia.org/wiki/Mars")
unit mars_radius: Length = 3389.5 km

@name("Jupiter mass")
@description("The mass of planet Jupiter.")
@url("https://en.wikipedia.org/wiki/Jupiter")
unit jupiter_mass: Mass = 1.89813e27 kg

@name("Jupiter radius")
@description("The radius of planet Jupiter.")
@url("https://en.wikipedia.org/wiki/Jupiter")
unit jupiter_radius: Length = 71_492 km

@name("Solar mass")
@description("The mass of the Sun.")
@url("https://en.wikipedia.org/wiki/Sun")
unit solar_mass: Mass = 1.98847e30 kg

@name("Solar radius")
@description("The radius of the Sun.")
@url("https://en.wikipedia.org/wiki/Sun")
unit solar_radius: Length = 6.957e5 km

dimension RadiantFlux = Power

@name("Solar luminosity")
@description("The total amount of energy emitted by the Sun per unit time.")
@url("https://en.wikipedia.org/wiki/Solar_luminosity")
unit solar_luminosity: RadiantFlux = 3.828e26 W

dimension SpectralFluxDensity = RadiantFlux / Area / Frequency
Expand Down
2 changes: 1 addition & 1 deletion numbat/modules/units/astronomical.nbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ unit parsec: Length = 648_000 / π × au
@name("Light-year")
@url("https://en.wikipedia.org/wiki/Light-year")
@metric_prefixes
@aliases(lightyears, ly: short)
@aliases(lightyears, ly: short, lyr: short)
unit lightyear: Length = 9_460_730_472_580_800 m

@name("Sidereal day")
Expand Down

0 comments on commit 21c5b67

Please sign in to comment.