Entering Units

Units are objects that have 2 separate parts: the value and the unit per se. The value is usually a real number, but units may be attached to other numerical objects as well, for example complex numbers and vectors or matrices can have associated units. The unit part is entered using the underscore _, which acts as both a separator and an operator.

The unit is an algebraic expression combining one or more unit symbols, and may be optionally surrounded by square brackets. The brackets are optional for stack input, but mandatory when units are used within a symbolic expression (to separate the unit from other algebraic operations). The _ key will always add the brackets regardless of whether the user is typing an algebraic expression or not, the use of the brackets is encouraged.

Examples of valid unit objects are:
1_m
3_m/s^2
3_[m/s^2]
[1 2 3]_kg
'3_[m]+2_[ft]'
in all cases above, the underscore is being used as a separator, but can be used as an operator as well:
_[m]
[1 2 3] _[kg]
in the first case, the operator _[] will apply the unit to some value previously left on the stack. In the second case, the value (a vector) is separated with a space, therefore it will be compiled as a separate object, put on the stack, and then the underscore operator will apply the unit.

Exponents within a unit expression can be integer numbers, real numbers or fractional exponents. The use of fractional exponents is always preferred over real numbers because they can be simplified in an exact way.
3_[m^(2/3)] is always preferred to 3_[m^0.666667]

Operating with Units

Unit objects can be operated upon normally, and the system will perform all the necessary unit conversions in the background. Unit consistency is strictly enforced for addition and subtraction, therefore if one variable uses units in an algebraic expression, all variables should have proper units attached.

Results of an addition or subtraction between consistent units will produce a result with the units of the first argument (argument in level 2 of the stack at the time of the operation, or the left argument in an algebraic expression).

Unit conversions can be performed directly using the CONVERT command, which is accessible directly from the keyboard (LS-6). For example to convert 100 ml into m^3 simply place the original unit and the new unit on the stack: 100_ml 1_m^3 CONVERT.

To reduce a unit to its base components, use the command UBASE. For example 1_N UBASE will return 1_kg*m/s^2.

To extract the value part of a unit object, use the UVAL command, which will return the object without its unit.

Custom Units

Units in newRPL can be arbitrary symbols, not just the ones predefined in the system. For example, adding 3_apples and 2_apples will produce 5_apples as expected. In this case, apples is a custom unit without a definition. Units without a definition are considered base units. The system already includes base units for mass, length, time, etc. but any number of new base units can be added simply by using new symbols.

Custom units can also be defined as derived units, in terms of other base units. This is done with the UDEFINE command. For example typing 750_ml 'bigmug' UDEFINE would define a unit named bigmug as 750 ml. From that moment bigmug can be used in the exact same way as any system-defined unit, and it will be considered consistent with all other volume units.

New units can also be defined in terms of new (unknown) base units. For example typing 3_apples 'oranges' UDEFINE will define oranges as equivalent to 3 apples, where apples is a base unit (amount of fruit?). From that moment the addition 2_[oranges]+3_[apples] will result in 3_oranges since the units of the result will match the units of the left operand, and the 3 apples were automatically converted to 1 orange.

Custom units work systemwide, the command ULIST returns a list of all the custom units that are defined in the system. To remove a unit definition use the UPURGE command. Following the previous example, typing 'oranges' UPURGE will undefine the unit. Notice that the unit oranges definition was removed, which means this symbol now represents an unknown base unit, then 2_[oranges]+3_[apples] cannot proceed since oranges and apples are now considered as unrelated base units.

Available Units

This is a list of the units available in the Units menu on newRPL:

