Basic usage

This package extends Unitful.jl and the new dimension of angle inherits a lot of default behavior from Unitful.jl. You should read the Unitful.jl documentation first.

At its core, DimensionfulAngles defines:

The unit radᵃ is prefixable, and therefore defines many other units, which are documented in Prefixed units.

The units in this package are appended the superscript to differentiate them from the units in Unitful.jl and UnitfulAngles.jl, which have the same name but are non-dimensional. The @ua_str provides an easier way to access these units without having to type the superscript . For example, both of these are equivalent:

julia> using Unitful

julia> using DimensionfulAngles

julia> 1.3u"radᵃ"
1.3 rad

julia> 1.3ua"rad"
1.3 rad

The default u string can still be more convenient when defining quantities with mixed units, such as

julia> using Unitful

julia> using DimensionfulAngles

julia> 2.1u"radᵃ/s"
2.1 rad s⁻¹

Alternatively it might be convenient to import the units you are using directly, renaming units from DimensionfulAngles to remove the superscript . For example:

julia> using Unitful

julia> using Unitful: m, s, kg

julia> using DimensionfulAngles: radᵃ as rad, °ᵃ as °

julia> 2.1rad / s
2.1 rad s⁻¹

Yet another way to import units is to import the default set of units, which includes all the default units from Unitful.jl but with angle units from DimensionfulAngles.jl. The units from DimensionfulAngles.jl are imported without the superscript in their names. This is done as:

julia> using DimensionfulAngles.DefaultSymbols

One of the main advantage of defining an angle dimension is to be able to dispatch on angles. This behavior and useful aliases are completely inherited from Unitful.jl. The most basic usage uses the automatically defined alias DimensionfulAngles.Angle:

julia> using Unitful

julia> using DimensionfulAngles

julia> what_am_i(::Unitful.Length) = "I am a length."
what_am_i (generic function with 1 method)

julia> what_am_i(::DimensionfulAngles.Angle) = "I am an angle."
what_am_i (generic function with 2 methods)

julia> my_height = 6u"ft" + 1.0u"inch"
1.8542 m

julia> angle = 1.2ua"rad"
1.2 rad

julia> what_am_i(my_height)
"I am a length."

julia> what_am_i(angle)
"I am an angle."

Syntax

Contents:

Missing docstring.

Missing docstring for DimensionfulAngles. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.𝐀. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.radᵃ. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.°ᵃ. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.θ₀. Check Documenter's build log for details.

Missing docstring.

Missing docstring for @ua_str. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.DefaultSymbols. Check Documenter's build log for details.

Syntax provided by Unitful.jl

Missing docstring.

Missing docstring for DimensionfulAngles.Angle. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.AngleUnits. Check Documenter's build log for details.

Missing docstring.

Missing docstring for DimensionfulAngles.AngleFreeUnits. Check Documenter's build log for details.

Prefixed units

Modules = [DimensionfulAngles]
Filter = x->_filter_prefixed("rad", x; exceptions=["grad", "brad"])