Available sources¶
A source provides data values to a question. In a question spec, the source
field names a source identifier — automath resolves it at runtime to the
appropriate source type.
Sources fall into several categories depending on how values are produced and stored.
Numranges¶
A numrange is an inline expression describing a set of numbers or number
pairs (e.g. 2-9×2-9), triples or more. See numrange
for the full syntax.
Content tables¶
| Name | Description | Columns |
|---|---|---|
fractions |
Fractions n/d with numerator and denominator from 1 to 12, flagged as irreducible and/or proper. | numerator, denominator, irreducible, proper |
usual_fractions |
The few fractions whose decimal writing is learnt by heart — a half, the quarters, a fifth, a tenth, a hundredth. All irreducible, all with a finite decimal writing, so that each can be asked from the other. | numerator, denominator |
unit_pairs |
Conversions between two units of the same quantity, one row per direction: the gap between their columns, the power of ten it makes (level), and whether the pair is one of everyday life — which counts as level 1 whatever its gap. | quantity, unit1, unit2, direction, gap, dimension, level, everyday |
Alternators¶
| Key | Description | Values |
|---|---|---|
digitplaces |
Return a sequence cycling through the digit places from the thousands down to the thousandths. | 0.001, 0.01, 0.1, 1, 10, 100, 1000 |
digitplaces_big |
Return a sequence cycling through the large digit places, from the tens of thousands up to the billions. | 10000, 100000, 1000000, 10000000, 100000000, 1000000000 |
digitplaces_small |
Return a sequence cycling through the places of a decimal part, from the thousandths up to the tenths. | 0.001, 0.01, 0.1 |
direction |
Return a sequence of alternating directions randomly starting with 'left' or 'right'. | left, right |
Tracked generative sources¶
These sources are never referenced directly by their name in a question spec: they back numranges, which select the matching table from the number of values drawn (a single number, a pair, …) and record what has already been drawn to avoid repetition.
| Name | Description | Columns |
|---|---|---|
singletons |
singletons of numbers | nb1 |
pairs |
pairs of numbers | nb1, nb2 |
triplets |
triplets of numbers | nb1, nb2, nb3 |
quadruplets |
quadruplets of numbers | nb1, nb2, nb3, nb4 |
quintuplets |
quintuplets of numbers | nb1, nb2, nb3, nb4, nb5 |
sextuplets |
sextuplets of numbers | nb1, nb2, nb3, nb4, nb5, nb6 |
Linked draws¶
A few question types need two draws bound together rather than two
independent ones. Expanding 4x(6x − 9) needs the products 4 × 6 and
4 × 9: two pairs sharing a factor. So does 23 × 5, which is done by
expanding it into 5 × 20 + 5 × 3.
Such a draw takes one product range and draws from it twice in a row. The
second draw looks only among the products carrying a factor of the first, and
the anti-repeat rule that normally keeps two consecutive questions apart is
set aside for it — sharing a value is the whole point. Everything else holds:
both products are recorded in the pairs table with their timestamps, so
neither comes back before the others have been used, and the values of the
previous question are still avoided by both draws.
The range must therefore hold two products sharing a factor: 1×2-9 does not
(the only factor they share is 1, which would leave nothing to expand), and
check qspec reports it before anything is rendered.
A question type may also allow the two products to be one: 22 × 5 is
5 × 2 twice over, so a single pair is drawn and recorded. It is then given
the chance of any other companion — one in k + 1, where k counts the other
products carrying the shared factor.
expand_simple and
multi_expand draw this
way.