-
Notifications
You must be signed in to change notification settings - Fork 476
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
For Discussion: Inconsistency in the definition of Hz? #1288
Comments
BIPM is pretty clear about it if you mean angular velocity you should use BIPM recommends to be explicit in this case. I agree with you it should have better documentation & even warn the user about this kind of error which can be confusing. |
I think we could resolve this, using contexts in pint. For example when converting from |
If I might add, a long stand discussion is how to consider a radian. In pint, radians are dimensionless. So there is no distinction (in terms of dimensionality) between |
I'm a bit lost how this would work, the context examples are based on dimensionality and both
It would be interesting to see whether having an angle dimension causes less issues than not. I can see other issues that would occur. If you've got a power, dimensionality '[length]': 2, '[mass]': 1, '[time]': -3, and divide by a torque, [length]': 1, '[mass]': -1, you'd expect to get a angular velocity, but there is no angle dimension. |
Having just been bitten by this, and having to manually construct what I feel is a pretty common conversion (hertz/frequency to period) as a workaround for this behaviour of hertz/frequency incorrectly turning into an angular unit and not supporting sensible conversions due to ambiguity. Could some of the impact of this issue be solved by having a built in definition for "period" which can be used to build a chain like At the moment the direct conversion will fail. Edit: For anyone else who, like me, trips over this without having worked out the "right way" to do this conversion correctly. |
I created a branch with angle as a base unit to see how this would work. Using a context gives intuitive behaviour: master
angle
master
angle
code for angular context
|
@andrewgsavage I don't know all the implications that could lead to. Quoting BIPM brochure :
But in practice, a lot of people are expecting: 1 Hz -> 6.28 rad/s which tells us 1 Hz here is equivalent to 1 turn/s which violates 1 Hz -> 1/s -> 1 rad/s. Maybe we should put a warning in the docs in the meantime and recommending to use rad/s or rpm when meaning angular velocity which can lead to ambiguity. Context could be used here in the form of redefining Hz in this particular context, but as stated we do not have this feature available with the current implementation. |
I definetly think that we should put a warning in the docs. And I think we should not change the definition. While it is true that a lot of people are expecting |
Summary
The definition of
hertz
is inconsistent with common usage, when angles are involved.1 hertz
is usually understood to denote1 cycle / second
, but it is currently defined as1/second
which is implicitly cast to1 rad/second
.Why is it a problem?
As a user of the package, I was specifying frequencies as, e.g.
This implies, that one cycle should be
0.02 seconds
. For plotting, I had an array of times, sayand wanted to convert it to cycles with regard to f0. I expected
but got
Theoretical considerations
From Physics and Engineering environments I know two quantities describing the frequency of a system. When radians are assumed as natural unit of angles, they are given as
The different factor comes from the different in usage of
f = 1/T
versussin(ωT)=1
, i.e.When using angular units, but keeping the period defined as "time for one cycle" in seconds, this leads to
When using angular units, and giving periods as
seconds/cycle
(which seems to be the more natural choice), the relationships change; In order to maintain the formcos(ωt)
, the dimension of ω has to change toThe latter version ends up being more consistent and restores the understanding of 1 Hz.
Problems now arise with the current usage, because
1 Hz
is currently defined as1/second
, which gets converted torad/second
in angle-units contexts.How can it be solved?
The obvious way would be redefining
Hz
ascycles/second
. However, this would likely create confusion from the requirement of specifying periods asseconds/cycle
, distinguishing their dimension from that of time instants (inseconds
).The unit of
Hz
has contradicting requirements basically. When specifying a period as1 second
, users will expect the frequency to bebut at the same time expect
The solution would essentially be to not automatically cast angles to dimensionless numbers, and redefine
1 hertz = 1 cycle/second
. But the consequence would be, that angle units have to be used everywhere, and this is simply not what is done in literature and thus will be confusing.So... probably, it cannot be solved at all, except by documentation.
Affected Version
The text was updated successfully, but these errors were encountered: