Simple Units Environment
The Simple Units environment is an environment designed for computations with units. This environment is set up by using the command with(Units[Simple]), or alternatively by using the command with(Units).
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.32km 1.3h 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 Simple Units environment than to use the conversion routines at the top-level.
These computations can also be done in the Standard Units or Natural 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
withUnits:
Automatically loading the Units[Simple] subpackage
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?
4yd
4⁢yd
convert⁡,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
convertdistance,units,mi
38512⁢mi
evalf⁡
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.
convert⁡50⁢kmh,units,cms
125009⁢cms
evalf
1388.888889⁢cms
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
2⁢400000⁢196133196133⁢s
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⁢m's'
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⁡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≔1210.00⁢USDoztroy
density≔19.3⁢gcm3
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⁢M,units,mis
0.2265556649⁢mis
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_liquid⁢750⁢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
The period is:
1frequency
0.7040241792⁢1GHz
convert⁡,units,nanoseconds
0.7040241792⁢ns
The number of cycles per year is:
convert⁡frequency,units,1yr
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.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
carbon_mass≔12⁢kgmol⁡carbon
mass_energy≔molar_energycarbon_mass
mass_energy≔45990.05563⁢m2s2
convert⁡,units,Btulb
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.
distance≔51+4⁢ⅇ−3 ts⁢m
distance≔51+4⁢ⅇ−3⁢t⁢1s⁢m
The expression ⅇ−3 t, where t is a duration or a time, doesn't make sense without specifying with what unit of time this expression is to be understood. This can be specified by dividing by the appropriate unit: that way, if t is given in seconds, the unit will just be stripped off, and otherwise the appropriate conversion to seconds is done automatically.
To find the speed function, differentiate the distance function.
speed≔diff⁡distance,t
speed≔60⁢ⅇ−3⁢t⁢1s1+4⁢ⅇ−3⁢t⁢1s2⁢ms
To find the speed at 2.5 seconds, evaluate the speed function at t=2.5 s.
speedt=2.5|speedt=2.5s
0.03303871496⁢ms
To find the speed at 5 blinks, evaluate the speed function at t=5. blink.
speedy|xt=5. blink
0.0001411518555⁢ms
By using a definite integral, you can determine the distance traveled from the speed function.
intspeed, t=1s..2.5s
0.8193365798⁢m
The distance traveled can also be calculated directly from the distance function.
distancex=a|f(x)t=2.5s−distancex=a|f(x)t=1s
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,m,3.2⁢ft,0.6⁢fathom
0.9753600000⁢m
max⁡1.2⁢yd,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⁢m, angle = 10 deg
π6⁢J
convert, system
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⁢km7200mph
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⋅π⋅.9 ft22,units,galUK
vol≔4.755136685⁢galUK
1032⁢galUKvol
217.0284617
evalf⁡681.8150208π
217.0284616
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 mW332 uW
gain≔575083
Since this is a gain in power, we can use the following formula to find the gain in decibels.
10 ⋅ log10gain
10⁢ln⁡575083ln⁡10
18.40589752
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⁢mV⁢332 uV
voltage_gain≔575083
20 ⋅ log10gain
20⁢ln⁡575083ln⁡10
36.81179504
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
v≔a⁢t+v0
Substitute the given starting velocity.
vs ≔ vy|xv0 = 2.4ms
vs≔a⁢t+2.4⁢ms
Integrating this over time answers the first question.
x ≔x0 + ∫0t0vs ⅆt
x≔x0+0.5000000000⁢a⁢t02⁢sm2+2.400000000⁢t0⁢sm⁢m2s2
Starting at the origin and with the specified gravity:
gravity ≔ evalfScientificConstants:-Constantg, units;
gravity≔9.80665⁢ms2
xy|xx0 = 0m, a=−gravity
−4.903325000⁢t02⁢1m+2.400000000⁢t0⁢sm⁢m2s2
After 0.4 seconds, this is the location:
y|xt0 = 0.4s
0.1754680000⁢m
Return to Index for Example Worksheets
Download Help Document