Guide to QCmath

Please skip this paragraph if you are searching for the rules for writing a formula answering a question.

QCmath is a language the purpose of which is to allow quizzes with questions to be answered with simple mathematical formulas such as (a' + b)*(a' - b) eller a'*a' - b^2. Please notice that these two formulas are equivalent. QCmath is useful on quiz servers which do not have access to a more advanced mathematical program for analysis of answers with a formula. Quite a large number of questions within applied natural science can be answered with an expression in QCmath. The simplicity of the language has an advantage, namely that errors in answers are less likely.

A syntactically correct expression in QCmath iss either an algebraic expression according to rules stated below or a function call with arguments, each being such an algebraic expression.

Algebraic operators
The only semantic rules of the language are associated with the algebraic operators addition '+'. subtraction '-', multiplication '*', division '/' together with raising to a unsigned single digit power '^' and grouping via parentheses.
It is these semantic rules which render (a' + b)*(a' + b) and b^2 + a'*a' equivalent.

QCmath "understands" unsigned integers whereas numbers with a decimal point are not permitted.
An unsigned integer is a sequence of digits.

No names known
QCmath knows no names and has, accordingly, no semantic rules for functions.
A specification of an answer in the form of a function call consists of the name of the function followed by a parenthesis containing an algebraic expression, e.g. sqrt( (x2 - x1)^2 + (y2 - y1)^2 ).
A corresponding correct answer has the same form with the same function name and an equivalent algebraic expression.
The quiz author must ensure that the answerers know what names of functions, variables and constants, to use in the answers, and also that between all possible answers using these names only one group of equivalent answers is correct.
Operands in an algebraic expression are represented by names, unsigned integers and algebraic expressions in parentheses.
For expressions beginning with minus '-' a preceeding 0 is understood.

Syntax for names
A name is either simple or extended.
A simple name consists of a letter followed by letters and/or digits and apostrophes (the latter for indicating a differentiation, for example).
An extended name has the format f(x,y,..) in which f is a simple name and x,y,.. is a list of simple names separated by commas, thus the same form as a function call.
No space is permitted between f and (x,y,..) and neither numbers nor expressions in the list.
Extended names are included in QCmath to allow questions to be answered with such expressions as (cos(u)*cos(v) - sin(u)*sin(v)).
(But notice that the same question cannot be answered with cos(u+v) since QCmath knows nothing about trigonometry).
Obviously, the quiz author must in the question state that the answer must be written using cos(u), cos(v), sin(u) and sin(v).
Maybe, in many cases, banal errors in answers can be avoided by using simple rather than extended names, e.g. cu in place of cos(u).

Multiplication signs may be omitted between a number and a simple name, between a number and a left parenthesis, between a right and a left parenthesis and, finally, between a left parenthesis and a name, as for example in 3x, 3(a+b),(a+b)(c-d) and (2+x)d. In all other cases, set a multiplication sign.