diff --git a/docs/Project.toml b/docs/Project.toml index 418f2c7b..fa0f1fc5 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -4,7 +4,9 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" +OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" [compat] Documenter = "1" Latexify = "0.16" +OrderedCollections = "1.6" diff --git a/docs/make.jl b/docs/make.jl index f9695384..e2877ec2 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,11 +1,31 @@ using Documenter, Unitful, Dates +const ci = get(ENV, "CI", nothing) == "true" + +function check_defaultunits_version() + vfile = "docs/src/assets/vfile.txt" + r = readline(vfile) + docs_v = VersionNumber(r) + pkg_v = pkgversion(Unitful) + docs_v == pkg_v || error("Docs chapter on default units built with the wrong version of Unitful \ + (docs built for $docs_v vs current Unitful version $pkg_v). \ + Please run the script on the local computer with the proper Unitful version") + return nothing +end + +# on local computer, (re-)create the documentation file defaultunits.md +if !ci + ENV["UNITFUL_FANCY_EXPONENTS"] = false + include("make_def-units_docs.jl") + MakeDefUnitsDocs.make_chapter() +end + DocMeta.setdocmeta!(Unitful, :DocTestSetup, :(using Unitful)) makedocs( sitename = "Unitful.jl", - format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"), - warnonly = [:missing_docs], + format = Documenter.HTML(prettyurls = ci), + warnonly = [:missing_docs, :doctest], modules = [Unitful], workdir = joinpath(@__DIR__, ".."), pages = [ @@ -21,9 +41,12 @@ makedocs( "Interoperability with `Dates`" => "dates.md" "Extending Unitful" => "extending.md" "Troubleshooting" => "trouble.md" - "Pre-defined units and constants" => "defaultunits.md" + "Pre-defined dimensions, units, and constants" => "defaultunits.md" "License" => "LICENSE.md" ] ) -deploydocs(repo = "github.com/PainterQubits/Unitful.jl.git") +if ci + check_defaultunits_version() + deploydocs(repo = "github.com/PainterQubits/Unitful.jl.git") +end diff --git a/docs/make_def-units_docs.jl b/docs/make_def-units_docs.jl new file mode 100644 index 00000000..eae2c216 --- /dev/null +++ b/docs/make_def-units_docs.jl @@ -0,0 +1,336 @@ +module MakeDefUnitsDocs + +using Unitful, OrderedCollections + +mdfile = "docs/src/defaultunits.md" +mdheader = "docs/src/assets/defaultunits-header.md" +mdfooter = "docs/src/assets/defaultunits-footer.md" +mdlogunits = "docs/src/assets/defaultunits-logunits.md" +vfile = "docs/src/assets/vfile.txt" + +""" +# Examples +```julia-repl +julia> prefnamesvals() +OrderedCollections.OrderedDict{String, Tuple{String, Int64}} with 20 entries: + "y" => ("yocto", -24) + "z" => ("zepto", -21) + โ‹ฎ => โ‹ฎ +""" +function prefnamesvals() + prefixnames = Dict( + "Q" => "quetta", + "R" => "ronna", + "Y" => "yotta", + "Z" => "zetta", + "E" => "exa", + "P" => "peta", + "T" => "tera", + "G" => "giga", + "M" => "mega", + "k" => "kilo", + "h" => "hecto", + "da" => "deca", + "d" => "deci", + "c" => "centi", + "m" => "milli", + "ฮผ" => "micro", + "n" => "nano", + "p" => "pico", + "f" => "femto", + "a" => "atto", + "z" => "zepto", + "y" => "yocto", + "r" => "ronto", + "q" => "quecto") + pd = Unitful.prefixdict + sxp = sort(collect(keys(pd))) + + return OrderedDict(pd[k] => (prefixnames[pd[k]], k) for k in sxp if pd[k] != "") +end + +regularid(n) = !startswith(string(n), r"#|@") + +uful_ids() = filter(regularid, names(Unitful; all=true)) + +docstr(n::Symbol) = Base.Docs.doc(Base.Docs.Binding(Unitful, n)) |> string + +isprefixed(u::Symbol) = occursin("A prefixed unit, equal", docstr(u)) + +isdocumented(n::Symbol) = !startswith(docstr(n), "No documentation found") + +""" + getphysdims(uids::Vector{Symbol}) +Filters the list of `Unitful` identifiers to return those which denote physical dimensions (e.g. `Area`, `Power`) +""" +getphysdims(uids) = filter(isphysdim, uids) + +isphysdim(n::Symbol) = _isphysdim(getproperty(Unitful, n)) +_isphysdim(_) = false +_isphysdim(::Type{Union{Quantity{T,D,U}, Level{L,S,Quantity{T,D,U}} where {L,S}} where {T,U}}) where D = true + +""" +# Examples +```julia-repl +julia> getdim(Unitful.Area) +๐‹^2 +``` +""" +getdim(::Type{Union{Quantity{T,D,U}, Level{L,S,Quantity{T,D,U}} where {L,S}} where {T,U}}) where D = D +getdim(x::Symbol) = getdim(getproperty(Unitful, x)) + +""" +# Examples +```julia-repl +julia> getdimpars(Unitful.Power) +svec((Unitful.Dimension{:Length}(2//1), Unitful.Dimension{:Mass}(1//1), Unitful.Dimension{:Time}(-3//1))) +``` +""" +getdimpars(x) = getdimpars(getdim(x)) +getdimpars(::Unitful.Dimensions{N}) where N = N + +getdimpow(x) = only(getdimpars(x)).power + +isbasicdim(x) = length(getdimpars(x)) == 1 && getdimpow(x) == 1 + +function physdims_categories(physdims) + basicdims = Symbol[] + compounddims = Symbol[] + otherdims = Symbol[] + for d in physdims + try + if isbasicdim(d) + push!(basicdims, d) + else + push!(compounddims, d) + end + catch + push!(otherdims, d) + end + end + return (;basicdims, compounddims, otherdims, ) +end + +""" +# Examples +```julia-repl +julia> unitsdict(basicdims, uids) +OrderedCollections.OrderedDict{Symbol, Vector{Symbol}} with 7 entries: + :Amount => [:mol] + :Current => [:A] + :Length => [:angstrom, :ft, :inch, :m, :mi, :mil, :yd] + :Luminosity => [:cd, :lm] + :Mass => [:dr, :g, :gr, :kg, :lb, :oz, :slug, :u] + :Temperature => [:K, :Ra, :ยฐC, :ยฐF] + :Time => [:d, :hr, :minute, :s, :wk, :yr] +``` +""" +function unitsdict(physdims, uids) + ups = [] + for d in physdims + dm = getproperty(Unitful, d) + units = Symbol[] + for uname in uids + u = getproperty(Unitful, uname) + if (u isa Unitful.Units) + if (1*u isa dm) && (!isprefixed(uname) || uname == :g) && isdocumented(uname) # gram considered prefixed unit + push!(units, uname) + end + end + end + if !isempty(units) + sort!(units; by = x -> lowercase(string(x))) + unique!(nameofunit, units) # special cases: Liter, Angstrom + push!(ups, d => units) + end + end + return OrderedDict(sort!(ups)) +end + +function physconstants(uids) + ph_consts = [n for n in uids if + isconst(Unitful, n) && + (getproperty(Unitful, n) isa Quantity) && + isdocumented(n) ] + sort!(ph_consts, by = x -> lowercase(string(x))) + return ph_consts +end + +mutable struct PhysConst + symbol::Symbol + allsymbols::Set{Symbol} + mark4del::Bool +end + +equiv(pc1::PhysConst, pc2::PhysConst) = getproperty(Unitful, pc1.symbol) === getproperty(Unitful, pc2.symbol) + +Base.string(pc::PhysConst) = join((pc.allsymbols |> collect .|> string |> sort), ", ") + +function merge_duplicate_constants(ph_consts) + pcarr = [PhysConst(s, Set([s]), false) for s in ph_consts] + for i in 1:lastindex(pcarr)-1 + pcarr[i].mark4del && continue + for j in i+1:lastindex(pcarr) + pcarr[j].mark4del && continue + if equiv(pcarr[i], pcarr[j]) + push!(pcarr[i].allsymbols, pcarr[j].symbol) + pcarr[j].mark4del=true + end + end + end + filter!(pc -> !pc.mark4del, pcarr) +end + +function isnodims(u) + u isa Unitful.FreeUnits || return false + return dimension(u) == NoDims +end +isnodims(u::Symbol) = isnodims(getproperty(Unitful, u)) + +nodimsunits(uids) = [n for n in uids if isnodims(n) && isdocumented(n) && !isprefixed(n) && n != :NoUnits] + +removerefs(d) = replace(d, r"\[(`[\w\.]+\`)]\(@ref\)" => s"\1") + +""" + udoc(s::Symbol) +Truncates documentation of a unit and removes references +""" +function udoc(s) + m = match(r"(?ms)(.+)\n\nDimension: ", docstr(s)) + isnothing(m) && return nothing + return m.captures[1] |> removerefs +end + +udoc(pc::PhysConst) = udoc(pc.symbol) + +""" + dimdoc(s::Symbol) + dimdoc(s::AbstractString) +Truncates documentation of a dimension and removes references +""" +function dimdoc(s::Symbol) + doctxt = match(r"(supertype for .+)with a value", docstr(s)).captures[1] |> removerefs |> strip |> uppercasefirst + return "```\nUnitful.$s\n```\n\n$(doctxt)\n\n" +end + +dimdoc(s::AbstractString) = dimdoc(s |> Symbol) + +function nameofunit(u) + special = Dict(u"ha" => "Hectare", u"kg" => "Kilogram", u"ยฐF" => "Degree Fahrenheit", u"ยฐC" => "Degree Celcius") + u in keys(special) && return special[u] + return string(_nameofunit(u)) +end + +nameofunit(s::Symbol) = nameofunit(getproperty(Unitful, s)) + +_nameofunit(::Unitful.Units{N}) where N = _nameofunit(only(N)) +_nameofunit(::Unitful.Unit{U}) where U = U + +function make_subsection_text(uvec; isunit=true) + s = "" + for u in uvec + if isunit + n = nameofunit(u) + else + n = string(u) + end + d = udoc(u) + s *= "#### $n\n\n$d\n\n" + end + return s +end + +function make_simple_section_text(sectiontitle, uvec; isunit=true) + s = "## $sectiontitle\n\n" + s *= make_subsection_text(uvec; isunit) + return s +end + +function make_structured_section_text(sectiontitle, sectiondict) + s = "## $sectiontitle\n\n" + for (dim, uvec) in sectiondict + s *= "### $dim\n\n" + s *= dimdoc(dim) + s *= make_subsection_text(uvec) + end + return s +end + +function makeprefixsection(pnv) + s = """ +## Metric (SI) Prefixes + +| Prefix | Name | Power of Ten | +|--------|--------|--------| +""" + for (k,v) in pnv + s *= "| $k | $(v[1]) | $(v[2]) |\n" + end + + return s +end + + +header() = read(mdheader, String) +footer() = read(mdfooter, String) +logunits() = read(mdlogunits, String) + +function makefulltext(sections, nodims_units, phys_consts) + s = header() * "\n\n" + for (sectiontitle, sectiondict) in sections + s *= make_structured_section_text(sectiontitle, sectiondict) + end + s *= make_simple_section_text("Dimensionless units", nodims_units) + s *= logunits() + s *= make_simple_section_text("Physical constants", phys_consts |> merge_duplicate_constants; isunit=false) + s *= makeprefixsection(prefnamesvals()) + s *= footer() + return s +end + +function write_unitful_v(vfile) + open(vfile, "w") do io + println(io, pkgversion(Unitful)) + end + return nothing +end + +function savetext(fulltext, mdfile) + open(mdfile,"w") do io + write(io, fulltext) + end + write_unitful_v(vfile) + return nothing +end + +""" + make_chapter(wr = true; verbose = false) +Generates the text of the `Pre-defined units and constants` documentation section +and writes it into the file if `wr==true` +""" +function make_chapter(wr = true; verbose = false) + uids = uful_ids() + + (;basicdims, compounddims) = uids |> getphysdims |> physdims_categories + + basic_units = unitsdict(basicdims, uids) + compound_units = unitsdict(compounddims, uids) + nodims_units = nodimsunits(uids) + sections = OrderedDict(["Base dimensions" => basic_units, + "Derived dimensions" => compound_units]) + phys_consts = physconstants(uids) + + fulltext = makefulltext(sections, nodims_units, phys_consts) + + wr && savetext(fulltext, mdfile) + + if verbose + return (;fulltext, sections, nodims_units, phys_consts) + else + return nothing + end +end + +export make_chapter + +end # module diff --git a/docs/src/assets/defaultunits-footer.md b/docs/src/assets/defaultunits-footer.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/src/assets/defaultunits-header.md b/docs/src/assets/defaultunits-header.md new file mode 100644 index 00000000..e2ac90ce --- /dev/null +++ b/docs/src/assets/defaultunits-header.md @@ -0,0 +1,16 @@ +# Pre-defined units and ัonstants + +In the following, only non-prefixed units are listed. To get a more detailed information about a unit, and to get information about prefixed units, use `Julia` help, e.g. + +``` +help?> Unitful.kW + Unitful.kW + + A prefixed unit, equal to 10^3 W. + + Dimension: ๐‹ยฒ ๐Œ ๐“โปยณ + + See also: Unitful.W. +``` + +For prefixes, see [below](#Metric-(SI)-Prefixes). diff --git a/docs/src/assets/defaultunits-logunits.md b/docs/src/assets/defaultunits-logunits.md new file mode 100644 index 00000000..5d5317ed --- /dev/null +++ b/docs/src/assets/defaultunits-logunits.md @@ -0,0 +1,22 @@ +## Logarithmic units + +| Unit | Name | +|----------------|---------------------------------| +| `dB` | Decibel | +| `B` | Bel | +| `Np` | Neper | +| `cNp` | Centineper | + +### Log units related to reference levels +| Unit | Reference level | +|----------------|---------------------------------| +| `dBHz` | 1Hz | +| `dBm` | 1mW | +| `dBV` | 1V | +| `dBu` | sqrt(0.6)V | +| `dBฮผV` | 1ฮผV | +| `dBSPL` | 20ฮผPa | +| `dBFS` | RootPowerRatio(1) | +| `dBฮฉ` | 1ฮฉ | +| `dBS` | 1S | + diff --git a/docs/src/assets/vfile.txt b/docs/src/assets/vfile.txt new file mode 100644 index 00000000..49e0a31d --- /dev/null +++ b/docs/src/assets/vfile.txt @@ -0,0 +1 @@ +1.23.1 diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index 6ce91e3f..69a6575c 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -20,6 +20,12 @@ For prefixes, see [below](#Metric-(SI)-Prefixes). ### Amount +``` +Unitful.Amount +``` + +Supertype for quantities and levels of dimension `Unitful.๐` + #### Mole ``` @@ -30,6 +36,12 @@ The mole, the SI base unit for amount of substance. ### Current +``` +Unitful.Current +``` + +Supertype for quantities and levels of dimension `Unitful.๐ˆ` + #### Ampere ``` @@ -40,6 +52,12 @@ The ampere, the SI base unit of electric current. ### Length +``` +Unitful.Length +``` + +Supertype for quantities and levels of dimension `Unitful.๐‹` + #### Angstrom ``` @@ -99,6 +117,12 @@ The yard, a US customary unit of length defined as 3 ft. ### Luminosity +``` +Unitful.Luminosity +``` + +Supertype for quantities and levels of dimension `Unitful.๐‰` + #### Candela ``` @@ -107,8 +131,22 @@ Unitful.cd The candela, the SI base unit of luminous intensity. +#### Lumen + +``` +Unitful.lm +``` + +The lumen, an SI unit of luminous flux, defined as 1 cd ร— sr. + ### Mass +``` +Unitful.Mass +``` + +Supertype for quantities and levels of dimension `Unitful.๐Œ` + #### Dram ``` @@ -175,6 +213,12 @@ The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass ### Temperature +``` +Unitful.Temperature +``` + +Supertype for quantities and levels of dimension `Unitful.๐šฏ` + #### Kelvin ``` @@ -209,6 +253,12 @@ The degree Fahrenheit, a US customary unit of temperature, defined such that 0 ### Time +``` +Unitful.Time +``` + +Supertype for quantities and levels of dimension `Unitful.๐“` + #### Day ``` @@ -261,6 +311,12 @@ The year, a unit of time, defined as 365.25 d. ### Acceleration +``` +Unitful.Acceleration +``` + +Supertype for quantities and levels of dimension `๐‹ / ๐“ ^ 2` + #### Gal ``` @@ -281,6 +337,12 @@ The nominal acceleration due to gravity in a vacuum near the surface of the eart ### Area +``` +Unitful.Area +``` + +Supertype for quantities and levels of dimension `๐‹ ^ 2` + #### Are ``` @@ -315,6 +377,12 @@ The hectare, a metric unit of area, defined as 100 a. ### BField +``` +Unitful.BField +``` + +Supertype for quantities and levels of dimension `๐ˆ ^ -1 * ๐Œ * ๐“ ^ -2` + #### Gauss ``` @@ -333,6 +401,12 @@ The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A ร— s^2) ### Capacitance +``` +Unitful.Capacitance +``` + +Supertype for quantities and levels of dimension `๐ˆ ^ 2 * ๐‹ ^ -2 * ๐Œ ^ -1 * ๐“ ^ 4` + #### Farad ``` @@ -343,6 +417,12 @@ The farad, an SI unit of electrical capacitance, defined as 1 s^4 ร— A^2 / (kg ### Charge +``` +Unitful.Charge +``` + +Supertype for quantities and levels of dimension `๐ˆ * ๐“` + #### Coulomb ``` @@ -353,6 +433,12 @@ The coulomb, an SI unit of electric charge, defined as 1 A ร— s. ### DynamicViscosity +``` +Unitful.DynamicViscosity +``` + +Supertype for quantities and levels of dimension `๐Œ * ๐‹ ^ -1 * ๐“ ^ -1` + #### Poise ``` @@ -363,6 +449,12 @@ The poise, a CGS unit of dynamic viscosity, defined as 1 dyn ร— s / cm^2. ### ElectricalConductance +``` +Unitful.ElectricalConductance +``` + +Supertype for quantities and levels of dimension `๐ˆ ^ 2 * ๐‹ ^ -2 * ๐Œ ^ -1 * ๐“ ^ 3` + #### Siemens ``` @@ -373,6 +465,12 @@ The siemens, an SI unit of electrical conductance, defined as 1 ฮฉ^-1. ### ElectricalResistance +``` +Unitful.ElectricalResistance +``` + +Supertype for quantities and levels of dimension `๐ˆ ^ -2 * ๐‹ ^ 2 * ๐Œ * ๐“ ^ -3` + #### Ohm ``` @@ -383,6 +481,12 @@ The ohm, an SI unit of electrical resistance, defined as 1 V / A. ### Energy +``` +Unitful.Energy +``` + +Supertype for quantities and levels of dimension `(๐Œ * ๐‹ ^ 2) / ๐“ ^ 2` + #### BritishThermalUnit ``` @@ -425,6 +529,12 @@ The joule, an SI unit of energy, defined as 1 N ร— m. ### Force +``` +Unitful.Force +``` + +Supertype for quantities and levels of dimension `(๐Œ * ๐‹) / ๐“ ^ 2` + #### Dyne ``` @@ -451,6 +561,12 @@ The newton, an SI unit of force, defined as 1 kg ร— m / s^2. ### Frequency +``` +Unitful.Frequency +``` + +Supertype for quantities and levels of dimension `inv(๐“)` + #### Becquerel ``` @@ -493,6 +609,12 @@ Revolutions per second, a unit of rotational speed, defined as 2ฯ€ rad / s. ### HField +``` +Unitful.HField +``` + +Supertype for quantities and levels of dimension `๐ˆ / ๐‹` + #### Oersted ``` @@ -503,6 +625,12 @@ The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4ฯ€ ### Inductance +``` +Unitful.Inductance +``` + +Supertype for quantities and levels of dimension `๐ˆ ^ -2 * ๐‹ ^ 2 * ๐Œ * ๐“ ^ -2` + #### Henry ``` @@ -513,6 +641,12 @@ The henry, an SI unit of electrical inductance, defined as 1 J / A^2. ### KinematicViscosity +``` +Unitful.KinematicViscosity +``` + +Supertype for quantities and levels of dimension `๐‹ ^ 2 * ๐“ ^ -1` + #### Stokes ``` @@ -521,17 +655,13 @@ Unitful.St The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. -### Luminous flux - -#### Lumen +### MagneticFlux ``` -Unitful.lm +Unitful.MagneticFlux ``` -The lumen, an SI unit of luminous flux, defined as 1 cd ร— sr. - -### MagneticFlux +Supertype for quantities and levels of dimension `๐ˆ ^ -1 * ๐‹ ^ 2 * ๐Œ * ๐“ ^ -2` #### Maxwell @@ -551,6 +681,12 @@ The weber, an SI unit of magnetic flux, defined as 1 kg ร— m^2 / (A ร— s^2). ### MolarFlow +``` +Unitful.MolarFlow +``` + +Supertype for quantities and levels of dimension `๐ / ๐“` + #### Katal ``` @@ -561,6 +697,12 @@ The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed subst ### Molarity +``` +Unitful.Molarity +``` + +Supertype for quantities and levels of dimension `๐ / ๐‹ ^ 3` + #### Molar ``` @@ -571,6 +713,12 @@ A unit for measuring molar concentration, equal to 1 mol/L. ### Power +``` +Unitful.Power +``` + +Supertype for quantities and levels of dimension `๐‹ ^ 2 * ๐Œ * ๐“ ^ -3` + #### Watt ``` @@ -581,6 +729,12 @@ The watt, an SI unit of power, defined as 1 J / s. ### Pressure +``` +Unitful.Pressure +``` + +Supertype for quantities and levels of dimension `๐Œ * ๐‹ ^ -1 * ๐“ ^ -2` + #### Atmosphere ``` @@ -631,6 +785,12 @@ The torr, a unit of pressure, defined as 1/760 atm. ### Velocity +``` +Unitful.Velocity +``` + +Supertype for quantities and levels of dimension `๐‹ / ๐“` + #### SpeedOfLight ``` @@ -643,6 +803,12 @@ The speed of light in a vacuum, a unit of speed, defined as exactly 2.997,924,58 ### Voltage +``` +Unitful.Voltage +``` + +Supertype for quantities and levels of dimension `๐ˆ ^ -1 * ๐‹ ^ 2 * ๐Œ * ๐“ ^ -3` + #### Volt ``` @@ -653,6 +819,12 @@ The volt, an SI unit of electric potential, defined as 1 W / A. ### Volume +``` +Unitful.Volume +``` + +Supertype for quantities and levels of dimension `๐‹ ^ 3` + #### Liter ``` @@ -773,57 +945,26 @@ The degree, a unit of angle. There are 360ยฐ in a circle. | `dBFS` | RootPowerRatio(1) | | `dBฮฉ` | 1ฮฉ | | `dBS` | 1S | -## Physical constants - -#### G -``` -Unitful.G -``` - -A quantity representing the universal gravitational constant, equal to 6.674,30 ร— 10^-11 m^3 / (kg ร— s^2) (the CODATA 2018 recommended value). - -#### Na - -``` -Unitful.Na -``` - -A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 ร— 10^23 / mol. - -#### R - -``` -Unitful.R -``` - -A quantity representing the molar gas constant, defined as Na ร— k. +## Physical constants -#### Rโˆž +#### c0 ``` -Unitful.Rโˆž +Unitful.c0 ``` -A quantity representing the Rydberg constant, equal to 1.097,373,156,8160 ร— 10^-7 / m (the CODATA 2018 recommended value). - -#### Z0 - -``` -Unitful.Z0 -``` +A quantity representing the speed of light in a vacuum, defined as exactly 2.997,924,58 ร— 10^8 m/s. -A quantity representing the impedance of free space, a constant defined as ฮผ0 ร— c. +`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. -#### c0 +#### G ``` -Unitful.c0 +Unitful.G ``` -A quantity representing the speed of light in a vacuum, defined as exactly 2.997,924,58 ร— 10^8 m/s. - -`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. +A quantity representing the universal gravitational constant, equal to 6.674,30 ร— 10^-11 m^3 / (kg ร— s^2) (the CODATA 2018 recommended value). #### gn @@ -875,6 +1016,14 @@ Unitful.mp A quantity representing the rest mass of a proton, equal to 1.672,621,923,69 ร— 10^-27 kg (the CODATA 2018 recommended value). +#### Na + +``` +Unitful.Na +``` + +A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 ร— 10^23 / mol. + #### q ``` @@ -883,21 +1032,37 @@ Unitful.q A quantity equal to the elementary charge, the charge of a single electron, with a value of exactly 1.602,176,634 ร— 10^-19 C. The letter `q` is used instead of `e` to avoid confusion with Euler's number. -#### ฤง +#### R ``` -Unitful.ฤง +Unitful.R ``` -A quantity representing the reduced Planck constant, defined as h / 2ฯ€. +A quantity representing the molar gas constant, defined as Na ร— k. -#### ฮฆ0 +#### Rโˆž ``` -Unitful.ฮฆ0 +Unitful.Rโˆž ``` -A quantity representing the superconducting magnetic flux quantum, defined as h / (2 ร— q). +A quantity representing the Rydberg constant, equal to 1.097,373,156,8160 ร— 10^-7 / m (the CODATA 2018 recommended value). + +#### Z0 + +``` +Unitful.Z0 +``` + +A quantity representing the impedance of free space, a constant defined as ฮผ0 ร— c. + +#### ฤง + +``` +Unitful.ฤง +``` + +A quantity representing the reduced Planck constant, defined as h / 2ฯ€. #### ฮต0, ฯต0 @@ -932,6 +1097,14 @@ Unitful.ฯƒ A quantity representing the Stefan-Boltzmann constant, defined as ฯ€^2 ร— k^4 / (60 ร— ฤง^3 ร— c^2). +#### ฮฆ0 + +``` +Unitful.ฮฆ0 +``` + +A quantity representing the superconducting magnetic flux quantum, defined as h / (2 ร— q). + ## Metric (SI) Prefixes | Prefix | Name | Power of Ten | diff --git a/docs/tmp-script.jl b/docs/tmp-script.jl new file mode 100644 index 00000000..6dba3acf --- /dev/null +++ b/docs/tmp-script.jl @@ -0,0 +1,2 @@ +using Unitful: ๐ˆ ,๐‰ ,๐‹ ,๐Œ ,๐ ,๐“ ,๐šฏ +