Skip to content
Classroom

Intervals

Answer type: interval

The student types interval notation — a domain, a range, or a solution set.

The minimum

Common Control:

$answer = "(2,5]"

Bracket type is significant: (2,5] and [2,5] are different answers, which is usually the point of the question.

Options

Variable Effect
$answer the correct interval — required
$reqdecimals accuracy of each endpoint: unless $abstolerance or $reltolerance is set, it sets an absolute tolerance of 0.5×10⁻ⁿ and adds an "accurate to n decimal places" tip; the number of decimals typed is not checked
$answerformat comma-separated format flags, e.g. "nosoln" (adds a "No solution" choice beside the box; use $answer = "DNE" for that case); infinity (oo) needs no flag
$ansprompt text before the input box; with "nosoln" it instead supplies the radio-button labels, separated by ; (interval solution;no solution)
$answerboxsize width of the input box

Unions and infinity

Unions are written with U. Infinity is oo and needs no $answerformat flag:

$answer = "(-oo,2) U (5,oo)"

An infinite endpoint always takes a round bracket.

calcinterval accepts expressions as endpoints (e.g. sqrt(2), 1/2; interval rejects them) and additionally reads $variables and $hidepreview. Both types share one scorer, so $abstolerance, $reltolerance (default 0.0015) and $requiretimes apply to interval as well.

Example

Common Control — setup:

$a = rand(2, 6)

Question Text:

<p>Give the domain of `f(x) = sqrt(x - $a)` in interval notation.</p>

Common Control, continued — answer and options:

$answer = "[$a,oo)"
$ansprompt = "Domain: "

See Also

  • Function — $domain there restricts grading, not the answer
  • N-Tuple — an ordered pair is not an interval, though the notation collides