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

Exponential should work with dimensionless quantities #50

Open
gaurav-arya opened this issue Sep 29, 2023 · 1 comment
Open

Exponential should work with dimensionless quantities #50

gaurav-arya opened this issue Sep 29, 2023 · 1 comment

Comments

@gaurav-arya
Copy link
Collaborator

gaurav-arya commented Sep 29, 2023

We should be able to exponentiate dimensionless quantitites. For a motivated example:

using DynamicQuantities.Constants: a_0

R10(r) = 2 / a_0^(3/2) * exp(-r/a_0)
R10(3 * a_0)

And a minimal case:

using DynamicQuantities
exp(1u"m" / 1u"m")

With error:

ERROR: MethodError: no method matching exp(::Quantity{Float64, Dimensions{DynamicQuantities.FixedRational{Int32, 25200}}})

Happy to put in a PR, although it may be a few days due to schoolwork.

@MilesCranmer
Copy link
Member

Good point. I purposefully left it out due to the question of type stability, but I think as long as exp always returns the base scalar type rather than a dimensionless quantity, then it's fine.

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

2 participants