This template uses Lua :
Usage
This template converts a population and area to a density.
{{Pop density|number of people|numerical value of area|unit of area|area unit to convert to
}}
Examples
{{Pop density|120|240|km2|sqmi
}} → " 0.500/km2 (1.29/sq mi)"
{{Pop density|1600|600|sqmi|km2
}} → " 2.67/sq mi (1.03/km2 )"
rounding
{{Pop density|120|240|km2|sqmi|prec=1
}} → " 0.5/km2 (1.3/sq mi)"
no conversion
{{Pop density|120|240|km2
}} → " 0.500/km2 "
reverse outputs
{{Pop density|1600|600|sqmi|km2|flip=on
}} → " 1.03/km2 (2.67/sq mi)"
give only raw numerical output
{{Pop density|120|240|km2|disp=num
}} → "0.500"
{{Pop density|1600|600|sqmi|disp=num
}} → "2.67"
{{Pop density|120|240|km2|sqmi|disp=num
}} → "1.29"
{{Pop density|1600|600|sqmi|km2|disp=num
}} → "1.03"
table
{| class="wikitable"
! Population !! Area (km<sup>2</sup>) !! Density (/km<sup>2</sup>)
|-
| {{pop density|120|2400|km2|disp=table}}
|}
Population
Area (km2 )
Density (/km2 )
120
2400
0.0500
{| class="wikitable"
! Population !! Area (km<sup>2</sup>) !! Density (/km<sup>2</sup>) !! Density (/sqmi)
|-
| {{pop density|120|2400|km2|sqmi|disp=table}}
|}
Population
Area (km2 )
Density (/km2 )
Density (/sqmi)
120
2400
0.0500
0.129
See also
Math templates
Conversions
convert many units (see: list ) cvt many units; abbreviated {{convert }} convinfobox for use in infoboxes bbl to t barrels of oil to tonnes long ton long hundredweights, quarters and pounds to kilograms; long tons and hundredweights to pounds and metric tons miles-chains miles and chains to kilometres linking "chains" rndfrac decimals to fractions
Notation
bigmath for stand-alone formulas, using a bigger font to match \displaystyle PNG-rendered TeX formulas bra–ket notation frac for creating fractions 3 ⁄5 (not for use in science or mathematical articles; instead, use {{sfrac }}
) intmath integral symbols angular brackets multiline delimiters (2–5 lines inclusive) math for short inline formulas mathcal [mathematical] calligraphic font for use in mathematical formulas, as an alternative to \mathcal{...} in LaTeX markup
mvar a short form to refer to individual italicized maths variables in normal text arbitrary characters/diacritics set above/below one another radic Radicals √2 sfrac for creating fractions 3 / 5 (this template should be used in science or mathematical articles instead of {{frac }}
) Subscripts and superscripts tmath wraps a TeX math expression in <math> tags val to report measurement values, uncertainties and units vec for various overarrows, underarrows, pointing left, right or both ways