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.
Time ranges¶
A time range is a numrange written with units: 8h-17h30[5min],
10min-2h[5min], 1min-5min[1s]. Only addi_direct and
subtr_direct
read it — every other question type refuses it.
A value is written as it is by hand, units glued to their numbers: 8h,
17h30, 45min, 2min30, 1h05min30s. A bare number may close the value
and stands for the unit below the last one written: 17h30 is 17 h 30 min,
2min30 is 2 min 30 s. Every unit after the first holds less than sixty —
2h75 is refused, 75min is not.
| Notation | Values |
|---|---|
14h |
that one value |
8h-17h |
every hour from 8 h to 17 h |
8h-17h30 |
every minute from 8 h to 17 h 30 min |
8h-17h30[5min] |
every five minutes from 8 h to 17 h 30 min |
1h-3h[5min] |
every five minutes from 1 h to 3 h |
10min-50min[5min][^15min] |
every five minutes, the quarters left out |
8h,9h30,14h-15h |
a list, as in a numrange |
A range walks by the finest unit written in its bounds or its filters, and
a filter keeps the values that are a whole number of its length (or, with
^, that are not) — what [15] means in a numrange. There is no product:
nothing multiplies a time by a time.
Its draws are tracked like a numrange's, in the singletons table below.
The same two types also read the word clocktimes, which draws a
departure and an arrival together, inside a frame — see
clocktimes; it
is also the source of the time mini-problems,
mini_pb_time.
Windows¶
A window is the part of a coordinate system a question draws its points
from, written as intervals: [-4;4] for both axes alike, [-6;6]×[-3;3] (or
*) for the abscissas then the ordinates. Only
read_coordinates reads it —
every other question type refuses it.
Brackets are what sets it apart from a numrange, whose - between the bounds
leaves no way to write a negative one. Each interval must hold the origin, a
bound being allowed to be the origin itself ([0;6]): a coordinate system
needs its axes.
| Notation | Points |
|---|---|
[-4;4] |
every point of whole coordinates from −4 to 4 — 81 of them |
[-6;6]×[-3;3] |
abscissas from −6 to 6, ordinates from −3 to 3 |
[0;8]×[0;5] |
the first quadrant only |
[-1.0;1.0] |
every tenth from −1 to 1, on both axes |
A bound is read as written: its decimals set how finely the axis is
graduated, as they do for plot{} — [-1;1]
every unit, [-1.0;1.0] every tenth, [-1.00;1.00] every hundredth. The
points are the nodes of that grid.
Its draws are tracked in a table of their own, points, which keeps a pair in
the order it was drawn: (2; 3) and (3; 2) are two points, where pairs would
take them for one multiplication.
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 fractions whose decimal writing is learnt by heart, in two series: "basic" — a half, the quarters, a fifth, a tenth, a hundredth — and "extended", the halves and quarters above 1 and the other fifths. All irreducible, all with a finite decimal writing, so that each can be asked from the other. | numerator, denominator, series |
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 |
expr_multiples |
Return a sequence cycling through the multiple and part words. | double, half, quadruple, quarter, third, triple |
expr_operations |
Return a sequence cycling through the four operation words. | difference, product, quotient, sum |
expr_opposite |
Return the one word of its family, over and over. | opposite |
expr_powers |
Return a sequence cycling through the square and the cube. | cube, square |
expr_words |
Return a sequence cycling through every word but the opposite. | cube, difference, double, half, product, quadruple, quarter, quotient, square, sum, third, triple |
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.