Skip to content

Operations

Carlos Linares López edited this page Jul 1, 2021 · 7 revisions

This page describes the different operations implemented, their types (if any are implemented) and the arguments they acknowledge

Basic operations

A basic operation consists of the summation/multiplication/subtraction or division of at least two operands. There are two different types of basic operations:

  • Type 0: all operands are given and the student has to provide the right answer
  • Type 1: one operand is missing but the result is visible. The student has to guess the value of the missing operand

Note that it is mandatory to provide the type of basic operation. Basic operations also acknowledge the following arguments which are mandatory:

  • operator: one and only one among +, -, * or /
  • nboperands: number of operands in the basic operation
  • nbdigitsop: number of digits of the operands
  • nbdigitsrslt: number of digits of the result

The values of these arguments can be given either as strings, int or float numbers, but the first one which is necessarily a string.

For example:

{{.BasicOperation (dict "type" 0 "operator" "+" "nboperands" 3 "nbdigitsop" 2 "nbdigitsrslt" 3)}}

generates a sum of three numbers in the range (9, 100) whose result is in the range (99, 1000), where the student has to compute the value of the summation.

No optional parameters are honoured.

Divisions

A division consists overall of three components: the dividend, divisor and the quotient. Currently, mathprob generates instances with any remainder. All arguments are given below and they are mandatory:

  • nbdvdigits: number of digits of the dividend
  • nbdrdigits: number of digits of the divisor
  • nbqdigits: number of digits of the quotient

In particular, the ability to generate instances with a different number of digits in the quotient serves to finely tune the difficulty of each problem.

For example,

{{.Division (dict "nbdvdigits" 2 "nbdrdigits" 1 "nbqdigits" 1)}}

generates an instance where the divisor has two digits, and both the divisor and the quotient have only one digit (e.g., 65 divided by 8).

No optional parameters are honoured

Multiplication tables

A multiplication table consists of a number of rows where a constant factor is multiplied by a sequence of numbers in the range [geq, leq] which typically take the values 1 and 10 respectively. There are two different types of multiplication tables:

  • Type 0: the student has to guess the result of the multiplication, e.g. 3x2=?
  • Type 1: the student has to guess the value of one operand (either the constant factor or the other ), e.g., 3x?=6

Note that it is mandatory to provide the type of multiplication table. Other mandatory arguments are listed below:

  • nbdigits: number of digits of the constant factor which is randomly chosen

for example,

    {{.MultiplicationTable (dict "type" 0 "nbdigits" 1)}}
    {{.MultiplicationTable (dict "type" 1 "nbdigits" 2)}}

generates a couple of multiplication tables of both types. The first one randomly picks up a constant factor in the interval [1, 10) and the second between the interval [10, 100).

The optional parameters are shown below:

  • geq: lower bound of the sequence of numbers that multiply the constant factor. By default, 1.
  • leq: upper bound of the sequence of numbers that multiply the constant factor By default, 10.
  • inv: if given the value 'true', mathprob randomly reverses the natural order of each multiplication. By default false.
  • sorted: if given the value false, mathprob shuffles all multiplications. By default, true.

For example,

    {{.MultiplicationTable (dict "type" 1 "nbdigits" 2 "geq" 5 "leq" 10 "sorted" "false")}}

generates a single multiplication table which multiplies a constant factor with two digits by the numbers in the range [5, 10] where all multiplications are shuffled.

Sequence

A sequence consists just of a sequence of numbers. Currently, the difference between two adjacent numbers is always equal to 1. There are four different types of sequences:

  • Type 0: neither the first nor the last element of the sequence are given. Instead, an arbitrary number in between is given as a hint ---but only one, and the rest have to be filled in by the student.
  • Type 1: only the first element of the sequence is given, the rest have to be filled in by the student.
  • Type 2: only the last element of the sequence is given, the rest have to be filled in by the student
  • Type 3: both the first and last element of the sequence are given, the rest have to be filled in by the student.

Note that it is mandatory to provide the type of sequence. Sequences also acknowledge the following arguments which are also mandatory:

  • nbitems: number of items in the sequence
  • geq: forces all numbers in the sequence to be strictly greater or equal than this lower bound
  • leq: forces all numbers in the sequence to be strictly less or equal than this upper bound

The values of these arguments can be given either as strings, int or float numbers.

For example:

{{.Sequence (dict "type" 2 "nbitems" 5 "geq" 0 "leq" 9)}}

generates a sequence of 5 numbers, all greater or equal than 0 and lower or equal than 9, showing both the first and last number.

No optional parameters are honoured.

Clone this wiki locally