Natural Units Environment
The Natural Units environment is an environment designed for computations with units. This environment is set up by using the command with(Units[Natural]), or alternatively by using the commands Units[UseMode](natural) and with(Units), in that order.
Various procedures are overloaded to handle units. For example, sin⁡3.0⁢degrees evaluates the sine of 3 degrees and max⁡4⁢m,10 ft returns 4⁢m.
Arithmetic operators are overloaded to extract units from their operands. For example, 3⁢m+4 cm evaluates to 7625m and 53.32 km1.3 h evaluates to 11.39316239⁢ms, which can be converted to 25.48577843⁢mph.
Note: Although easier to use, it is slower, in general, to perform computations in the Natural Units environment than to use the conversion routines at the top-level.
If you do not want to interpret everything as a unit, you can either use the Units[Standard] package, where units must be specified with the Unit routine, or use the strict option to the Units[UseSystem] routine.
These computations can also be done in the Simple Units environment, the Standard Units environment, or at the top-level by using only conversion routines (see Default Units). Each example in this worksheet is also in the other worksheets to show how you can perform the computations in the other environments.
restart
withUnitsNatural:
Simple Examples
Add 4 feet to 3 inches.
4⁢ft+3⁢inches
64775000⁢m
convert⁡,units,inches
51⁢in
How many meters are equivalent to 4 yards?
4⁢yd
convert⁡4⁢yd,units,m
2286625⁢m
How many liters are equivalent to 5 UK gallons?
convert⁡5⁢galUK,units,L
45460920000⁢L
How many liters are equivalent to 5 US gallons?
convert⁡5⁢galUS_liquid,units,L
47317647325000000⁢L
How many US liquid gallons are equivalent to a UK gallon?
convert⁡galUS_liquid,units,galUK
473176473568261250⁢galUK
Unit Names and Symbols
Unit symbols and various spellings of unit names are recognized by the package.
32000⁢m,32000⁢meter,32000⁢metres
32000⁢m,32000⁢m,32000⁢m
This feature is expandable so that, for example, you can specify metr (the Polish word for this unit) as an alternate spelling of meter. See the AddUnit help page for more information.
Some units can be recognized with SI or IEC prefixes.
32⁢km,32⁢kilometer,32⁢kilometres
32⁢km,32⁢km,32⁢km
Sample Questions with Solutions
How many miles do you travel in 35 minutes moving at 55 miles per hour?
distance≔55⁢mph⁢⋅ 35 minutes
distance:=129082825⁢m
distance≔convert⁡distance,units,mi
distance:=38512⁢mi
evalf⁡distance
32.08333333⁢mi
How many seconds are equivalent to 3 weeks?
convert⁡3⁢week,units,s
1814400⁢s
How many inches are equivalent to 5 feet 4 inches?
convert⁡5⁢ft+4⁢inches,units,inches
64⁢in
Convert 50 km/h to cm/s.
The cm/s must be quoted. Otherwise, cms evaluates to m100⁢s.
convert⁡50 kmh, units,'cm/s'
125009⁢cms
evalf
13.88888889⁢ms
How many seconds does it take an object, released from rest, to fall 20 meters?
From the equation d=gn⁢t22, we derive:
elapsed_time≔2⁢ distaccel
elapsed_time:=2⁢distaccel
eval⁡elapsed_time, dist=20 m, accel=gn
1196133⁢2⁢20⁢20000⁢196133⁢s
evalf⁡
2.019619976⁢s
What is the rest energy of an electron?
Assume the mass of an electron is 9.11⁢10−31 kilograms.
mass≔9.11 ⋅⁢10−31⁢kg
mass:=9.110000000⁢10-31⁢kg
Approximate the speed of light by 3.00⁢108 meters per second.
c≔3.00⁢⋅ 108⁢ms
c:=3.000000000⁢108⁢ms
Using the formula E=m⁢c2, you can approximate the rest energy of the electron.
E≔mass ⋅⁢c2
E:=8.199000000⁢10-14⁢J
A more precise answer can be found by converting the known unit the electron mass (em) to joules using energy conversions.
convert⁡1 em,units,J,energy
8.187104141⁢10-14⁢J
Approximately what volume does 1,000,000,000 US dollars worth of gold occupy?
cost≔1210.00 USDoztroy; # November 18th, 2016
cost≔38902.40335⁢USDkg
density≔19.3⁢gcm3
density≔19300.0⁢kgm3
mass≔109⁢USD⁢cost
mass≔25705.35273⁢kg
volume≔massdensity
volume≔1.331883561⁢m3
What is the length of one side of a cube with this volume?
length_side≔volume3
length_side≔1.100243351⁢m
An Su-27 Flanker can travel at mach 1.1 at sea level. How fast is this in miles per hour, miles per second, and meters per second?
convert⁡1.1⁢M,units,mph
815.6003937⁢mph
convert⁡1.1,units,M,mis
0.2265556649
convert⁡1.1⁢M,units,ms
364.606⁢ms
Approximately how many meters are there in 3.5 miles?
convert⁡3.5⁢mi,units,m
5632.704000⁢m
round
5633⁢m
Given 50 US gallons of water, how many 750 mL bottles could you fill?
50⁢galUS_liquid750⁢mL
157725491625000
floor
252
Given nylon with a linear mass density of 20 deniers, what length of thread is used in an object weighing 12 grams?
12⁢g20 deniers
5400⁢m
What is the volume in cubic inches of a 2 liter engine.
convert⁡2⁢L,units,inches3
2500000002048383⁢in3
122.0474882⁢in3
For a given phenomena with a frequency of 1.420,405,761 GHz, find the:
1. period,
2. number of cycles per year, and
3. number of cycles since the beginning of the earth.
First you must convert the frequency from GHz to Hz (cycles per second).
frequency≔1.420405761⁢GHz
frequency:=1.420405761⁢GHz
The period is:
1frequency
7.040241792⁢10-10⁢s
convert⁡,units,nanoseconds
0.7040241792⁢ns
The number of cycles per year is:
convert⁡frequency,units,'1/yr'
4.482363838⁢1016⁢1yr
The number of cycles since the beginning of the earth is:
frequency⁢⋅ 10000000000 yr
4.482363838⁢1026
Given inductance and capacitance, find the resistance in microohms.
The following formula relates the resistance to the inductance and capacitance.
resistance≔inductance⁢capacitance
resistance≔inductancecapacitance
Use an inductance of 124 nanohenries and a capacitance of 3.52 microfarads.
evalresistance, inductance = 124. nH, capacitance = 3.52 uF;
0.005935256754⁢1000⁢Ω
0.1876892984⁢Ω
convert⁡,units,uOmega
187689.2984⁢μΩ
Given a molar energy, find the mass energy in Btu's per pound.
molar_energy≔523.432⁢Btumol⁡carbon
molar_energy:=5.518806676⁢105⁢Jmol⁡carbon
carbon_mass≔12 kgmol⁡carbon
carbon_mass:=12⁢kgmol⁡carbon
mass_energy≔molar_energycarbon_mass
mass_energy:=45990.05563⁢m2s2
convert⁡,units,'Btu/lb'
19.78539678⁢Btulb
Given a distance function, find the speed by differentiation, speed at 2.5 seconds and at 5 blinks by evaluation, and distance traveled between 1 and 2.5 seconds by integration and by subtraction of the distance function values.
Note: t is a unit of mass, the tonne. Therefore, t1 is used to represent the time variable.
distance≔51+4⋅ⅇ−3⋅t1 m
distance≔51+4⁢ⅇ−3⁢t1⁢m
To find the speed function, differentiate the distance function.
speed≔diff⁡distance,t1⋅⁢s
speed≔60⁢ⅇ−3⁢t11+4⁢ⅇ−3⁢t12⁢ms
To find the speed at 2.5 seconds, evaluate the speed function at t1=2.5.
speedt1=2.5|speedt1=2.5
0.03303871496⁢ms
To find the speed at 5 blinks, evaluate the speed function at t1=5. blink, converted to seconds.
dt ≔ convert5., units, blink, s
dt≔4.320000000
speedy|xt1=dt
0.0001411518555⁢ms
By using a definite integral, you can determine the distance traveled from the speed function.
∫12.5speedⅆt1
0.8193365798⁢ms
The distance traveled can also be calculated directly from the distance function.
distancet=2.5distancet1=2.5−distancet=1distancet1=1
4.988962733−51+4⁢ⅇ−3⁢m
0.819336584⁢m
Find the minimum and maximum length of 1.2 yards, 1 meter, 3.2 feet, and 0.6 fathoms.
min⁡1.2⁢yd,1 m,3.2 ft,0.6 fathom
0.9753600000⁢m
max⁡1.2⁢yd,1⁢m,3.2 ft,0.6 fathom
1.097280000⁢m
Given a torque of 3 newton meters, how much energy is required to move a lever through 10 degrees?
The energy required is the product of the torque and the angle in radians.
energy≔torque⁢⋅ angle
energy:=torque⁢angle
evalenergy, torque = 3 N ⋅ mradius, angle = 10 deg
16⁢π⁢J
0.5235987758⁢J
The Hyper-X can travel at speeds up to 7200 miles per hour. How long would it take to circle the earth at maximum speed (assuming it could carry sufficient fuel)? How far does it travel in a 10 second flight at maximum speed?
To find the time to circle the earth, divide the distance by the speed.
The meter was originally defined as 1/10,000,000 th the distance from the North Pole to the Equator on the meridian passing through Paris. Therefore, 40,000 kilometers is a good approximation of the circumference of the earth.
40000⁢km⁢7200 mph
15625000012573⁢s
convert⁡,units,h
390625113157⁢h
3.452062179⁢h
To find the distance traveled, multiply the speed by the time.
7200⁢mph⁢⋅ 10 s
80467225⁢m
32186.88000⁢m
convert⁡,units,km
32.18688000⁢km
Given 1032 UK gallons of oil, how many cylindrical cans with a height of 1.2 feet and diameter of 0.9 feet could you fill?
The volume of a cylinder is h⁢π⁢d22.
vol≔convert1.2 ft⋅π⋅0.9 ft22,units,galUK
vol:=4.755136685⁢galUK
1032 galUKvol
217.0284617
Given an power gain from 332 microwatts to 23 milliwatts, what is the gain in decibels? What would the decibel gain be if the increase were a voltage increase?
A gain is a quotient of the final value divided by the initial value.
gain≔23⁢mW⁢332⁢uW⁡base
gain:=575083⁢WW⁡base
To determine the decibel gain, first take the ln of the gain.
ln⁡gain
12⁢ln⁡575083⁢Np
convert⁡,units,dB
10⁢ln⁡575083⁢dBln⁡10
18.40589752⁢dB
Power is proportional to the square of the voltage. Therefore, the decibel increase corresponding to the voltage gain should be a factor of 2 times that of the power gain.
voltage_gain≔23⁢mV332⁢uV⁡base
voltage_gain:=575083⁢VV⁡base
ln⁡voltage_gain
ln⁡575083⁢Np
20⁢ln⁡575083⁢dBln⁡10
36.81179504⁢dB
Given an initial velocity of 2.4 meters per second and an otherwise unspecified uniform acceleration, what is the generic formula for position? For starting at the origin and acceleration being gravity in the opposite direction to the initial velocity? After 0.4 seconds?
The general formula for velocity in a uniform acceleration is v = v0 + a⋅t. In order to use this formula in the Natural Units environment, we need to express this in terms of unit-free quantities:
v0 ≔ v0U⋅ms
v0≔v0U⁢ms
a ≔ aU ⋅ ms2
a≔aU⁢ms2
t ≔ tU ⋅ s
t≔tU⁢s
Now the unassigned variables, v0U, aU, and tU, are unit-free quantities, in terms of which we have defined the quantities v0, a, and t as quantities with a unit.
v ≔ v0 + a⋅t
v≔aU⁢tU+v0U⁢ms
Substitute the given starting velocity.
vs ≔ vy|xv0U = 2.4
vs≔aU⁢tU+2.4⁢ms
Integrating this over time answers the first question. This requires defining the initial location in terms of the unit-free quantity x0U.
x0 ≔ x0U ⋅ m
x0≔x0U⁢m
x ≔x0 + intvs, t= 0 .. t0U
x≔x0U+0.5000000000⁢aU⁢t0U2+2.400000000⁢t0U⁢m
Starting at the origin and with the specified gravity:
gravity ≔ evalfScientificConstants:-Constantg;
gravity≔9.80665
xy|xx0U = 0, aU=−gravity
−4.903325000⁢t0U2+2.400000000⁢t0U⁢m
After 0.4 seconds, this is the location:
y|xt0U = 0.4
0.1754680000⁢m
Return to Index for Example Worksheets.
Download Help Document