diff --git a/examples/population_growth.nbt b/examples/population_growth.nbt index 8ee4e6f9..e48e1a77 100644 --- a/examples/population_growth.nbt +++ b/examples/population_growth.nbt @@ -1,5 +1,5 @@ let initial_population = 50_000 people -let growth_rate: Rate = 2 percent per year +let growth_rate: 1 / Time = 2 percent per year fn predict_population(time: Time) = initial_population × e^(growth_rate time) // round diff --git a/modules/core/dimensions.nbt b/modules/core/dimensions.nbt index a3c27045..17d42961 100644 --- a/modules/core/dimensions.nbt +++ b/modules/core/dimensions.nbt @@ -1,38 +1,39 @@ ### Physical dimensions -dimension Angle = 1 +dimension Angle = 1 # SI: plane angle dimension SolidAngle = Angle^2 dimension Length dimension Area = Length^2 dimension Volume = Length^3 +dimension Wavenumber = 1 / Length dimension Time dimension Frequency = 1 / Time -dimension Speed = Length / Time +dimension Speed = Length / Time # also: velocity dimension Acceleration = Length / Time^2 dimension Jerk = Length / Time^3 dimension Mass dimension Momentum = Mass × Speed dimension Force = Mass × Acceleration = Momentum / Time -dimension Energy = Momentum^2 / Mass = Mass × Speed^2 = Force × Length -dimension Power = Energy / Time = Force × Speed -dimension Pressure = Force / Area = Energy / Volume +dimension Energy = Momentum^2 / Mass = Mass × Speed^2 = Force × Length # also: work, amount of heat +dimension Power = Energy / Time = Force × Speed # also: radiant flux +dimension Pressure = Force / Area = Energy / Volume # also: stress dimension Action = Energy × Time dimension MassDensity = Mass / Length^3 dimension MomentOfInertia = Mass × Length^2 dimension AngularMomentum = MomentOfInertia × Angle / Time -dimension Torque = Length × Force +dimension Torque = Length × Force # also: moment of force dimension EnergyDensity = Energy / Volume dimension Current -dimension Charge = Current × Time -dimension Voltage = Energy / Charge = Power / Current +dimension Charge = Current × Time # SI: electric charge +dimension Voltage = Energy / Charge = Power / Current # ISQ: electric tension, SI: electric potential difference dimension Capacitance = Charge / Voltage -dimension Resistance = Voltage / Current +dimension Resistance = Voltage / Current # SI: electric resistance dimension Resistivity = Resistance × Length -dimension Conductance = 1 / Resistance +dimension Conductance = 1 / Resistance # SI: electric conductance dimension Conductivity = Conductance / Length dimension MagneticFluxDensity = Force / (Charge × Speed) dimension MagneticFlux = MagneticFluxDensity × Area @@ -63,11 +64,7 @@ dimension Irradiance = Power / Area dimension Activity = 1 / Time dimension AbsorbedDose = Energy / Mass -dimension EquivalentDose = Energy / Mass +dimension EquivalentDose = Energy / Mass # also: dose equivalent dimension DynamicViscosity = Pressure × Time dimension KinematicViscosity = Length^2 / Time - -# Other useful names - -dimension Rate = 1 / Time diff --git a/numbat/tests/interpreter.rs b/numbat/tests/interpreter.rs index 78880ace..5de168cb 100644 --- a/numbat/tests/interpreter.rs +++ b/numbat/tests/interpreter.rs @@ -191,7 +191,7 @@ fn test_incompatible_dimension_errors() { expect_exact_failure( "m + 1 / m", " left hand side: Length\n\ - right hand side: Length⁻¹\n\n\ + right hand side: Length⁻¹ [= Wavenumber]\n\n\ Suggested fix: multiply right hand side by Length²", ); expect_exact_failure(