0

If my initial/known interval is [0,20) or length 19

And the 3 intervals are: [0,5), [5,10), [10,20)

Using the standard interval addition formula:

[a,b]+[c,d] = [a+c,b+d] I get the result [15,35) [1] not [0,20)

How do I multiply them to check if they add up to the known interval?

Also, there are cases where the 3 intervals don't add up: [0,5), [5,10), [15,20) - in this case, the complete puzzle is missing interval [10,15), so how do I check for that?

izolate
  • 101
  • 2
    $[0,19)$ has length $19-0=19,$ not $20$. Also it looks more like you should be taking unions, not adding. – coffeemath May 20 '14 at 14:44

1 Answers1

1

I understand you mean intervals of integers, e.g., $[0,5)=\{0,1,2,3,4\}$ (range in Python). To check whether given intervals $[a_i,b_i)$, $i=1,\dots,n$, form a partition of $[A,B)$, you can do the following:

  1. Sort the intervals in order of increasing $a_i$.
  2. Check that $a_1=A$, $b_1=a_2$, $b_2=a_3$, ..., $b_n=B$. If all of these hold, you have a partition. Otherwise not.
  • If you just want the union to be $[A, B)$ (rather than having a partition), you only need $b_i \leq a_{i+1}$ for $i = 1, \dots, n-1$. – Michael Albanese Feb 07 '15 at 22:53