The question library

Rhema is installed with a library of grammars, in share/rhema beside the command (in the repository, generator/stdlib). Every file can be run as it is, imported into a file of your own (chapter 6 of the tutorial), or used in a set. rhema list FILE shows what a file offers; the files themselves are commented, and are the best examples of the language there are.

$ rhema run calculus.rhm --question integral --set cost=5
$ rhema list logic_forms.rhm

The tables give, for each grammar, what it asks, what its difficulty budget cost pays for, its default budget and the WeBWorK context of its answers. Prices are per production: a sum that costs 1 and a product that costs 3 make x + 2x \cdot \sin x cost at least 4.

Expressions: a recursive tree spends the budget

grammar asks for the budget buys default context
arithmetic.rhm the value of a four-operation expression + 1, - 2, * 3, / 4; a number pays one per digit beyond its first, a fraction in lowest terms 2 12 Numeric
boolean.rhm the truth value of a proposition in p, q, r under an assignment; propositions are the engine's Boolean type and/or 2, conditional 4, biconditional and xor 6, a negated variable 1, a negated compound 3 10 Numeric
boolean_equiv.rhm whether one of thirty laws, stated correctly or with a classic mistake, holds; decided by enumeration the law 1–3, the parts as in boolean.rhm 6 Numeric
calculus.rhm a derivative, or an antiderivative built by differentiating; the named questions derivative and integral ask one form only sum 1, product 3, quotient 4; a power or function of a leaf 1, of a compound 3 (chain rule); an integral pays 2 up front 7 Numeric
complex.rhm a complex expression, its conjugate, the modulus of a product / conjugate / multiple of Pythagorean-triple numbers, or i^n times an expression sum 1, product 3; modulus 2 plus its expression (product 2, conjugate 1, multiple 1); power of i 1 plus its expression 4 Complex
set.rhm a set expression over three given sets union 1, intersection and difference 2, an interval leaf 1 7 Interval
polynomial_expand.rhm the expansion of a product of factors product 2, square 1, cube 2, factor x + b 0, ax + b 1, quadratic 2 5 Numeric
factoring.rhm the factored form of a polynomial built from its factors the same prices as the expansion; the factors are distinct and primitive 5 PolynomialFactors
vector_expr.rhm a vector expression, or a dot product, cross product or norm of expressions sum 1, a multiple of a bracket 1; dot 2, norm 2, cross 4 on top 4 Vector
linear_equation.rhm the solution of a linear equation whose left side is built from a chosen root sum 1, a multiple of a bracket 1, a fraction 2 5 Numeric
polynomial_forms.rhm the same tree of factors, expanded or factored, each form in its own context as factoring.rhm 5 Numeric / PolynomialFactors
sequence_parts.rhm one sequence, two blanks: its nth term and the sum of its first n terms arithmetic 2, geometric 3 (fixed) 2 Numeric
derivative_or_boolean.rhm a derivative or a Boolean evaluation, from the two grammars imported as modules each grammar's own prices 8 Numeric
logic_forms.rhm classify a proposition (tautology / contradiction / neither), count its models, or rewrite it without the conditional family; built on boolean.rhm and boolean_equiv.rhm the law's or expression's own price 6 Numeric / Boolean
matrix_expr.rhm compute an expression in the matrices A, B, C of matrix_core.rhm sum 1, multiple 1, transpose 1, product 3; 3 by 3 matrices 2 4 Matrix
determinant.rhm the determinant of a matrix or of a product, transpose or multiple 2 by 2 1, 3 by 3 3; product 2, transpose 1, multiple 1 3 Numeric

Fixed forms: each form is a price

grammar forms by price default context
vector.rhm 1 parallel vector; 2 dot product, norm, same direction; 3 unit vector; 4 cross product 2 Vector
sequence.rhm 1 arithmetic nth term; 2 geometric nth term, arithmetic sum; 3 geometric sum 2 Numeric
library_linear.rhm 2 one bracket; 3 brackets on both sides; 4 a fraction 3 Numeric
library_quadratic.rhm 2 two integer roots; 3 repeated root, no real root; 4 two rational roots 3 Interval
library_polynomial.rhm 1 evaluation; 2 degree; 3 expansion, coefficient; 4 derivative 3 Numeric
library_formula.rhm 2 composition; 3 logarithm, radical, tangent; 4 quotient, combined 3 Numeric
matrix_inverse.rhm 2 a 2 by 2 with whole inverse; 3 the same scaled (fractions); 5 a 3 by 3; 6 scaled 2 Matrix
linear_system.rhm 3 a triangular system in three unknowns; 5 a full one; three answer blanks 5 Numeric
counting.rhm 1 a row, a ranked choice, a committee; 2 arrangements of a word, at least one of a kind, two people not together, the probability of a dice sum; 3 drawing all of one colour, at least one six, exactly k heads; the questions counting and probability ask one family 2 Numeric
number_theory.rhm 1 gcd, lcm; 2 the remainder of a power, an inverse modulo n; 3 a linear congruence 2 Numeric
series.rhm 1 an infinite geometric series, a sum of squares; 2 a geometric series in sigma notation, the sum of a quadratic, a telescoping sum; 3 a telescoping sum with a gap (finite or infinite), the sum of two geometric series 2 Numeric
limits.rhm 1 a removable discontinuity, a ratio of quadratics at infinity; 2 a factor shared above and below, sin(kx)/(mx), (e^{kx} - 1)/(mx); 3 a ratio of two sines, (1 - cos(kx))/(mx^2) 2 Numeric
eigen.rhm 1 the eigenvalues of a triangular matrix; 2 the eigenvalues of a 2 by 2, its characteristic polynomial; 3 an eigenvector, the eigenvalues of a 3 by 3 2 Interval / Numeric / Vector
inequality.rhm 1 linear; 2 quadratic, the absolute value of x - a; 3 the absolute value of px - q, rational 2 Interval

Libraries and examples

polynomial_core.rhm
The tree of polynomial factors that factoring.rhm, polynomial_expand.rhm and polynomial_forms.rhm are built on. It has no question of its own.
matrix_core.rhm
The matrices A, B and C that the linear algebra grammars use, in 2 by 2 and 3 by 3 sizes.
homework_set.rhm
An assignment: two sets over four of the grammars above. Run it with rhema run homework_set.rhm --run homework.

Named questions

Most grammars have one question, main. calculus.rhm also offers derivative and integral separately, so that a set can ask for one kind:

3 of calc.derivative(cost ~ 6 spread 2)
1 of calc.integral(cost = 5)