# Intervals

## Example

Consider the following question:

with correct answer:

To make formulas like intepreted as intervals, we need to select the corresponding checkbox in *Input options > Input syntax*.

Finally, as 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 then students to answer either intervals or inequations. Alternatively, student answers must be of the same type as the correct answer.

## Syntax

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

Interval | CalcMe word | Equivalent inequality |
---|---|---|

`interval_open_open(a,b)` | ||

`interval_open_close(a,b)` | ||

`interval_close_open(a,b)` | ||

`interval_close_close(a,b)` | ||

`interval_open_open(a,+∞)` | ||

`ℝ` | ||

`{a}` | ||

`{a,b,c}` | ||

`{}` | false |

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

Operation | Example |
---|---|

Union | |

Intersection | |

Difference | |

Complementary |

The student 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()`

.

LIVE DEMO