Skip to content
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

Convert between angular frequency and frequency #392

Closed
jamesgardner1421 opened this issue Oct 26, 2020 · 3 comments
Closed

Convert between angular frequency and frequency #392

jamesgardner1421 opened this issue Oct 26, 2020 · 3 comments

Comments

@jamesgardner1421
Copy link

Is this the intended behaviour when converting units involving angles?

julia> ω = 1u"rad*s^-1"
1 rad s^-1

julia> uconvert(u"s^-1", ω)
1 s^-1

I believe the correct result should be 1/2π s^-1. If the conversion is not intended, perhaps a DimensionError should be thrown instead?

@derikk
Copy link
Contributor

derikk commented Oct 27, 2020

This occurs because radians are defined in pkgdefaults.jl as dimensionless and numerically equal to 1:

@unit rad "rad" Radian 1 true

If you want revolutions per second, you can instead convert to rps:

julia> ω = 1u"rad/s"
1 rad s⁻¹

julia> uconvert(u"rps", ω)
0.15915494309189535 rps

Alternatively, converting to Hz2π will get you the same numerical result.

julia> uconvert(u"Hz2π", ω)
0.15915494309189535 Hz2π

@jamesgardner1421
Copy link
Author

Ah ok, that makes sense, thanks!

@cmichelenstrofer
Copy link
Contributor

@jamesgardner1421 checkout DimensionfulAngles.jl and in particular this Equivalence.

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

No branches or pull requests

3 participants