MathCheck Instructions

This document is as of 2017-12-01. It lacks all more recent features of MathCheck.

In ready-made problems, the use of commands may have been restricted to those relevant for the problem. There are two mechanisms towards this aim. If the textarea has the name "exam", then many commands are unavailable. Commands may also be banned by some commands mentioned below.

Lexical Rules

Spaces and newlines may be freely used between tokens. If a non-numeric token ends and the next one starts with a letter or digit, there must be at least one space or newline in between.

These symbols can also be given as Unicode characters: ¬ Γ Δ Θ Λ Ξ Π Σ Φ Ψ Ω α β γ δ ε ζ η θ ι κ λ μ ν ξ π ρ σ τ υ φ χ ψ ω ϑ ϕ ϵ ← → ↔ ⇐ ⇒ ⇔ ∀ ∃ − √ ∧ ∨ ≠ ≤ ≥ ⋅ ⌈ ⌉ ⌊ ⌋

Arithmetic and Parentheses

`54321`54321
`frac(54)(321)`54/321
`54 frac(3)(21)`54 3/21
`54.321`54.321
`pi`pi
`e`e
`+`+
`-`-
`*`*
`x/y`x/y
`frac(x+1)(2y)`(x+1)/(2y)
#/(x+1)(2y)
`x^y`x^y
`x^(-y z)`x^(-y z)
`(`(
`)`)
`(`#(
`)`#)
`[`[
`]`]
`sqrt x+1`sqrt x+1
`sqrt(x+1)`sqrt(x+1)
`root(n)(x+1)`root(n)(x+1)
`|x+1|`|x+1|
abs(x+1)
`|__x+1__|`|_x+1_|
floor(x+1)
`|~x+1~|`|^x+1^|
ceil(x+1)
`del/(del x) sin 5x`DD x sin 5x
`sin`sin
`cos`cos
`tan`tan
`cot`cot
`ln`ln
`log`log
`sinh`sinh
`cosh`cosh
`tanh`tanh

`A`, …, `Z`, `a`, …, `z`, and the Greek letters listed below can be used as variables, excluding `e` and `pi`. If the problem mode assumes ordinary numbers, then `I`, …, `N` and `i`, …, `n` hold integer and others hold real values.

MathCheck is not good in finding errors if the floor or ceiling function is used.

MathCheck may remove unnecessary ordinary parentheses, but may not remove unnecessary hard parentheses #( and #).

MathCheck uses precise rational number arithmetic when it can and then reverts to intervals of double-precision values. Also decimal number tokens yield rational values, whenever possible. The functions ddn and dup return the lower and upper bound of the interval.

Comparisons and Logic

`<=`<=
`<`<
`=`=
`!=`!=
`>=`>=
`>`>
`not`!
not
`^^`/\
and
&&
^^
`vv`\/
or
||
vv
`rarr`-->
`harr`<->
`sf"F"`FF
`sf"U"`UU
`sf"T"`TT
`AA x:`AA x:
`AA i; 1 <= i <= n:`AA i; 1 <= i <= n:
`EE x:`EE x:
`EE i; 1 <= i <= n:`EE i; 1 <= i <= n:
`rArr`==>
`lArr`<==
`hArr`<=>

Greek Letters

`alpha`al
`beta`be
`gamma`ga
`delta`de
`varepsilon`ve
`epsilon`ep
`zeta`ze
`eta`et
`theta`th
`vartheta`vt
`iota`io
`kappa`ka
`lambda`la
`mu`mu
`nu`nu
`xi`xi
`omega`om
`rho`rh
`sigma`si
`tau`ta
`upsilon`up
`phi`ph
`varphi`vp
`chi`ch
`psi`ps
`omega`om
`Gamma`Ga
GA
`Delta`De
DE
`Theta`Th
TH
`Lambda`La
LA
`Xi`Xi
XI
`Pi`Pi
PI
`Sigma`Si
SI
`Phi`Ph
PH
`Psi`Ps
PS
`Omega`Om
OM

Special Commands

assume x != 1 /\ y^2 < sin x;Restrict the range of variables. Any comparisons and propositional operators may be used in the condition. One may use enda instead of ;. Works in the arithmetic, draw function, equation, modulo, and propositional logic modes. Unless otherwise stated, this must be next to the problem mode keyword.
/**/Start a new line.
/* two to the `n` is `2^n` */Write a comment and start a new line. Passages surrounded by grave accent characters will be shown as mathematics.
skip_errorIf possible, continue checking even if there is an error.
forget_errorsShow the link to the next problem page even if the solution contains errors.

