Chemical calculator: Difference between revisions

Content added Content deleted
(Added Fōrmulæ entry)
Line 1,778: Line 1,778:
* If the expression given as parameter is a heteronuclear compound expression, the molar mass is the sum of the molar masses of each component. Note that this function is recursively called.
* If the expression given as parameter is a heteronuclear compound expression, the molar mass is the sum of the molar masses of each component. Note that this function is recursively called.


* If the expression given as parameter is a homonuclear compound expression, the molar mass is the product of the number of the group (the second component) and the molar mass of the expression (the first component). Note that this function is recursivelly called.
* If the expression given as parameter is a homonuclear compound expression, the molar mass is the product of the number of the group (the second component) and the molar mass of the expression (the first component). Note that this function is recursively called.


* Elsewhere, the result is the call of the GetAtomicMass(Expression) with the expression given as parameter.
* Elsewhere, the result is the call of the GetAtomicMass(Expression) with the expression given as parameter.
Line 1,787: Line 1,787:


[[File: Fōrmulæ - Chemical calculator 03.png]]
[[File: Fōrmulæ - Chemical calculator 03.png]]

'''Using it symbolically'''

Fōrmulæ is a symbolic language. Although chemical elements expressions are intended to be used to create chemical formulae, other expressions can be used, specially symbols, as in the following examples:

Example 1. Using a symbol to denote and unspecified number of repetitions in a homonuclear compound expression. For this exercise, n is a free symbol (a symbol with no associated value).

[[File: Fōrmulæ - Chemical calculator 04.png]]

[[File: Fōrmulæ - Chemical calculator 05.png]]

Example 2. Using a symbol to denote an unspecified chemical element. For this exercise, X is a free symbol (a symbol with no associated value).

[[File: Fōrmulæ - Chemical calculator 06.png]]

[[File: Fōrmulæ - Chemical calculator 07.png]]

Example 3. Using symbols to denote an unspecified chemical element and an unspecified number of repetitions. For this exercise, X and n are free symbols (symbols with no associated values).

[[File: Fōrmulæ - Chemical calculator 08.png]]

[[File: Fōrmulæ - Chemical calculator 09.png]]

Example 4. Using symbols to denote different unspecified chemical elements. For this exercise, X, Y and Z are free symbols (symbols with no associated values).

[[File: Fōrmulæ - Chemical calculator 10.png]]

[[File: Fōrmulæ - Chemical calculator 11.png]]

Example 5. Other combinations. For this exercise, X, Y, Z, n and m are free symbols (symbols with no associated values).

[[File: Fōrmulæ - Chemical calculator 12.png]]

[[File: Fōrmulæ - Chemical calculator 13.png]]


=={{header|Go}}==
=={{header|Go}}==