# Problem on IntervalUnion\[\]

**URL:** <https://community.wolfram.com/t/problem-on-intervalunion/2039>\
**Category:** Questions\
**Tags:** mathematica, symbolic-computations\
**Created:** [April 22, 2014, 5:05pm UTC](https://community.wolfram.com/t/problem-on-intervalunion/2039 "2014-04-22T17:05:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casperyc](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@casperyc](https://community.wolfram.com/u/casperyc)\
**Post date:** [April 22, 2014, 5:05pm UTC](https://community.wolfram.com/t/problem-on-intervalunion/2039/1 "2014-04-22T17:05:42Z")

</div>

```auto
IntervalUnion[Table[Interval[{1 + 1/n, n + 2}], {n, 1, 10000}]]

```

```auto
IntervalUnion @@ Table[Interval[{1 + 1/n, n + 2}], {n, 1, 10000}]

```

I am really new to Mathematica, so it maybe really simple,

I cant understand, why the first line does not work, but the second do.

Is there a way to use “infinity”?

I want to do

```auto
IntervalUnion @@ Table[Interval[{1 + 1/n, n + 2}], {n, 1, Infinity}]

```

Thanks

---

<div class="post-metadata">

**Author:** ![sukrause](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sukrause/32/41348_2.png) [@sukrause](https://community.wolfram.com/u/sukrause)\
**Post date:** [April 22, 2014, 7:55pm UTC](https://community.wolfram.com/t/problem-on-intervalunion/2039/2 "2014-04-22T19:55:39Z")

</div>

IntervalUnion[] acts on a sequence of intervals, not on a list of intervals. To generate a sequence out of a list one does

```auto
In[66]:= IntervalUnion[
Sequence @@ Table[Interval[{1 + 1/n, n + 2}], {n, 1, 100}]]
Out[66]= Interval[{101/100, 102}]

```

the second form works because the Apply[] operator replaces the head (List) of Table[Interval[{1 + 1/n, n + 2}], {n, 1, 10000}] with IntervalUnion: that way the argument of IntervalUnion[] becomes a sequence, as is usually the case in mathematical notation: One has

```auto
Sin[x]

```

not

```auto
Sin[{x}]

```

Second thing, the way to use “infinity” is to write Infinity:

```auto
In[68]:= IntervalUnion[Sequence@@Table[Interval[{1+1/n,n+2}],{n,1,Infinity}]]

During evaluation of In[68]:= Table::iterb: Iterator {n,1,\[Infinity]} does not have appropriate bounds. >>
During evaluation of In[68]:= Table::iterb: Iterator {n,1,\[Infinity]} does not have appropriate bounds. >>

Out[68]= IntervalUnion[Interval[{1+1/n,2+n}],{n,1,\[Infinity]}]

```

but it’s not possible here because Table[] dislikes unbounded iterators for good reasons (computing time, memory, …) and on the other hand the result is simple

```auto
Interval[{1,\[Infinity]}]

```

Please note, there are different types of Infinity:

```auto
In[69]:= Names["*Infinity*"]
Out[69]= {"ComplexInfinity", "DirectedInfinity", "Infinity"}

```

check them out! As an oversimplified example, you can do

```auto
In[70]:= Limit[Exp[-\[Alpha] x], x -> Infinity, Assumptions -> \[Alpha] > 0]
Out[70]= 0

In[72]:= Sum[1/n^2, {n, 1, Infinity}]
Out[72]= \[Pi]^2/6

```

---

<div class="post-metadata">

**Author:** ![casperyc](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@casperyc](https://community.wolfram.com/u/casperyc)\
**Post date:** [April 22, 2014, 8:46pm UTC](https://community.wolfram.com/t/problem-on-intervalunion/2039/3 "2014-04-22T20:46:40Z")

</div>

I think I understand what you are saying about the fisrt part now. Thanks.

Secondly, so there is no way to do this? I knew that the result is

```auto
Interval[{1,\[Infinity]}]

```

But, can we ask Mathematica to tell me that?

---

<div class="post-metadata">

**Author:** ![sukrause](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/sukrause/32/41348_2.png) [@sukrause](https://community.wolfram.com/u/sukrause)\
**Post date:** [April 23, 2014, 8:26pm UTC](https://community.wolfram.com/t/problem-on-intervalunion/2039/4 "2014-04-23T20:26:49Z")

</div>

Of course you can ask Mathematica to tell you, but not with an infinite iterator in Table[] because that launches the actual construction of the table you will never live long enough to see it completing. Sorry, the world can be so not _fair_. Because both boundaries are strictly monotoneous, one can type

```auto
In[83]:= IntervalUnion[
Interval[Limit[#, n -> Infinity] & /@ {1 + 1/n, n + 2}]]
Out[83]= Interval[{1, \[Infinity]}]

```

but isn’t it ridiculous?
