Documentation
¶
Overview ¶
Package measure represents physical quantities in natural units with c, reduced Planck’s constant, and Boltzmann’s constant equal to one. Mass, temperature, and energy are stored in MeV; length and time in MeV^-1.
Public constructors and accessors use named units, so callers can work in SI while calculations retain natural units inside. Distinct types keep a mass from being passed where an age belongs.
exact.go derives conversions from SI defining constants. measured.go loads measured values and defines nominal solar references. laws.go contains the physical relationships built on those quantities.
Index ¶
- type Angle
- type Area
- type Coord
- type Direction
- type Displacement
- func (by Displacement) AlongX() Length
- func (by Displacement) AlongY() Length
- func (by Displacement) AlongZ() Length
- func (by Displacement) Cross(moving Velocity) Sweep
- func (by Displacement) Direction() (*Direction, error)
- func (by Displacement) Dot(other Displacement) Area
- func (by Displacement) Length() Length
- func (by Displacement) Minus(other Displacement) Displacement
- func (by Displacement) Plus(other Displacement) Displacement
- func (by Displacement) Times(share float64) Displacement
- type Duration
- type Energy
- type Length
- type LightFraction
- type Mass
- func (mass Mass) Energy() Energy
- func (mass Mass) InKilograms() float64
- func (mass Mass) InMeV() float64
- func (mass Mass) InSolarMasses() float64
- func (mass Mass) Minus(less Mass) Mass
- func (mass Mass) Over(other Mass) float64
- func (mass Mass) Positive() bool
- func (mass Mass) Times(share float64) Mass
- type Nominal
- type Power
- type Sweep
- type Temperature
- type Velocity
- func (moving Velocity) AlongX() LightFraction
- func (moving Velocity) AlongY() LightFraction
- func (moving Velocity) AlongZ() LightFraction
- func (moving Velocity) Dot(other Velocity) float64
- func (moving Velocity) Minus(other Velocity) Velocity
- func (moving Velocity) Plus(other Velocity) Velocity
- func (moving Velocity) Speed() LightFraction
- func (moving Velocity) Times(share float64) Velocity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Angle ¶
type Angle struct {
// contains filtered or unexported fields
}
Angle is an angle, held in radians, which have no unit.
func Arcseconds ¶
Arcseconds is an angle in arcseconds, the unit positions and their errors on the sky are given in.
func (Angle) InArcseconds ¶
InArcseconds is the angle in arcseconds.
type Area ¶
type Area struct {
// contains filtered or unexported fields
}
Area is an area, held in one over MeV squared.
func Thomson ¶
func Thomson() Area
Thomson is how much of a beam one free electron turns aside: from how strongly light and charge couple, and the electron's mass.
func (Area) InSquareMetres ¶
InSquareMetres is the area in m2.
type Coord ¶
type Coord struct {
// contains filtered or unexported fields
}
Coord stores a position as three natural-unit coordinates.
func (Coord) Minus ¶
func (place Coord) Minus(from Coord) Displacement
Minus is how far this place is from another.
func (Coord) Plus ¶
func (place Coord) Plus(by Displacement) Coord
Plus is the place a displacement from this one.
type Direction ¶
type Direction struct {
// contains filtered or unexported fields
}
Direction is a unit vector with dimensionless components.
func NewDirection ¶
NewDirection normalizes three components. A zero vector, NaN, or infinite component returns an error and no direction.
Components are scaled by their largest magnitude before squaring, so overflow or underflow in their squares does not lose a valid direction.
func (Direction) Dot ¶
Dot returns the cosine between directions: one when aligned, zero when perpendicular, and minus one when opposed.
func (Direction) Times ¶
func (way Direction) Times(length Length) Displacement
Times is a displacement of a length this way.
type Displacement ¶
type Displacement struct {
// contains filtered or unexported fields
}
Displacement stores the separation vector between positions.
func (Displacement) AlongX ¶
func (by Displacement) AlongX() Length
AlongX is the displacement's part along x.
func (Displacement) AlongY ¶
func (by Displacement) AlongY() Length
AlongY is the displacement's part along y, which is up.
func (Displacement) AlongZ ¶
func (by Displacement) AlongZ() Length
AlongZ is the displacement's part along z.
func (Displacement) Cross ¶
func (by Displacement) Cross(moving Velocity) Sweep
Cross is the sweep of something this far out moving at a velocity: the plane of its motion, and twice the area it sweeps each moment.
func (Displacement) Direction ¶
func (by Displacement) Direction() (*Direction, error)
Direction normalizes a displacement and rejects zero separation.
func (Displacement) Dot ¶
func (by Displacement) Dot(other Displacement) Area
Dot is the displacement against another: their lengths times how far one goes along the other, an area.
func (Displacement) Length ¶
func (by Displacement) Length() Length
Length is how far the displacement goes.
func (Displacement) Minus ¶
func (by Displacement) Minus(other Displacement) Displacement
Minus is this displacement less another.
func (Displacement) Plus ¶
func (by Displacement) Plus(other Displacement) Displacement
Plus is this displacement and another, one after the other.
func (Displacement) Times ¶
func (by Displacement) Times(share float64) Displacement
Times is the displacement scaled by a share.
type Duration ¶
type Duration struct {
// contains filtered or unexported fields
}
Duration is a time, held in one over MeV.
type Energy ¶
type Energy struct {
// contains filtered or unexported fields
}
Energy is an energy, in MeV.
func (Energy) InElectronvolts ¶
InElectronvolts is the energy in eV.
type Length ¶
type Length struct {
// contains filtered or unexported fields
}
Length is a length, held in one over MeV.
func GM ¶
GM is a mass times newton's G: in natural units a length, half the horizon radius of a hole of that mass. Bodies whose GM is measured keep it; this is for a mass known as a mass.
func SolarRadii ¶
SolarRadii is a length in the Sun's radius.
func (Length) InSolarRadii ¶
InSolarRadii is the length in the Sun's radius.
type LightFraction ¶
type LightFraction struct {
// contains filtered or unexported fields
}
LightFraction expresses speed as a fraction of c. With c = 1 this is the dimensionless speed used internally.
func (LightFraction) InKilometresPerSecond ¶
func (speed LightFraction) InKilometresPerSecond() float64
InKilometresPerSecond is the speed in km/s.
func (LightFraction) InLightFraction ¶
func (speed LightFraction) InLightFraction() float64
InLightFraction is the speed as a share of light's.
type Mass ¶
type Mass struct {
// contains filtered or unexported fields
}
Mass is a mass, held as the energy it is at rest.
func Hydrogen1 ¶
func Hydrogen1() Mass
Hydrogen1 is the mass of a hydrogen 1 atom, its electron and all.
func (Mass) InSolarMasses ¶
InSolarMasses is the mass in the Sun's masses.
func (Mass) Minus ¶
Minus subtracts another mass after explicitly rounding each operand. Without that boundary, arm64 can fuse an inlined multiplication and subtraction, leaving a rounding residual when subtracting equal masses.
type Nominal ¶
type Nominal struct {
// contains filtered or unexported fields
}
Nominal is a star's measures as the IAU fixes them for reference: its GM, radius and luminosity, and the mass that follows.
func Sun ¶
func Sun() Nominal
Sun is the IAU's nominal Sun: its GM, radius and luminosity as the IAU fixes them, and its mass from its GM over G.
func (Nominal) Luminosity ¶
Luminosity is the star's luminosity.
type Power ¶
type Power struct {
// contains filtered or unexported fields
}
Power is energy given off over time, held in MeV squared.
func BlackBody ¶
func BlackBody(heat Temperature, area Area) Power
BlackBody is the power a black surface of an area gives off at a temperature.
func Eddington ¶
Eddington is the brightest a mass can shine before its own light pushes its gas away: gravity pulling on each proton against light pushing on each electron, for gas of pure hydrogen.
Past it, a star sheds itself, and a hole's food is blown back out.
func SolarLuminosities ¶
SolarLuminosities is a power in the Sun's luminosity.
func (Power) InSolarLuminosities ¶
InSolarLuminosities is the power in the Sun's luminosity.
type Sweep ¶
type Sweep struct {
// contains filtered or unexported fields
}
Sweep is displacement crossed with velocity: it sets the orbital plane’s normal and twice the area swept per unit time, the quantity preserved by Kepler’s second law.
type Temperature ¶
type Temperature struct {
// contains filtered or unexported fields
}
Temperature is a temperature, held as the energy k T.
func SurfaceTemperature ¶
func SurfaceTemperature(power Power, area Area) Temperature
SurfaceTemperature is how hot a black surface of an area must be to give off a power: the fourth root of Stefan's law, undone.
func (Temperature) InKelvin ¶
func (heat Temperature) InKelvin() float64
InKelvin is the temperature in K.
func (Temperature) InMeV ¶
func (heat Temperature) InMeV() float64
InMeV is the temperature as the energy k T, in MeV.
type Velocity ¶
type Velocity struct {
// contains filtered or unexported fields
}
Velocity stores three components as fractions of c. Arithmetic uses ordinary vector addition, not relativistic velocity composition; use it only where that approximation is appropriate.
func KilometresPerSecond ¶
KilometresPerSecond constructs a velocity from three km/s components. Nonfinite components and speeds at or above c return an error.
The comparison uses c in km/s directly: converting c to a fraction of itself first would round its own speed to just below one.
func (Velocity) AlongX ¶
func (moving Velocity) AlongX() LightFraction
AlongX is the velocity's part along x.
func (Velocity) AlongY ¶
func (moving Velocity) AlongY() LightFraction
AlongY is the velocity's part along y, which is up.
func (Velocity) AlongZ ¶
func (moving Velocity) AlongZ() LightFraction
AlongZ is the velocity's part along z.
func (Velocity) Speed ¶
func (moving Velocity) Speed() LightFraction
Speed is how fast, whichever way.