You are on page 1of 13

unit

Physical units
collapse all in page

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax
unit::nam

Description
Objects such as unit::m, unit::kg, unit::sec etc. represent the physical units "meters",
"kilograms", "seconds" etc.
domain provides some methods for simplifying and converting arithmetical
expressions involving such units.
unit

objects such as unit::m or unit::kg serve for representing physical units. They
are domain objects of domain type unit.
unit

These objects behave like symbolic names (identifiers) and can be used to build
arithmetical expressions involving numbers and symbols such
as3*unit::m^2 or a*unit::cm + b*unit::inch^2/unit::mm. Units must be used
consistently in expressions, and should be specified for unknown variables so that the
variables themselves are dimensionless. In calls to solve, you should always solve for
dimensionless variables by specifying the dimensions. Cf. Example 3.
Expressions such as 20*unit::cm + 0.3*unit::m involving several units of the same type
(length,' mass,' time' etc.) are not simplified automatically.
Useunit::convert, unit::simplify, simplify, or Simplify to convert all subexpressions to
common units. These routines are described further down below.
On input, use the prefix unit:: as in unit::mm, unit::km for millimeters, kilometers etc.
On the screen, this prefix is stripped off. For example,1.23*unit::mm is displayed
as 1.23 mm.
The available units are listed further down below.
Note that some units such as unit::mm, unit::millimeter and unit::millimeters represent
the same physical unit. Use an interactive command such as info(unit::oz) to find
information on unit::oz including all the alternative names that can be used in MuPAD .
Cf. Example 7.

Note: Beware: If you mix different MuPAD units representing the same physical unit, no automatic simp
Use simplify to simplify an expression such as 2*unit::m + 3*unit::meter to 5*unit::m.
Expressions such as unit::kg*(unit::m/unit::s)^2 can be used to represent a composite
unit. You can convert them to other units such asunit::Joule via unit::convert.
Some of the conversion factors between the various units are given by exact rational
numbers (e.g., unit::inch = 127/50*unit::cm), while others are linked by floating-point

factors (e.g., unit::cal = 4.1868*unit::Joule). Use float to approximate exact values by


floats. Use numeric::rationalize to approximate floats by rational numbers.
Most system functions such as dif, factor, normal etc. accept expressions containing
units, treating the units like symbolic identifiers. See Example 9.
The available units are listed below. If the required unit is not available, you can
use unit::newUnit to add your own unit to the unit domain. See Example 4.
Length:

am, f (= Fermi

Ao

nm

My (= micron = microns

mm

dm

dam, hm, km (= kilometer

pt

ft (= foot

yd (= yard

AU (= AE), ly

ch, fm

li

= fermi), XU (= Xu = xu = XE), pm

(= Angstroem = angstroem = Angstrom = angstrom)


(= nanometer = nanometers)
= micrometer = micrometers)

(= millimeter = millimeters), cm (= centimeter = centimeters)

(= decimeter = decimeters), m (= meter = meters)


= kilometers), Mm, Gm, Tm, Pm, Em

(= point = points), inch (= inches = zoll = Zoll)


= feet), ft_US (= foot_US = feet_US)
= yards = Elle = Ellen), mile (= miles), nmile, inm (= INM)
(= lightyear = lightyears = Lj = lj), pc (= parsec)

(= fathom = fathoms), fur (= furlong = furlongs), gg, hand

(= link = links), line, mil, rod (= perch = pole), span

Mass:

ag, fg, pg, ng, mcg (= mcgram = mcgrams

mg

kg (= kilogram

t, kt, Mt, ct (= carat

oz (= ounce

= ounces = Unze = Unzen = unze = unzen)

lb (= pound

= pounds), stone, cwt (= sh_cwt)

cwt_UK

long_ton (= gross_ton), slug, gr, dr, quarter, cental

Pfd

dz

= microgram = micrograms)

(= milligram = milligrams), cg, dg, g (= gram = grams), hg


= kilograms), Mg, Gg, Tg, Pg, Eg
= Kt = Karat = karat)

(= long_cwt = gross_cwt), tn (= ton = short_ton), ton_UK

(= Pfund = pfund), Ztr (= Zentner = zentner)

(= Doppelzentner = doppelzentner)

Time:

as, fs, ps, ns

mcsec

ms

(= nsec = nanosec = nanosecond = nanoseconds)

(= mcsecond = mcseconds = microsec = microsecond = microseconds)

(= msec = millisec = millisecond = milliseconds), cs, ds

(= sec = second = seconds = Sekunde = Sekunden), das, hs, ks

Ms, Gs, Ts, Es, Ps, min

h (= hour

week

year

(= minute = minutes = Minute = Minuten)

= hours = Stunde = Stunden), d (= day = days = Tag = Tage)

(= weeks = Woche = Wochen), month (= months = Monat = Monate)

(= years = Jahr = Jahre)

Temperature:

K (= kelvin

Rankine

= Kelvin), Fahrenheit (= fahrenheit), Celsius (= celsius)

(= rankine), Reaumur (= reaumur)

Plain Angle:

degree

(= degrees), rad (= radian)

Solid Angle:

sr (= steradian)

Data Size, Storage Capacity:

bit (= Bit) kbit

byte

Tbyte

(= kBit), Mbit (= MBit), Gbit (= GBit), Tbit (= TBit)

(= Byte), kbyte (= kByte), Mbyte (= MByte), Gbyte (= GByte)


(= TByte)

Data Rate (Bits per Second):

bps

Signal Rate (= Frequency):

Bd (= Baud = baud)

Velocity:

knot, knot_UK, mach

Acceleration:

Gal, gn

Force:

aN, fN, nN, pN, mcN, mN, cN, dN, N

(= Newton = newton), daN, hN, kN, MN, G

TN, PN, EN, p (= pond = Pond), kp (= kilopond

ozf, tonf

= Kilopond), dyn, pdl, lbf

Torque (= Energy):

aNm, fNm, pNm, nNm, mcNm, mNm, cNm, dNm, Nm (= Newtonmeter


onmeter)
daNm, hNm, kNm, MNm, GNm, TNm, PNm, ENm, kpm

Angular Momentum:

aNms, fNms, pNms, nNms, mcNms, mNms, cNms, dNms

Nms

(= Newtonmetersec = newtonmetersec)

= newt

daNms, hNms, kNms, MNms, GNms, PNms, ENms, TNms

Energy, Work:

aJ

mJ

J (= Joule

kJ

(= kJoule = kjoule = kWs), MJ (= MJoule = Mjoule = MWs)

GJ

(= GWs), TJ (= TWs), PJ (= PWs), EJ (= EWs), Wh, kWh, MWh, GWh

cal

daeV, heV, keV, MeV, GeV, TeV, PeV, EeV, PSh, erg, Btu, therm

(= aWs), fJ (= fWs), pJ (= pWs), nJ (= nWs), mcJ (= mcWs = microWs)


(= mJoule = mjoule = mWs), cJ (= cWs), dJ (= dWs)
= joule = Ws), daJ (= daWs), hJ (= hWs)

(= Calory = calory), kcal, aeV, feV, peV, neV, mceV, meV, ceV, deV, eV

Power:

aW, fW, pW, nW, mcW

(= mcWatt = mcwatt = microW = microWatt = microwa

tt)

mW

kW

TW, PW, EW, PS, hp (= bhp)

(= mWatt = mwatt), cW, dW, W (= Watt = watt), daW, hW

(= kWatt = kwatt), MW (= MWatt = Mwatt), GW (= GWatt = Gwatt)

Frequency:

aHz, fHz, pHz, nHz, mcHz, mHz, cHz, dHz, Hz

kHz (= kHertz = khertz), MHz (= MHertz

GHz

(= Hertz = hertz), daHz, hHz

= Mhertz)

(= GHertz = Ghertz), THz, PHz, EHz

Pressure, Stress:

aPa, fPa, pPa, nPa, mcPa, mPa, cPa, dPa, Pa (= Pascal

daPa, hPa (= hPascal

mcbar

kbar

inH2O, ftH2O, mmHg, mHg, inHg, psi, Torr

= pascal)

= hpascal), kPa, MPa, GPa, TPa, PPa, EPa

(= mcBar = microbar = microBar), mbar (= mBar), bar (= Bar)

(= kBar), at (= ata = atu), atm, mmH2O (= mmWS), mH2O (= mWS)

Area:

a (= are

ro

= Ar), ac (= acre), b (= barn), ha (= hectare = Hektar)

(= rood), township, circ_mil, circ_inch

Volume:

al, fl, pl, nl, mcl, ml, cl, dl, l

hl, kl, Ml, Gl, Tl, Pl, El, gal

pottle, pint_UK, pk_UK, qt_UK, gill, gill_UK, floz, floz_UK, fldr, fldr_UK

minim, minim_UK, liq_qt, liq_pt, dry_bu, dry_pk, bbl, dry_gal, dry_qt, dry_pt

(= Liter = liter = Litre = litre), dal

(= gallon), gal_UK, barrel, bu_UK, chaldron

European Currency:

cent

(= Cent), EUR (= EURO = Euro), ATS, DEM (= DM), BEF, ESP, FIM, FRF, LUF

NLG, PTE, IEP, ITL

Molecular Substance:

fmol, amol, pmol, nmol, mcmol

mmol

Gmol, Tmol, Pmol, Emol

(= mcMol = micromol = microMol)

(= mMol), cmol, dmol, mol (= Mol), damol, hmol, kmol (= kMol), Mmol

Electric Current, Amperage:

aA, fA, pA, nA

mcA

(= nAmpere = nampere)

(= microA = microAmpere = microampere), mA (= mAmpere = mampere

cA, dA, A

TA, PA, EA, Bi

(= ampere = Ampere), daA, hA, kA (= kAmpere = kampere), MA, GA


(= Biot = biot), Gb (= Gilbert = gilbert)

Electric Voltage:

aV, fV, pV, nV

mcV

V (= Volt

kV (= kVolt = kvolt)

MV (= MVolt

(= nanoV = nVolt = nvolt)

(= microV = mcVolt = mcvolt), mV (= mVolt = mvolt), cV, dV


= volt), daV, hV
= Mvolt), GV (= GVolt = Gvolt), TV, PV, EV

Electric Resistance:

aOhm

mcOhm

mOhm

(= aohm), fOhm (= fohm), pOhm (= pohm), nOhm (= nohm)


(=mcohm = microOhm = microohm)

(= mohm = milliOhm = milliohm), dOhm (= dohm), cOhm (= cohm)

Ohm (= ohm), daOhm (= daohm), hOhm

(= hohm), kOhm (= kohm), MOhm (=

Mohm)

GOhm

(= Gohm), TOhm (= Tohm), POhm (= Pohm), EOhm (= Eohm)

Electric Charge:

aC, fC, pC, nC, mcC, mC, cC, dC, C

(= Coulomb = coulomb), daC, hC, kC, MC,

GC, TC

PC, EC

Electric Capacity:

aF, fF, pF

mcF

mF

kF

(= pFarad = pfarad), nF (= nFarad = nfarad)

(= mcFarad = mcfarad = microF = microFarad = microfarad)

(= mFarad = mfarad), cF, dF, F (= Farad = farad), daF, hF

(= kFarad = kfarad) , MF, GF, TF, PF, EF

Electric Conductance:

S (= Siemens

Magnetic Inductance:

= siemens)

H (= Henry

= henry)

Magnetic Flux Density, Magnetic Inductivity:

(= Tesla = tesla), G (= Gauss = gauss)

Magnetic Flux:

Wb (= Weber

= weber), M (= Maxwell = maxwell)

Magnetic Field Strength:

Oe

(= Oersted = oersted)

Magnetomotive Force (= Electric Current):

Gb

(= Gilbert = gilbert)

Luminous Intensity:

fcd, acd, pcd, ncd, mccd, mcd, ccd, dcd, cd (= candela

kcd, Mcd, Gcd, Tcd, Pcd, Ecd, HK, IK

= Candela), dacd, hcd

Luminance:

sb (= stilb), asb (= apostilb)

Luminous Flux:

lm (= lumen)

Illuminance:

lx

(= lux), ph (= phot), nx

Radiation:

langley

Radioactivity:

aBq, fBq, pBq, nBq, mcBq, mBq, cBq, dBq, Bq (= Becquerel

= becquerel), daB

hBq, kBq, MBq, GBq, TBq, PBq, EBq, Ci

(= Curie)

Equivalent Dosage:

aSv, fSv, pSv, nSv, mcSv, mSv, cSv, dSv

Sv (= Sievert

arem, frem, prem, nrem, mcrem, mrem, crem, drem

rem

= sievert), daSv, hSv, kSv, MSv, GSv, TSv, PSv, ESv

(= Rem), darem, hrem, krem, Mrem, Grem, Trem, Prem, Erem

Absorbed Dosage:

aGy,fGy,pGy,nGy,mcGy,mGy,cGy,dGy, Gy
y, GGy

TGy,PGy,EGy, rd

Ionising Dosage:

R (= Roentgen)

(= Gray = gray), daGy,hGy,kGy, MG

Lens Power:

dpt (= diopter

= dioptre)

Dynamic Viscosity:

P (= Poise)

Kinematic Viscosity:

St

(= Stokes)

Mass Per Length:

tex, den (= denier)

Examples
Example 1

Units not convertible are left alone by unit::convert:


unit::convert(1.23*unit::kg*unit::inch^2/unit::mm, unit::cm)

unit::convert(unit::km/unit::hour, unit::m/unit::sec)

Example 2
unit::simplify

favors kg over pounds:

unit::simplify(1.23*unit::kg^2/unit::pound*unit::inch^2/unit::mm)

Example 3

Specify units for unknown variables so that the variables you solve for are
dimensionless. If you apply units inconsistently, you get incorrect results.
Demonstrate this by omitting the unit for an unknown variable in an equation and
solving the equation. The solve function cannot solve the equation.
L := 1*unit::m:
y := 0.1*unit::m:
f := y - x*cos(L/x):
solve(f,x)

Solve the equation for the unknown variable by specifying the correct unit for the
variable.
f := y - x*unit::m*cos(L/(x*unit::m)):
solve(f,x)

Example 4

We add new velocity units to the unit domain:


unit::newUnit(SpeedOfLight = 300000*unit::km/unit::sec)

Now, the unit unit::SpeedOfLight exists and can be used like any other unit in
the unit domain. We use it to define yet another velocity unit:
unit::newUnit(Warp9 = 1.516*unit::SpeedOfLight)

We convert the velocity of 123.4 miles per hour into the new speed units:
unit::convert(123.4*unit::mile/unit::hour, unit::SpeedOfLight)

unit::convert(123.4*unit::mile/unit::hour, unit::Warp9)

We verify the new units:


unit::convert(unit::SpeedOfLight, unit::km/unit::sec)

unit::convert(unit::Warp9, unit::SpeedOfLight)

unit::convert(unit::Warp9, unit::km/unit::sec)

Example 5

We create a symbolic expression involving different units of type length':


27*unit::cm + 30*unit::mm

This expression is not simplified automatically. We apply simplify:


simplify(%)

We convert this length to inch:


unit::convert(%, unit::inch)

float(%)

Here is another example for simplification and conversion:


1234*unit::g + 1.234*unit::kg*unit::m^2/unit::inch^2

simplify(%)

unit::convert(%, unit::ounce)

The target unit in unit::convert may be an expression:


unit::convert(unit::pound*unit::km/unit::hour,
unit::kg*unit::m/unit::s)

Example 6

The probably most interesting method of the unit domain is the conversion
routine unit::convert. Given any expression involving units, you can specify a target
unit which is to be used to express the units:
unit::convert(unit::ounce, unit::kilogram)

The target unit needs not be of the same physical type as the expression that is to be
rewritten. In the following example, we wish to rewrite a torque (given in "Newton
meters") in terms of units involving the power unit "Watt." Note that a torque is an
energy, i.e., "power" multiplied by "time":
unit::convert(1.23*unit::Nm, unit::W)

We wish to rewrite "Newton meters" in terms of units involving "centimeters":


unit::convert(unit::Nm, unit::cm)

The target unit may be a composite expression. We wish to rewrite "Newton meters" in
terms of "grams," "centimeters," and "milliseconds":
unit::convert(unit::Nm, unit::g*unit::cm^2/unit::msec^2)

Example 7
The info command

provides information on units. In particular, it lists alternative names


that can be used in MuPAD:
info(unit::nm)
nanometer: a length unit
Alternative names: unit::nanom, unit::nanometer, unit::nanometers, unit::nm
info(unit::Joule)
joule: a unit of energy
Alternative names: unit::J, unit::Joule, unit::Newtonmeter, unit::Nm, unit::Ws,
unit::joule, unit::newtonmeter
Example 8
We use unit::convert2SIunits

to convert a mass expressed in non-metric units to SI base

units:
mass := 2*unit::cal*unit::msec^2/unit::inch^2 - 45*unit::carat

unit::convert2SIunits(mass)

delete mass:
Example 9

Most system functions such as dif, factor, normal etc. treat units like ordinary symbolic
identifiers:
dif(x/unit::m*exp(-x^2/unit::m^2), x)

factor(%)

normal((4*unit::m^2 - a^2*unit::m^2)/(2*unit::m - a*unit::m))

Parameters
The name of the physical unit, see the list below. Some units
such as unit::mm and unit::millimeter represent the same
physical unit.

nam

Methods
collapse all

convert Convert an expression to other units


convert(x, targetunit) converts all units in the arithmetical expression x to multiples of
the targetunit if possible. The targetunit may be one of the unit objects of type length,'
mass' etc. It may also be an arithmetical expression such as unit::km/unit::sec. In this
case, x is rewritten in terms of the units found in targetunit.
convert2SIunits Rewrite to SI units
convert2SIunits(x) rewrites all units in

the arithmetical expression x in terms of

corresponding SI base units.


simplify Combine like units in an expression
unit:: simplify(x) converts all units in the arithmetical expression x to some basic unit
found in x, i.e., all length units are expressed by the same length unit, all mass units are

expressed by the same mass unit, all time units are expressed by the same time unit etc.
newUnit Define a new unit
newUnit(newname = expression)
unit::newUnit(newname = f*oldunit) creates a new unit that may be addressed
by unit::newname. Its name newname must be an identifier. It is declared as the f-fold
of some unit oldunit that must be an expression such as unit::mm/unit::sec involving

units provided by the unit domain. The conversion factor f must be an arithmetical
expression (typically, a numerical conversion factor).
display Format for output

formats the screen output of the arithmetical expression x such that the units
appear as a separate factor at the end of each term.
display(x)

findUnits Find all units in expression


findUnits(x)

returns a set of all units found in the arithmetical expression x.

Celsius2Fahrenheit Convert degrees Celsius to degrees Fahrenheit

converts a numerical value x representing a temperature in


degrees Celsius into a numerical value representing this temperature in degrees
Fahrenheit.
unit::Celsius2Fahrenheit(x)

Celsius2Kelvin Convert degrees Celsius to Kelvin

converts a numerical value x representing a temperature in


degrees Celsius into a numerical value representing this temperature in degrees Kelvin.
unit::Celsius2Kelvin(x)

Celsius2Rankine Convert degrees Celsius to degrees Rankine

converts a numerical value x representing a temperature in


degrees Celsius into a numerical value representing this temperature in degrees
Rankine.
unit::Celsius2Rankine(x)

Celsius2Reaumur Convert degrees Celsius to degrees Reaumur

converts a numerical value x representing a temperature in


degrees Celsius into a numerical value representing this temperature in degrees
Reaumur.
unit::Celsius2Reaumur(x)

Fahrenheit2Celsius Convert degrees Fahrenheit to degrees Celsius

converts a numerical value x representing a temperature in


degrees Fahrenheit into a numerical value representing this temperature in degrees
Celsius.
unit::Fahrenheit2Celsius(x)

Fahrenheit2Kelvin Convert degrees Fahrenheit to Kelvin

converts a numerical value x representing a temperature in


degrees Fahrenheit into a numerical value representing this temperature in degrees
Kelvin.
unit::Fahrenheit2Kelvin(x)

Fahrenheit2Rankine Convert degrees Fahrenheit to degrees Rankine

converts a numerical value x representing a temperature in


degrees Fahrenheit into a numerical value representing this temperature in degrees
Rankine.
unit::Fahrenheit2Rankine(x)

Fahrenheit2Reaumur Convert degrees Fahrenheit to degrees Reaumur

converts a numerical value x representing a temperature


in degrees Fahrenheit into a numerical value representing this temperature in degrees
Reaumur.
unit::Fahrenheit2Reaumur(x)

Kelvin2Fahrenheit Convert Kelvin to degrees Fahrenheit

converts a numerical value x representing a temperature in


degrees Kelvin into a numerical value representing this temperature in degrees
Fahrenheit.
unit::Kelvin2Fahrenheit(x)

Kelvin2Celsius Convert Kelvin to degrees Celsius

converts a numerical value x representing a temperature in


degrees Kelvin into a numerical value representing this temperature in degrees Celsius.
unit::Kelvin2Celsius(x)

Kelvin2Rankine Convert Kelvin to degrees Rankine

converts a numerical value x representing a temperature in


degrees Kelvin into a numerical value representing this temperature in degrees Rankine.
unit::Kelvin2Rankine(x)

Kelvin2Reaumur Convert Kelvin to degrees Reaumur

converts a numerical value x representing a temperature in


degrees Kelvin into a numerical value representing this temperature in degrees
Reaumur.
unit::Kelvin2Reaumur(x)

Rankine2Fahrenheit Convert degrees Rankine to degrees Fahrenheit

converts a numerical value x representing a temperature in


degrees Rankine into a numerical value representing this temperature in degrees
Fahrenheit.
unit::Rankine2Fahrenheit(x)

Rankine2Kelvin Convert degrees Rankine to Kelvin

converts a numerical value x representing a temperature in


degrees Rankine into a numerical value representing this temperature in degrees Kelvin.
unit::Rankine2Kelvin(x)

Rankine2Celsius Convert degrees Rankine to degrees Celsius

converts a numerical value x representing a temperature in


degrees Rankine into a numerical value representing this temperature in degrees
Celsius.
unit::Rankine2Celsius(x)

Rankine2Reaumur Convert degrees Rankine to degrees Reaumur

converts a numerical value x representing a temperature in


degrees Rankine into a numerical value representing this temperature in degrees
Reaumur.
unit::Rankine2Reaumur(x)

Reaumur2Fahrenheit Convert degrees Reaumur to degrees Fahrenheit

converts a numerical value x representing a temperature


in degrees Reaumur into a numerical value representing this temperature in degrees
Fahrenheit.
unit::Reaumur2Fahrenheit(x)

Reaumur2Kelvin Convert degrees Reaumur to Kelvin

converts a numerical value x representing a temperature in


degrees Reaumur into a numerical value representing this temperature in degrees
Kelvin.
unit::Reaumur2Kelvin(x)

Reaumur2Rankine Convert degrees Reaumur to degrees Rankine

converts a numerical value x representing a temperature in


degrees Reaumur into a numerical value representing this temperature in degrees
Rankine.
unit::Reaumur2Rankine(x)

Reaumur2Celsius Convert degrees Reaumur to degrees Celsius

converts a numerical value x representing a temperature in


degrees Reaumur into a numerical value representing this temperature in degrees
Celsius.
unit::Reaumur2Celsius(x)

You might also like