-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
Arbitrary "annotations" to units #611
Comments
Thank you for writing this down. I think this is a really interesting feature! I have thought about it in the past — but in a slightly different way. I think what you're asking for is pretty similar to quantity kinds in the mpunits library. Being able to differentiate between "width" lengths and "height" lengths, is similar to differentiating between "Fe" grams and "Ag" grams.
I see how that could be handy, but maybe it would be better to make this explicit. And before we think about units, we need to think about types. We would probably introduce something like
Hm. I'm not sure how that would work? |
Implementing something like the system of quantity kinds would be a very helpful feature, but I was envisioning something that you could adapt for any purpose - like elements/materials here, which it would be very impractical to formally list. Either way, implementation would probably be somewhat similar but unfortunately I can't really speak to implementation details with regard to the type system.
|
yes
yes
This sounds like a reasonable simplification. Because one would want to use predefined constants/units involving So if we want this as well, then we should only support it if it's unambiguous. So maybe if you only have I see how that could be really confusing and maybe even error-prone though.
In the above sense,
1 (cm_Fe)^3
I think this should just be
Similar, this should not simplify and just stay
Hm. I would propose we don't "move" it, but rather "spread" the annotation to all appearances of
This should simplify to |
A common thing I find myself mentally inserting into calculations is the type of quantity that a unit corresponds to. For example, if we have the chemical equation 4Fe + 3O₂ → 2Fe₂O₃, and we want to know how much Fe₂O₃ is produced from 10 g of Fe. I might type something like
10 g / (55.485 g/mol) / (4 mol / mol) * (2 mol / mol) * (159.69 g/mol)
, but in my head I'm thinking 10 g of Fe, 55.485 g of Fe per mol of Fe, ... What if Numbat could track these "annotations" too? Here is how I envision it working:g_Fe
andg_Ag
can't be added directly, etc. Perhaps it should be possible to explicitly convert between them, though. Or, if you'd prefer, just encourage structures like(g_Ag / g_Fe)
, which is intuitive.5 mol_Ar * (22.41 L/mol) = 112.05 L_Ar
and so on. This might lead to weird behavior (like10 g_Fe / g = 10 _Fe
- what does that mean??) so this could be left unimplemented.The text was updated successfully, but these errors were encountered: