/Unitfu.jl

Physical quantities with arbitrary units

Primary LanguageJuliaOtherNOASSERTION

CI Coverage Status codecov.io

Unitfu.jl

About this clone / fork

We intend to keep pulling in further improvements from PainterQubits/Unitful.jl, and suggest improvements to Unitful.jl as well. Unitful now also has 'fancy exponents' output and can drop spaces between number and unit. Windows can now also easily display Unitful's symbols for length, time, etc. There may be no need of maintaining this fork in the future.

MechanicalUnits.jl contains additional functionality, while this contains alternative. 'MechanicalUnits' has macros for which define e.g. m² = m^2.

Ideas developed with 'Unitfu' could easily switch to depend on 'Unitful' to use functionality from other packages.

MechGluecode contains glue code for plotting, differential equations and non-linear solving, loaded when the relevant packages are.

Differences to Unitful

  • Units are printed with color and in a form that can be parsed by Julia.
  • We define '∙' = '*'. (on the keyboard: \vysmblkcircle). Quantities look more like an entity in formulas.
julia> 250kgm/s + 101kPa * 5.0cm * 20cm * 1s |> kN
1.26kNs
  • Collections (tuples, arrays, vectors) with identical elements are printed with units outside of brackets, without redundant type information:
julia> [1,2,3]m |> println
[1, 2, 3]m
  • In conversions, the quantity is considered immutable. Express quantities how you like, as long as it's the same entity:
julia> 1kg |> cm
100kgcmm⁻¹

Installing this clone / fork

This fork is registered in M8.

(@v1.6) pkg> registry add https://github.com/hustf/M8
     Cloning registry from "https://github.com/hustf/M8"

(@v1.6) pkg> add Unitfu

julia> using Unitfu

Unitful.jl

Unitful is a Julia package for physical units. We want to support not only SI units but also any other unit system. We also want to minimize or in some cases eliminate the run-time penalty of units. There should be facilities for dimensional analysis. All of this should integrate easily with the usual mathematical operations and collections that are found in Julia base.

Documentation

Stable and latest versions available.

Other packages in the Unitful family

Units packages

Feature additions

Related packages

Unitful was inspired by: