# Intervals

Students can use intervals in answers, and the system will understand them as their equivalent inequality to compare it with the correct answer. Take into account the particular notation explained below to create these intervals in CalcMe.

## Example

Consider the following question:  To make formulas like $\left(0,1\right)$ interpreted as intervals, we must select the corresponding checkbox in Input options > Input syntax. ### Notice

If the Intervals option is selected, we can also use the reversed notation to exclude the endpoints from the corresponding set. Thus, $\left[-2,+\infty \left[$ will also be accepted.

Finally, intervals are conceptually equivalent to inequalities, but internally (in the Algorithm), they are different data types. We need to use the Equivalent equations validation method if we want students to answer either intervals or inequations. Alternatively, student answers must be the same type as the correct answer. ## Syntax

The interval notation is quite particular. You can create several intervals with the syntax you can see below.

Interval

CalcMe word

Equivalent inequality

$\left(a,b\right)$

interval_open_open(a,b)

$a

$\left(a,b\right]$

interval_open_close(a,b)

$a

$\left[a,b\right)$

interval_close_open(a,b)

$a\le x\wedge x

$\left[a,b\right]$

interval_close_close(a,b)

$a\le x\wedge x\le b$

$\left(a,+\infty \right)$

interval_open_open(a,+∞)

$a\le x$

$\mathrm{ℝ}$

ℝ

$\mathrm{ℝ}$

$\left\{a\right\}$

{a}

$x=a$

$\left\{a,b,c\right\}$

{a,b,c}

$x=a\vee x=b\vee x=c$

$\varnothing$

{}

false

Furthermore, it is also possible to do operations with intervals.

Operation

Example

Union

$\left(a,b\right)\cup \left(c,d\right)$

Intersection

$\left(a,b\right)\cap \left(c,d\right)$

Difference

$\left(c,d\right)\setminus \left(a,b\right)$

Complementary

$\mathrm{ℝ}\setminus \left(a,b\right)$

The student's answer can have operations, and it will be simplified and compared with the correct answer. If you want to prevent this, set Simplified in Validation options > Simplification, as usual. If you want to make an algorithm for a question with intervals, you can not use the interval symbols directly; you must use the corresponding CalcMe word for them. See the table above. There are commands that return intervals; for instance domain_set(). Other commands return inequations; for instance domain(). You can convert the result from inequations to intervals using expression_to_set(). 