Coder Social home page Coder Social logo

devel-chm / dimensionfulangles.jl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cmichelenstrofer/dimensionfulangles.jl

0.0 0.0 0.0 337 KB

📐 An extension of Unitful.jl to include angles as a dimension.

Home Page: https://cmichelenstrofer.github.io/DimensionfulAngles.jl/stable

License: MIT License

Julia 100.00%

dimensionfulangles.jl's Introduction

Project Status: Active – The project has reached a stable, usable state and is being actively developed. CI codecov deps dependencies

DimensionfulAngles.jl

Extends Unitful.jl to include angle as a dimension and allow dispatching on angles.

Installation ⚙

Install DimensionfulAngles.jl the usual way Julia packages are installed, i.e., using Julia package manager:

using Pkg
Pkg.add("DimensionfulAngles")

or in the Pkg REPL (enter from the Julia REPL with ]):

pkg> add DimensionfulAngles

Documentation 📜

Documentation of latest stable release. Documentation for the current code status in the <em>main</em> branch.

The full documentation can be found at https://cmichelenstrofer.github.io/DimensionfulAngles.

Citing 📝

DOI of latest version

If you use this code for your research please consider citing:

Michelén Ströfer, C. A. (2022). DimensionfulAngles.jl (Version 0.1.0) [Computer software]. https://github.com/cmichelenstrofer/DimensionfulAngles.jl

BibTeX:


@software{Michelen_Strofer_DimensionfulAngles_jl_2022,
  author = {Michelén Ströfer, Carlos Alejandro},
  doi = {10.5281/zenodo.7500588},
  month = {12},
  title = {{DimensionfulAngles.jl}},
  url = {https://github.com/cmichelenstrofer/DimensionfulAngles.jl},
  version = {0.1.0},
  year = {2022}
}

Basic Usage

Use DimensionfulAngles.jl for units containing angles and Unitful.jl for all other units. The units in DimensionfulAngles.jl are differentiated from their dimensionless counterparts with a subscript . Simply add this subscript to any angle units to make it dimensionful. In Julia environments this can be typed as \^a<tab>.

julia> using Unitful

julia> using DimensionfulAngles

julia> dimensionless_angle = 1u"rad"

1 rad

julia> dimensionful_angle = 1u"radᵃ"
1 rad

julia> typeof(dimensionless_angle)
Quantity{Int64, NoDims, Unitful.FreeUnits{(rad,), NoDims, nothing}}

julia> typeof(dimensionful_angle)
Quantity{Int64, 𝐀, Unitful.FreeUnits{(rad,), 𝐀, nothing}}

When defining quantities with units from DimensionfulAngles.jl you can use the ua string instead and omit the subscript . But when defining quantities with units from both it is more convenient to use the u string.

julia> dimensionful_angle = 1ua"rad"
1 rad

julia> typeof(dimensionful_angle)
Quantity{Int64, 𝐀, Unitful.FreeUnits{(rad,), 𝐀, nothing}}

julia> angular_velocity = 1.2u"radᵃ/s"
1.2 rad s⁻¹

julia> typeof(angular_velocity)
Quantity{Float64, 𝐀 𝐓⁻¹, Unitful.FreeUnits{(rad, s⁻¹), 𝐀 𝐓⁻¹, nothing}}

A third alternative is to directly import only the units you will be using and renaming those from DimensionfulAngles.jl to remove the superscript .

julia> using Unitful

julia> using Unitful: m, s, kg

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

julia> angular_velocity = 1.2rad / s
1.2 rad s⁻¹

Contributing

All Contributors

Contributions are welcome! 🎊 Please see the contribution guidelines for ways to contribute to the project.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Carlos A. Michelén Ströfer
Carlos A. Michelén Ströfer

💻 📖 ⚠️ 🤔
Sebastian Stock
Sebastian Stock

🤔
Kristoffer Carlsson
Kristoffer Carlsson

🚧
Daniel Boland
Daniel Boland

🤔

Acknowledgments

Some portions of this software are adapted from:

  • UnitfulAngles.jl: Copyright (c) 2017: Yakir Luc Gagnon.
  • UnitfulUS.jl: Copyright (c) 2017, California Institute of Technology. All rights reserved.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.