Skip to main content

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:

intervals_statement.png

with correct answer:

intervals_correctanswer.png

To make formulas like (0,1) interpreted as intervals, we must select the corresponding checkbox in Input options > Input syntax.

intervals_validation.png

Notice

If the Intervals option is selected, we can also use the reversed notation to exclude the endpoints from the corresponding set. Thus, [-2,+[ 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.

intervals_preview.png

Syntax

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

Interval

CalcMe word

Equivalent inequality

(a,b)(a,b)

interval_open_open(a,b)

a<xx<b

(a,b](a,b\rbrack

interval_open_close(a,b)

a<xxb

[a,b)\lbrack a,b)

interval_close_open(a,b)

axx<b

[a,b]\lbrack a,b\rbrack

interval_close_close(a,b)

axxba\leq x\wedge x\leq b

(a,+)(a,+\infty)

interval_open_open(a,+∞)

axa\leq x

\mathbb{R}

\mathbb{R}

{a}\{a\}

{a}

x=ax=a

{a,b,c}\{a,b,c\}

{a,b,c}

x=ax=bx=cx=a\vee x=b\vee x=c

\varnothing

{}

false

 

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

Operation

Example

Union

(a,b)(c,d)(a,b)\cup(c,d)

Intersection

(a,b)(c,d)(a,b)\cap(c,d)

Difference

(c,d)(a,b)(c,d)\setminus(a,b)

Complementary

(a,b)\mathbb{R}\setminus(a,b)

 

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.

intervals_simplified.png

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().

logic_and_sets.intervals.calc.png