the task description needs to be complete
The task description needs to be complete, without needing chemistry knowledge. Describe how to perform the calculation; input format; data tables etc. Aim the task at those who know how to program but don't know chemistry, for example. --Paddy3118 (talk) 18:01, 18 March 2019 (UTC)
Might be an idea to specify an element symbol consists of one upper-case letter followed by 0, 1 or 2 lower-case letters, so CH4 is uniquely parsed as 1 atom of element C followed by 4 atoms of element H. (The symbols with two lower case letters are for systematic names of as yet unnamed elements, e.g. Ubn would be the symbol of element 120).
I leave three letter names for refactoring later when these substances have been found Thanks for telling me about C-12 and the neutrons. I've update the page. --ChristerNilsson (talk) 22:29, 18 March 2019 (UTC)
- Some have been found, and those elements need approval to be (re-)named after confirmation (of existence) has been made by (other?) scientists/chemists/physicists/powers-that-be. -- Gerard Schildberger (talk) 01:04, 19 March 2019 (UTC)
- I have no idea where you got such a wrong idea. Where or how did you come to that conclusion? Three-letter names for elements are necessary for various reasons. -- Gerard Schildberger (talk) 08:35, 19 March 2019 (UTC)
What to do?
All examples need to be computing the same set of results for comparison (adjusting for floating point issues). You need to add to the task description defining what those are.
(P.S. I do like this task though :-)
Should I keep the really bloated Python version as a reminder of the progress being done during the process? I'm really happy my understanding of RegEx is better now thanks to RC.--ChristerNilsson (talk) 23:13, 19 March 2019 (UTC)
Mass number and atomic weight
There seems to be some confusion here. The mass number is the total number of nucleons in a nucleus. The standard atomic weight is the average observed weight, and this depends on the relative proportion of isotopes. The integer masses given in the task are actually the mass numbers of the most stable isotopes (they are all radioactive). See the NIST periodic table of the elements for instance.
An interesting extension to the task could be to allow isotopes in the chemical formula.
precision of atomic masses
Since the atomic masses for some elements are expressed in greater precision, shouldn't the computer programming solutions reflect that? Most languages (at this time) aren't using enough arithmetic precision to give a precise result (in particular, the formula that contains sodium). Also, shouldn't the assert in the Rosetta Code task preamble be updated (with greater precision) for sodium sulfate? -- Gerard Schildberger (talk) 22:09, 27 March 2019 (UTC)
- There is almost never a good reason to use the equality operator with floating point numbers. Especially in assert. Moreover, the mass of a compound is only as accurate as the least accurate component, so there is no point in dealing with arbitrary precision. Anyway, "usual" floating point numbers have nowadays 17 digits of precision. It's much more than the most accurate atomic mass. Eoraptor (talk) 19:35, 1 April 2019 (UTC)