Problem Modes and Related

The versions with capital initial letter do and with small case do not reset most global settings.

arithmeticSelect the arithmetic mode. Checks a chain of arithmetic expressions separated by <, ≤, =, >, and ≥.
array_claim A[0...n-1]Select the array claim mode. Checks a chain of predicates on `A` separated by `hArr`. The index lower bound must be an integer. The upper bound must be a variable with an optional `+` or `−` integer. Does not show the first claim explicitly.
brief_helpPrint short typing instructions.
draw_function -10 10 -5 5;
x^2; 1/x; sin x
Draw graphs of at most six functions. The numbers are the extreme coordinates: left right bottom top, and they are optional starting from the last.
equation x=3 \/ x=-1;
x^2 - 2x - 3 = 0 <=>
Select the equation mode. In the solution, also `rArr` may be used, but then there must be original `hArr` later on. The teacher-given roots may also be x FF, to indicate that there are no roots; or x, to not give the roots (this last feature does not yet work well). One may use ends instead of ;. The assume clause, if given, must be next to the teacher-given roots. The roots must certainly satisfy the assumption despite rounding errors.
helpPrint this file.
mathcheckPrint copyright information. The resetting version is written as MathCheck.
modulo 17
TT <=> EE x: x^2 = -1
Select the modulo mode. Checks a chain of predicates separated by `lArr`, `hArr`, and `rArr`. The number must be between 2 and 25 inclusive.
parse_treeDraw the expression tree of an expression, etc. This command makes fewer sanity checks than usual.
prop_logicSelect the propositional logic mode. Checks a chain of propositions separated by `lArr`, `hArr`, and `rArr`.
tree_compare 1(2+3);Select the expression tree comparison mode. Checks that the expressions have the same expression trees. Does not show the first expression explicitly.

Commands Especially for Teachers

#*This can be used to denote invisible multiplication as a top or banned operator.
allow_compThe relation chain may contain <, ≤, >, and ≥ or ⇐ and ⇒. This command is needed to cancel their automatic ban in exam textareas.
b_nodes 48If the final expression yields at most 48 nodes, a bonus statement is printed.
ban_compThe relation chain must not contain <, ≤, >, and ≥ or ⇐ and ⇒.
end_of_answerPrevents odd-looking error messages to the previous answer on the same page, when used in the beginning of the next question.
f_ban ^ sqrt root;The final expression must not contain the listed operators. When banning *, it may make sense also ban #*, and vice versa.
f_CNFThe final expression must be in conjunctional normal form or a product of sums.
f_DNFThe final expression must be in disjunctional normal form or a sum of products.
f_nodes 56The final expression must not yield more than 56 expression tree nodes.
f_top_opr sqrtThe top operator of the final expression must be `sqrt`. If the operator is `frac(del)(del ...)`, `AA`, or `EE`, also the variable must be given. The operator (independently of the variable) may not occur elsewhere in the expression. When using * as the operator, it may make sense to ban #*, and vice versa.
hide_exprPrint “model-solution” instead of the next expression.
next_URL https://...If the answer is correct, give the URL of the next problem page in the feedback.
no_next_URLIf the answer is correct, tell that this was the last problem in the series.
solve xThe final expression must be solved with respect to `x`.

Global Settings

The effect of each xxx_off can be cancelled with xxx_on and vice versa.

debug_onMake MathCheck print mysterious additional information.
draw_offDo not draw the graphs of both sides when a relation fails.
exam_onDo not give feedback on semantics.
ok_textPrint the text following this command for each correct answer. The text ends at the next empty line, and # acts as the escape character facilitating writing HTML.
only_no_yes_onDo not print the information whose purpose is to help the student find the error. This is useful, for instance, if the correct answer is a number.
prop3_onUse the undefined truth value also in the propositional logic mode.
prove_offDo not attempt to prove relations, etc.
verbose_offDo not print headers, etc., in the feedback.

Deprecated or Removed Commands

newproblemUse arithmetic, prop_logic, etc., instead.
#DUse DD instead.
#xxxUse xxx instead. #(, #), #*, and #/ are not deprecated.
f_ban_derUse f_ban DD; instead.
lfUse /**/ instead.
undef_offThis is pedagogically unwise, use the assume mechanism.
funcpar_onAlternative rules for the parentheses cause confusion. Use #( and #) when necessary.