Length
Unit Unit name Definition Description
1_m metre 1_m Base SI unit of length
1_cm centimetre 1_cm = 0.01_m SI length
1_mm millimetre 1_mm = 0.001_m SI length
1_yd yard 1_yd = 3_ft US customary length
1_ft foot 1_ft = 12_in US customary length
1_in inch 1_in = 0.0254_m US customary length
1_Mpc megaparsec 1_Mpc = 1000000_pc Astronomical length
1_pc parsec 1_pc = (648000/π)_au Astronomical length
1_lyr light year 1_lyr = 365.25_d*c Astronomical length
1_au astronomical unit 1_au = 149597870700_m SI astronomical length
1_km kilometre 1_km = 1000_m SI length
1_mi mile 1_mi = 5280_ft US customary length
1_nmi nautical mile 1_nmi = 1852_m non-SI length
1_miUS surveying mile 1_miUS = 5280_ftUS US surveying length
1_chain surveying chain 1_chain = 66_ftUS US surveying length
1_rd rod 1_rd =16.5_ft US customary length
1_rdUS surveying rod 1_rdUS =16.5_ftUS US surveying length
1_fath surveying fathom 1_fath =6_ftUS US surveying length
1_ftUS surveying foot 1_ftUS = 1200/3937_m US surveying length
1_mil thousandth of inch 1_mil = 0.001_in US customary length
1_µ micron or micrometre 1_µ = 1_µm SI length
1_Å Ångström 1_Å = 0.1_nm non-SI length
1_fermi fermi or femtometre 1_fermi = 1_fm SI length
Area
Unit Unit name Definition Description
1_m^2 square metre 1_m^2 Base SI unit of area
1_cm^2 square centimetre 1_cm^2 = 0.0001_m^2 SI area
1_b barn 1_b = 1E-28_m^2 non-SI area
1_yd^2 square yard 1_yd^2 = 9_ft^2 US customary area
1_ft^2 square foot 1_ft^2 = 144_in^2 US customary area
1_in^2 square inch 1_in^2 = 6.4516_cm^2 US customary area
1_km^2 square kilometre 1_km^2 = 1E6_m^2 SI area
1_ha hectare 1_ha = 1_hm^2 SI area (deprecated)
1_a are 1_a = 100_m^2 non-SI area
1_mi^2 square mile 1_mi^2 = 9_ft^2 US customary area
1_miUS^2 survey square mile 1_miUS^2 = 9_ftUS^2 US surveying area
1_acre acre 1_acre = 4840_yd^2 US customary area
Volume
Unit Unit name Definition Description
1_m^3 cubic metre 1_m^3 Base SI unit of volume
1_cm^3 cubic centimetre 1_cm^3 = 1E-6_m^3 SI volume
1_ml millilitre 1_ml = 1_cm^3 SI volume
1_l litre 1_l = 0.001_m^3 SI volume
1_st stere 1_st = 1_m^3 non-SI volume
1_yd^3 cubic yard 1_yd^3 = 27_ft^3 US customary volume
1_ft^3 cubic foot 1_ft^3 = 1728_in^3 US customary volume
1_in^3 cubic inch 1_in^3 = 16.387064_cm^3 US customary volume
1_gal gallon 1_gal = 231_in^3 US customary volume
1_qt quart 1_qt = 1/4_gal US customary volume
1_pt pint 1_pt = 1/8_gal US customary volume
1_cu cup 1_cu = 1/16_gal US customary volume
1_ozfl fluid ounce 1_ozfl = 1/128_gal US customary volume
1_tbsp table spoon 1_tbsp = 1/2_ozfl US customary volume
1_tsp tea spoon 1_tsp = 1/6_ozfl US customary volume
1_fbm board foot 1_fbm = 144_in^3 US customary volume
1_galUK gallon (UK) 1_galUK = 0.00454609_m^3 Imperial volume
1_qtUK quart (UK) 1_qtUK = 1/4_galUK Imperial volume
1_ptUK pint (UK) 1_ptUK = 1/8_galUK Imperial volume
1_ozUK ounce (UK) 1_ozUK = 1/160_galUK US customary volume
1_galC gallon (Canada) 1_galC = 1_galUK Canadian volume
1_qtC quart (Canada) 1_qtC = 1_qtUK Canadian volume
1_ptC pint (Canada) 1_ptC = 1_ptUK Canadian volume
1_ozC ounce (Canada) 1_ozC = 1_ozUK Canadian volume
1_bbl oil barrel 1_bbl = 42_gal oil industry volume
1_bu bushel (US) 1_bu = 2150.42_in^3 US customary volume
1_pk peck (US) 1_pk = 1/4_bu US customary volume
1_buUK bushel (UK) 1_buUK = 8_galUK Imperial volume
1_pkUK peck (UK) 1_pkUK = 1/4_buUK Imperial volume
1_buC bushel (Canada) 1_buC = 8_galC Canadian volume
1_pkC peck (Canada) 1_pkC = 1/4_buC Canadian volume
Time
Unit Unit name Definition Description
1_yr tropical year 1_yr = 31556925.9747_sper 1952 Ephemeris Time
1_d day 1_d = 86400_s SI time
1_h hour 1_h = 3600_s SI time
1_min minute 1_min = 60_s SI time
1_s second 1_s Base SI unit of time
1_Hz Hertz 1_Hz = 1_1/s SI frequency
Speed
Unit Unit name Definition Description
1_m/s metres per second 1_m/s Base SI unit of speed
1_cm/s centimetres per second 1_cm/s = 0.01_m/s SI speed
1_ft/s feet per second 1_ft/s = 12_in/s US customary speed
1_kph kilometres per hour 1_kph = 1_km/h SI speed
1_mph miles per hour 1_mph = 1_mi/h SI speed
1_knot nautical knot 1_knot = 1_nmi/h non-SI speed
1_c speed of light 1_c = 299792458_m/s non-SI speed
1_r/s radians per second 1_r/s Base SI angular speed
1_rpm revolutions per minute 1_rpm = 1_tr/min non-SI speed
1_tr/s turns per second 1_tr/s = 2π_r/s non-SI speed
Acceleration
Unit Unit name Definition Description
1_m/s^2 metre per second squared 1_m/s^2 SI acceleration
1_cm/s^2 centimetre per second squared 1_cm/s^2 = 0.01_m/s^2 SI acceleration
1_ft/s^2 foot per second squared 1_ft/s^2 US customary acceleration
1_ga acceleration of gravity 1_ga = 9.80665_m/s^2 non-SI acceleration
1_r/s^2 radian per second squared 1_r/s^2 SI angular acceleration
Mass
Unit Unit name Definition Description
1_kg kilogram 1_kg Base SI unit of mass
1_g kilogram 1_g = 0.001_kg SI mass
1_lb pound 1_lb = 7000_grain US customary mass
1_oz ounce 1_oz = 1/16_lb US customary mass
1_slug slug 1_slug = 1_lb*s^2/ft*ga US customary mass
1_lbt troy pound 1_lbt = 5760_grain US customary mass
1_ton tonne 1_ton = 2000_lb US customary mass
1_tonUK tonne (UK) 1_tonUK = 2240_lb Imperial mass
1_t Metric tonne 1_t = 1000_kg non-SI mass
1_ozt troy ounce 1_ozt = 480_grain Imperial mass
1_ct Metric carat 1_ct = 200_mg Metric System mass
1_grain grain 1_grain = 64.79891_mg Imperial mass
1_u unified atomic mass 1_u = 1.660539040E-27_kg non-SI mass
1_mol mole 1_mol Base SI amount of substance
1_gmol gram mole 1_gmol = 1_mol non-SI amount of substance
1_lbmol pound mole 1_lbmol = 453.59237_mol US customary substance
Force
Unit Unit name Definition Description
1_N Newton 1_N = 1_kg*m/s^2 SI force
1_dyn dyne 1_dyn = 1_g*cm/s^2 non-SI force
1_gf gram-force 1_gf = 1_g*ga non-SI force
1_kip kip 1_kip = 1000_lbf US customary force
1_lbf pound-force 1_lbf = 1_lb*ga US customary force
1_pdl poundal 1_pdl = = 1_lb*ft/s^2 US customary force
Energy
Unit Unit name Definition Description
1_J Joule 1_J = 1_N*m SI energy
1_kW*h kilowatt-hour 1_kW*h = 3.6_MJ non-SI energy
1_erg erg 1_erg = 1_dyn*cm non-SI energy
1_kcal kilo calorie 1_kcal = 1000_cal non-SI energy
1_cal calorie 1_cal = 4.184_J non-SI energy
1_Btu british thermal unit 1_Btu = =1055.056_J Imperial energy
1_ft*lbf foot-pound 1_ft*lbf = 1_lb*ft*ga US customary energy
1_therm therm 1_therm = 100000_Btu Imperial energy
1_MeV mega electronvolt 1_MeV = 1E6_eV non-SI energy
1_eV electronvolt 1_eV = 1.6021766208E-19_J non-SI energy
Power
Unit Unit name Definition Description
1_W Watt 1_W = 1_J/s SI power
1_kW kilowatt 1_kW = 1000_W SI power
1_MW megawatt 1_MW = 1000000_W SI power
1_hp mechanical horsepower 1_hp = 550_ft*lbf/s Imperial power
1_lbf*ft/s pound-foot per second 1_ft*lbf/s Imperial power
Pressure
Unit Unit name Definition Description
1_Pa Pascal 1_Pa = 1_N/m^2 SI pressure
1_atm atmospheric pressure 1_atm = 101325_Pa non-SI pressure
1_bar bar 1_bar = 100000_Pa non-SI pressure
1_psi pound per square inch 1_psi = 1_lbf/in^2 US customary pressure
1_Torr Torricelli 1_Torr = 1/760_atm non-SI pressure
1_mmHg millimetres of mercury (at 0°C) 1_mmHg = 13595.1_kg/m^3*mm*ga non-SI pressure
1_inHg inches of mercury (at 0°C) 1_inHg = 13595.1_kg/m^3*in*ga non-SI pressure
1_inH2O inches of water (at 4°C) 1_inH2O = 999.972_kg/m^3*in*ga non-SI pressure
Temperature
Unit Unit name Definition Description
1_°C celsius (or degree celsius) 1_°C Zero: 0_°C → 273.15_K Base SI temperature (rel. scale)
1_Δ°C celsius temperature change 1_Δ°C = 1_ΔK Change of temperature
1_°F farenheit (or degree farenheit) 1_°F Zero: 0_°F → 459.67_°R US cust. temp. (rel. scale)
1_Δ°F farenheit temperature change 1_Δ°F = 1_Δ°R Change of temperature
1_K kelvin 1_K Base SI temperature (abs. scale)
1_ΔK kelvin temperature change 1_ΔK Base change of temperature
1_°R rankine 1_°R = 5/9_K Imperial temperature (abs. scale)
1_Δ°R rankine temperature change 1_Δ°R = 5/9_ΔK Change of temperature
Electricity and Magnetism
Unit Unit name Definition Description
1_V volt 1_V = 1_J/C SI potential difference
1_A ampere 1_A Base SI electric current
1_C coulomb 1_C = 1_A*s SI electrical charge
1_Ω ohm 1_Ω = 1_V/A SI electrical resistance
1_F farad 1_F = 1_C/V SI electrical capacity
1_A*h ampere-hour 1_A*h = 3600_C non-SI electrical charge
1_Fdy faraday 1_Fdy = 96485.33289_C non-SI electrical charge
1_H henry 1_H = 1_Wb/A SI inductance
1_mho mho (Siemens) 1_mho = 1_S non-SI conductance
1_S siemens 1_S = 1_1/Ω SI conductance
1_T tesla 1_T = 1_Wb/m^2 SI magnetic flux density
1_Wb weber 1_Wb = 1_kg*m^2/A/s^2 SI magnetic flux
Angles
Unit Unit name Definition Description
1_° degree 1_° = 2π/360_r non-SI plane angle
1_r radian 1_r Base SI plane angle
1_grad grad (gon) 1_grad = 2π/400_r non-SI plane angle
1_tr full turn (one revolution) 1_tr = 2π_r non-SI plane angle
1_arcmin arc minute 1_arcmin = 1/60_° non-SI plane angle
1_arcs arc second 1_arcmin = 1/3600_° non-SI plane angle
1_sr steradian 1_sr Base SI solid angle
Light
Unit Unit name Definition Description
1_fc foot-candle 1_fc = 1_lm/ft^2 non-SI illuminance
1_flam footlambert 1_flam = 1/π_cd/ft^2 non-SI illuminance
1_lx lux 1_lx = 1_lm/m^2 SI illuminance
1_ph phot 1_ph = 1_lm/cm^2 non-SI illuminance
1_sb stilb 1_sb = 1_cd/cm^2 non-SI illuminance
1_lm lumen 1_lm = 1_cd*sr SI luminous flux
1_cd candela 1_cd Base SI luminous intensity
1_lam lambert 1_lam = 10000/π_cd/m^2 non-SI illuminance
Radiation
Unit Unit name Definition Description
1_Gy gray 1_Gy = 1_J/kg SI radiation
1_rad rad 1_rad = 0.01_Gy non-SI radiation
1_rem roentgen equivalent man 1_rem = 1_erg/g SI radiation
1_Bq becquerel 1_Bq = 1_1/s SI radiation
1_Ci curie 1_Ci = 3.7E10_Bq non-SI radiation
1_R rontgen 1_R = 2.58E-4_C/kg non-SI radiation
Viscosity
Unit Unit name Definition Description
1_P poise 1_P = 0.01_Pa*s non-SI dynamic viscosity
1_St stokes 1_St = 0.0001_m^2/s non-SI kinematic viscosity
1_m^2/s square metre per second 1_m^2/s SI kinematic viscosity
1_kg/(m*s) kilogram per metre per second 1_kg/(m*s) = 1_Pa*s SI dynamic viscosity
  • manual/chapter3/units.txt
  • Last modified: 2018/10/25 10:17
  • by claudio