GithubHelp home page GithubHelp logo

unitfulangles.jl's Introduction

UnitfulAngles

Build status Build Status Coverage Status

A supplemental units package for Julia's Unitful.jl.

UnitfulAngles.jl introduces all the angular units found in Wikipedia's articles Angle § Units, Angular unit and Circular sector.

In addition to the Radian and Degree units already available in Unitful.jl, the following units are introduced: DoubleTurn, Turn, HalfTurn, Quadrant, Sextant, Octant, ClockPosition, HourAngle, CompassPoint, Hexacontade, BinaryRadian, DiameterPart, Gradian, Arcminute, and Arcsecond.

Because all the trigonometric functions work correctly regardless of the type of their argument, there is no need to convert between the units. However, to specifically convert one unit to the other, use Unitful.jl's uconvert function:

julia> using Unitful

julia> uconvert(u"clockPosition", 128u"brad")
6//1 clockPosition

Special features

  • All the trigonometric functions (sin, sinc, cos, cosc, tan, sec, csc, and cot) work as expected:
    julia> using UnitfulAngles
    
    julia> import UnitfulAngles: °, rad, octant
    
    julia> sin(30°)
    0.5
    
    julia> cos*rad)
    -1.0
    
    julia> tan(1octant)
    1.0
  • In order to get inverse functions (acos, acot, acsc, asec, asin, atan, and atan2) to return a specific unit, specify the desired unit as the first argument:
    julia> import UnitfulAngles.turn
    
    julia> asin(turn, 1)
    0.25 τ
  • As a bonus, you can also convert between an angle and Dates.Time:
    julia> convert(Dates.Time, 200u"grad")
    12:00:00
    
    julia> convert(u"sextant", Dates.Time(4,0,0))
    1.0 sextant

unitfulangles.jl's People

Contributors

femtocleaner[bot] avatar github-actions[bot] avatar juliatagbot avatar waldyrious avatar yakir12 avatar

Watchers

 avatar

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.