-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround for angles not having a dimension #570
Comments
That’s very unlikely to happen.
I would create a package (maybe called DimensionfulAngles.jl) that defines dimensions for angle and solid angle and units of those dimensions. I wouldn’t attempt to redefine the units defined in Unitful.jl, but define the dimensionful units in addition (maybe adding a suffix so they can be distinguished when printed). The package should also contain functions to convert between the standard Unitful.jl (dimensionless) angles and the dimensionful angles.
There isn’t a super nice way of doing this, but it is not too hard either: The first type parameter of the
|
@DanDeepPhase @sostock I am working on option 2 above. It is almost ready for release! I started it a while ago, picking it up again now. I am using a superscript as well as a modified string (both modeled after |
Here is a first version. Any feedback or contributions would be appreciated! (I started learning Julia recently and this is my first package). |
@sostock I really like your name suggestion "DimensionfulAngles.jl"! Can I use this? If so, I would mention it in the Acknwledgements or (even better) if you have time you can do a PR 🤓. |
@cmichelenstrofer You can use the name, you don’t have to credit me for it. |
FYI The package is now registered. It is here: https://github.com/cmichelenstrofer/DimensionfulAngles.jl. Hope you find it useful! |
Thanks. It looks great! |
Preface
Currently angles do not have a dimension, leading to several issues #531 #537 #392 #216 #38 and stems from a conversation in #9 . Personally, I believe that angles should have a dimension, and appreciate the arguments in this paper: https://iopscience.iop.org/article/10.1088/0026-1394/52/1/40. I suspect that the argument "the circumference of a circle should be (2π radians) * (radius) which better have dimensions of length." is incorrect, because its probably shorthand for a limit series of inscribed triangles. I think the correct definition of circumference is "(2π)*(radius)" and if you are taking an arc segment then you are multiplying by (arc-angle radians) / (2π radians).
Note: Similar issues have requested the ability to dispatch on angles, to which the suggestion has been to create a union Quantity type. This gets partway there, but the angles are still dimensionless
Note: The UnitfulAngles package does not address dimensions or union types
Note: SI currently treats angles as dimensionless, so i understand mine is a minority opinion.
My Pain point
I work with radiometric units, where steradians are used to distinguish between quantities. some typical units are:
A typical problem is that i might integrate over the wavelength (the μm term here) which sometimes comes in other units, like nanometers. This leads to a clumsy
nm W μm^-1 m^-2 sr^-1
which i need to simplify. upreferred turns this into kg/s^3 so i've tried to dispatch on derived dimensions ofunfortunately, due to the lack of an angular dimension, i have some errors in my math where angles are inappropriately eliminated or added.
Paths forward
1B. Add a dimension for solid angles only - this is a hack compromise which would fix my code, and probably not break too many existing code bases.
Any willingness for #1? if not, any suggestions for #2/#3?
The text was updated successfully, but these errors were encountered: