Skip to content

Draft: prelude with dimensionful angles - #167

Draft
sharkdp wants to merge 14 commits into
mainfrom
dimensionful-angles
Draft

Draft: prelude with dimensionful angles#167
sharkdp wants to merge 14 commits into
mainfrom
dimensionful-angles

Conversation

@sharkdp

@sharkdp sharkdp commented Sep 21, 2023

Copy link
Copy Markdown
Owner

see #91

This PR makes changes to Numbats prelude to treat angles as dimensionful quantities. Angle becomes a new base dimension. And radian is the base unit in that dimension. This follows the paper Angles in the SI: a detailed proposal for solving the problem by Quincey.

Immediate advantages of this approach:

  • When using a unit like J, cal, eV etc., we don't see [Energy or Torque] anymore. We just see [Energy].
  • lumen -> candela conversion is not possible anymore (1 lumen does not equal 1 candela (1 lm -> cd returns 1 cd) insect#225)
    But 400 cd * (5°)^2 -> lm is still possible, as it should. Completely wrong expressions like 400 cd / (5°)^2 -> lm do not type-check anymore.
  • When typing lumen, it doesn't show [LuminousIntensity or LuminousFlux], but just LuminousFlux. Similarly, candela only shows LuminousIntensity.
  • An expression like 40°/s is detected as AngularFrequency, not as Frequency.
  • RPM works as it should:
    >>> 60 rpm -> rev/s
    
        = 1 rev/s    [AngularFrequency]
    
    >>> 60 rpm -> deg/s
    
        = 360 °/s    [AngularFrequency]
    
  • You can not accidentally pass an angle to ASin, ACos, ATan, …
  • Similarly, you can not do meaningless things like log(30°).
  • You directly see the result of ASin, … as an angle in rad
  • When typing in angles like 30°, they don't just "decay" to scalars (this is one of Numbats simplification procedures… which is not ideal in the case when angles are dimensionless).

Obvious disadvantages:

  • Users can not use "textbook" formulas if they are not "complete". They need to insert factors of θC/theta_C/rad when needed.
  • Users need to use Sin(…) for angles and sin(…) for scalars.
  • There is not just ℏ: AngularMomentum, there is also ȟ: Action.
  • Some constants have "unexpected" units. This is particularly evident for the bohr radius, which now has a unit of m/rad and dimensions of Length / Angle.
  • To get a feeling for the type of changes to expect, check out the diff.

Try this online at: https://numbat.dev/angles/

@archisman-panigrahi

archisman-panigrahi commented Sep 29, 2023

Copy link
Copy Markdown
Contributor

Will there be an option to turn this off? The idea of angles being dimensionless still did not get into mainstream physics. Having different dimensions for Torque and Energy (or Bohr radius and length) may give rise to a lot of confusions.

In my opinion (but I am saying this with my physicist hat on) it is best if this feature is turned off by default, but can be turned on by calling something like use unit::dimensionful_angles. One possible method to do this may be to have a different prelude for dimensionful angles, which will overwrite all the definitions of units related to dimensionless_angles when it is called.

@sharkdp

sharkdp commented Sep 29, 2023

Copy link
Copy Markdown
Owner Author

Will there be an option to turn this off?

This is just a proof of concept / draft. It will not be merged as-is. And no, we will most probably not enable this by default. What I'm planning to have is something like #55, which would allow us to have one single prelude, where certain aspects could be controlled by the user (via a config file). So users could potentially opt in to this by setting dimensionful_angles = true in their config file.

@sharkdp

sharkdp commented Sep 29, 2023

Copy link
Copy Markdown
Owner Author

The idea of angles being dimensionless still did not get into mainstream physics. Having different dimensions for Torque and Energy (or Bohr radius and length) may give rise to a lot of confusions.

I do agree. But note that the current situation also leads to lots of confusion. Just look at the tickets linked in #91 (comment)

@sharkdp
sharkdp force-pushed the dimensionful-angles branch from f7842ef to 8c3ca05 Compare October 9, 2023 21:05
@sharkdp
sharkdp force-pushed the dimensionful-angles branch from 8c3ca05 to bca0527 Compare October 10, 2023 10:54
@sharkdp
sharkdp force-pushed the dimensionful-angles branch from 4152e30 to df3aad5 Compare May 6, 2024 08:53
@sharkdp
sharkdp marked this pull request as draft June 6, 2025 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants