pint icon indicating copy to clipboard operation
pint copied to clipboard

Use of Planck constant symbol is inconsistent

Open Jellby opened this issue 1 year ago • 5 comments

Regarding https://github.com/hgrecco/pint/pull/1454, I think the usage of as a symbol for Planck's constant is inconsistent (and inconvenient for my own usage, but I guess that's my problem). I already mentioned it in https://github.com/PainterQubits/Unitful.jl/issues/536#issuecomment-1225847077 without realizing that was a different project, so I thought I'd repeat it here.

Basically, if you change h to , you should also change ħ to , e to 𝑒 (elementary charge), G to 𝐺 (gravitational constant), etc. But my opinion is that these italic codepoints should not exist at all.

Jellby avatar Sep 15 '22 10:09 Jellby

I guess the most convenient (and consistent) way would be a separate namespace for constants, as described in https://github.com/hgrecco/pint/issues/1078#issuecomment-950231900

keewis avatar Sep 15 '22 12:09 keewis

For the record: https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols

Jellby avatar Sep 15 '22 12:09 Jellby

Problems occurs with clashing keys & string parsing. We cannot have both clashing of keys & string parsing of constants. Even with different namespaces, that's the weakness of dealing with strings only with parsing functions.

I'm not against using unicode for widely used constants since that's how they are printed in the literature (e.g. planck constant, gravital constants, light speed) and how you can differentiate from units. (see BIPM brochure about this).

Anyone got the ISO 80000-1 to see the chapter about constants, I wonder what they say about it.

About the use with namespaces, I really like the idea. Though if you want to keep the use of constants parsing in strings, strict no clashing policy need to be observed.

@Jellby, I think we can all agree h should be kept for hours, this is the standard symbol for it & I don't see us moving back on this change.

For those constants, I think using specific unicode & long version name should be enough when dealing with text.

jules-ch avatar Sep 15 '22 12:09 jules-ch

@jules-ch Indeed, I'm not suggesting to change the symbol for hours, but using the italic codepoint for Planck's constant only is inconsistent. For convenience and text parsing, there could be "shorthand" aliases , e.g. h_ or \h (and the same for other constants, which would allow using e for Euler's number and G for Gauss, if you wish...).

Jellby avatar Sep 15 '22 12:09 Jellby

I agree with @keewis The most straightforward way is finally having the constants group!

hgrecco avatar Sep 23 '22 03:09 hgrecco