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

documenting constants #526

Closed
ngam opened this issue Mar 5, 2022 · 5 comments
Closed

documenting constants #526

ngam opened this issue Mar 5, 2022 · 5 comments

Comments

@ngam
Copy link

ngam commented Mar 5, 2022

Hi again, I saw this issue #359 (comment) and I am now curious about documenting these constants. I couldn't find them in the documentation (maybe I am missing something, I searched for const, constant, and SpeedOfLight, but I couldn't find anything).

They are relatively easy to find in the src code:

const q = 1.602_176_634e-19*C # CODATA 2018; `e` means 2.718...

I am not sure if there is an easy way to produce the documentation for them; if there is, it might be a good idea to activate that. I am happy to help write documentation based on the current constants; perhaps they should be cited as well?

Thanks a lot for your patience with all my questions and comments. Let me know if this documentation is something you'd be interested in adding.

Copying @giordano.

@giordano
Copy link
Collaborator

giordano commented Mar 5, 2022

If you want to use physical constants, my biased opinion is that you should look at PhysicalConstants.jl. Disclaimer: I'm the author.

@ngam
Copy link
Author

ngam commented Mar 5, 2022

Damn, this Julia ecosystem is truly wild! This is amazing, thanks a lot! I assume that PhysicalConstants.jl has all the constants here and some more, right? I will for sure use it from now on since it is dedicated to that.

One minor curiosity just skimming through them, have you decided not to go with unicode superscripts and subscripts because they are not all readily available in Julia? For example, AvogadroConstant is N_A where usually the A is subscript, but the closest thing to it would be Nₐ in Julia, which would be somewhat misleading. I wondered if the available unicode set could be expanded in Julia or if that'd be too much of a hassle...

@ngam
Copy link
Author

ngam commented Mar 5, 2022

Oh, I also like this reasoning (now I am more consciously reading the first lines!) and it would be another reason not to go full in with the short names of constants:

Each dataset listed below exports by default only the full long names of the constants. Short aliases are provided for convenience, but they are not exported, to avoid polluting the main namespace with dozens of short-named variables. Users can to import the short names of the variables they use most frequently, as shown in the examples above

@giordano
Copy link
Collaborator

giordano commented Mar 5, 2022

Damn, this Julia ecosystem is truly wild! This is amazing, thanks a lot! I assume that PhysicalConstants.jl has all the constants here and some more, right? I will for sure use it from now on since it is dedicated to that.

Yes, and they are subtype of AbstractQuantity (which I actually introduced in #204 just for PhysicalConstants.jl), so you can reuse all the arithmetic defined in this package.

One minor curiosity just skimming through them, have you decided not to go with unicode superscripts and subscripts because they are not all readily available in Julia? For example, AvogadroConstant is N_A where usually the A is subscript, but the closest thing to it would be Nₐ in Julia, which would be somewhat misleading. I wondered if the available unicode set could be expanded in Julia or if that'd be too much of a hassle...

Yeah, I did use some Unicode letters (like α), but I didn't go all-in, also because the superscript/subscript support in Unicode is limited, see https://github.com/stevengj/subsuper-proposal. For example, is there a subscript infinite symbol for R_∞?

@ngam
Copy link
Author

ngam commented Mar 5, 2022

Makes perfect sense. Thanks a lot, this is very thoughtful (much like the overall Julia ecosystem actually).

For example, is there a subscript infinite symbol for R_∞?

Not that I am aware of. And now that I think about it, it would be a total mess if one tries to commit all-in to all abbreviations, etc. because different communities would clash over the definitions. So this is definitely a much more coherent approach.

@ngam ngam closed this as completed Mar 5, 2022
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