# AZ Dept. of Education Freethrows Product Part I

This is an introductory post to a product I’ve been working on for the better part of a year and a half as a specialist inside a development team consisting of on-site resources at the AZ Dept. of Education and external contractors, including a lead Flex developer.

The Freethrows product is a collaborative math learning environment modeled around a scenario of a basketball activity. It encourages students to work both individually and collectively in teams. Math problems are generated and presented to students according to templates of the form

*W* op *X* = *Y* op *Z*

where one of the four variables W, X, Y, or Z is the unknown and marked with an unknown symbol such as ‘?’ . op is a shortcut for operator and is taken from +, -, *, or / in the current product.

Variable types may be

INTEGER – integers

WHOLE – integers greater than or equal to zero

FLOAT – decimal numbers

FRACTION – fractions

MIXED – mixed numbers, i.e. 1 3/4

In the case of FRACTION or MIXED variables, either the entire variable is unknown (student must enter the whole part, numerator, and denominator) or the variable may contain only an unknown part (i.e. numerator is unknown).

Variable types provide natural restrictions and they may be further restricted in value by either ranges or sets. For example, a WHOLE variable may be limited to the range [0,5] or restricted to the set (1, 2, 3, 5, 8, 9, 12, 15). Similar restrictions may be applied to the constituents of FRACTION or MIXED variables.

FLOAT variables may be restricted to any machine number in a given range, i.e. [0.2, 1.0] or machine-representable numbers in an interval [a.b] where the value, v is given by *a + id*, where *i* is in (0, 1, 2, …) and d is a fixed delta. For example, a range constraint of [0, 10.5] with a delta of 0.5 is a compact means of specifying a set constraint (0, 0.5, 1, 1.5, … 10.5). There may be numerical issues with some problem descriptions and part of my responsibility was the identification of and compensation for such issues.

A problem template actually represents a family of problems based on all variable constraints. The template W + X = ? where W and X are WHOLE variables limited to [0,5] could generate a number of problems such as

0 + 2 = ?

1 + 5 = ?

2 + 2 = ?

The problem generation process is further complicated by the addition of problem-wide constraints. These constraints, if added to the problem, restrict the number of possible problem generations to a subset that matches one or more prescribed criteria.

For example, the problem W + X = ? could have a problem-wide range constraint, meaning that the solution to the problem is further bounded into an interval [a,b]. This interval might be [1,5], and with such a constraint, problems such as

0 + 0 = ?

4 + 2 = ?

5 + 5 = ?

are not valid as they violate the problem-wide constraint.

Range limitations may not be directly expressed in terms of simple intervals with typical variable types, i.e. integer or float. Fractional ranges might be expressed as [1 1/2, 5 3/4] meaning that the (mixed-number) solution to a problem must be in the range 1 1/2 to 5 3/4. The product must be able to accept and process constraint data in non-primitive form.

Problem constraints other than range-constraints currently supported include

No-Regrouping (any problem involving addition or subtraction in the solution must be generated so that no carrying is required in addition and no borrowing is required in subtraction).

No improper fraction – The problem must be generated so that any purely fractional solution to the problem must be a proper fraction.

Set limitation – The problem must be generated so that the solution is a member of the specified set.

Like Denominator – All fractional and mixed variables are generated so that they have the same denominator that is taken from the supplied range or set.

A limited number of constraints may be applied in tandem. In the current product, it is possible to specify a range constraint on problems involving only addition and subtraction AND force no-regrouping.

Problem constraints may have additional data associated with the constraint. A like-denominator constraint may have a range associated with it, such as [2,5]. In a problem with an unknown numerator, this means that the problem must be generated so that the numerator takes on only the values 2, 3, 4, or 5.

If there are no problem constraints, the problem may be generated directly from variable constraints and this is done by a pseudo-random process (with a modification of the Flash RNG that compensates for natural bias away from integer endpoints). Forcing problem constraints is underdetermined. In the above case of W + X = ? where both W and X are constrained to [0,5] and the solution is constrained to [1,5], there are multiple values of W and X that satisfy the problem constraint. This difficulty is resolved mathematically whenever possible; it is not efficient to resort to explicit enumeration if not necessary (i.e. loop around guess-and-check).

This entire process of problem generation and rendering is encapsulated into a collection of library projects informally known as ‘the math engine.’ Although the Freethrows pilot application was created in near-record time and required a number of architectural compromises, the math engine was eventually re-architected to a strict separation of concerns. Problem generation is completely divorced from rendering and could, in fact, be programmed in any variety of languages (although it is currently implemented in Actionscript 3).

In the follow-on to this post, I’ll detail some of the math engine architecture and discuss an auxiliary application known as the Freethrows Problem Analyzer, an interactive tool for creating new problems or testing/analyzing existing problems.